程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9274|回复: 0
打印 上一主题 下一主题

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。  E- N7 p, B4 |* Z
#include <linux/init.h>
9 j% v2 i& a5 m0 K$ F" P  x! l* ?#include <linux/module.h>6 `  V  w# j$ b. ]& Q  T9 [
#include <linux/kernel.h>' x% s, D( b3 l
#include <linux/types.h>6 q/ F, A* B$ V% G8 J
#include <linux/gpio.h>
: R- `, v3 r4 v" ~#include <linux/leds.h>& V& I1 G8 t- H( l* N* s0 }
#include <linux/platform_device.h>/ C% }* g# l8 @3 P5 ~- m( C

% |, Y+ j' f; R+ M1 O% q#include <asm/mach-types.h>- _! @7 y' U- l* O
#include <asm/mach/arch.h>" s2 i  _& Y5 N1 l/ [
#include <mach/da8xx.h>
2 C* L! {: x+ a#include <mach/mux.h>
. A% ?8 W0 `/ E. [
' V5 w/ `' n) J6 ^+ C#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)) s/ f+ i; T- g3 L1 d' G/ H
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)9 K$ c( ]- r- {, ~* o5 C( C2 J
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1), k* G# A; u( {: t5 F
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
/ S, T/ F* q; k* N; S0 l2 g/ t
0 Q# S/ p5 K2 w0 G/* assign the tl som board LED-GPIOs*/
7 j+ `1 L: j9 C9 h7 G. \+ j1 Wstatic const short da850_evm_tl_user_led_pins[] = {
/ w2 S: h/ s7 l" @! T4 B8 ^6 c; C        /* These pins are definition at <mach/mux.h> file */
9 ~' @- F) S6 R$ \" Q# o7 [        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,9 z3 S: b* @5 P1 j% L# ]
        -1% F/ J( I3 T0 N+ R9 O# N- i* v
};+ A8 g+ {- ~* |. V+ _9 v
+ V. q% K8 _. h" @- U* J
static struct gpio_led da850_evm_tl_leds[] = {
2 m+ W2 D; ?; h" l- L        {
1 K) b& T% w0 K9 F$ j                .active_low = 0,$ o$ I4 Z6 a; }3 V
                .gpio = DA850_USER_LED0,2 v( T4 c, s+ Q2 s1 Q
                .name = "user_led0",
" F# J/ P8 \; a% D! J                .default_trigger = "default-on",
* P/ s6 s; l1 N6 @1 g/ M) V; \        },! E. {0 H+ Y- Q$ o
        {0 O3 v; z4 N  y, N+ n# t% r
                .active_low = 0,
1 n; m0 Q( d: w  A% j                .gpio = DA850_USER_LED1,
2 q& I6 _2 w1 O) m                .name = "user_led1",
, h% K7 q% M# }& a2 w4 P# y1 E                .default_trigger = "default-on",
* x0 ]9 H( {  N1 I5 ?8 q( Y3 ^        },, T: C2 Y! {! D7 c1 z  T
        {
! U2 j+ B3 F3 x8 ~                .active_low = 0,3 n$ Z0 ^/ N# [; H* t- @
                .gpio = DA850_USER_LED2,1 ^4 p# w- P5 _. {1 G% u$ W/ C
                .name = "user_led2",0 G5 J5 \$ k7 n3 H  Q' y
                .default_trigger = "default-on",
. X# F5 y. C/ n6 }' H2 ?# p        }," V& J, a+ c, Y& ~% ~0 o: k/ B  n
        {" l) B9 L+ [* k2 H
                .active_low = 0,4 h/ m) ?' J) T" v' ]& c
                .gpio = DA850_USER_LED3,* P" ^' A8 N1 P3 C$ p* q
                .name = "user_led3",
$ w* S/ s& p( f9 L# y/ h                .default_trigger = "default-on",
+ G' K$ N4 c7 z2 h        },
" U6 I: g9 h2 ~. X$ F};" }' u4 F( e4 }4 ^; U+ o4 X

- j, M6 Y% ~! c, L: R4 D/ ^" B5 ystatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {& c: d9 ^: L9 k' \! t9 C# O1 x
        .leds = da850_evm_tl_leds,/ A. _! P: y# L+ X
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),4 L8 U7 Z! p6 x8 s* ]. `! J
};
  y7 S( m0 O, _* I
" e: b5 }4 f. g! F% ?- lstatic void led_dev_release(struct device *dev)4 i3 y5 Z, W; u& Y& ]3 z4 l* A
{* L. F0 o5 T" e# W
};
4 Q& i. z; R5 |. r  k/ S+ d
" y5 s7 _1 y' d! \/ dstatic struct platform_device da850_evm_tl_leds_device = {
) ?, k1 P+ j: L. i        .name                = "leds-gpio",& i0 o# N. }$ z' Z- k" E# f& P
        .id                = 1,  p) T1 M% k7 Y+ B! X* o6 ]1 o! G* {
        .dev = {
. B% ?; I1 l6 Z0 p2 t                .platform_data = &da850_evm_tl_leds_pdata,
  t# S8 P" B% c/ }; ?$ T                .release = led_dev_release,8 A. m! k, \6 e
        }# ]# x$ }: K6 M
};! M1 z0 `5 t* V8 ~

  X  s+ R5 V' h0 ?. Tstatic int __init led_platform_init(void)6 _0 ?0 L' I2 y6 j. O- z
{; M8 U; N9 r' ]; n4 s/ e" p, H0 A5 }
        int ret;) t" e  L" b* ?( Z  W  X0 }
#if 0
4 ~' B1 \6 G" M$ Y        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
# R5 e9 m4 ]. ?, Z        if (ret)$ I8 e* r. x4 z: t; {
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"$ n) q4 z" v, \. {/ z, B
                                "%d\n", ret);
7 r0 Q8 s5 S. ^+ ?#endif. x# I9 s5 `+ f8 U& `& k
        ret = platform_device_register(&da850_evm_tl_leds_device);
2 ?3 b0 M4 u) }6 P        if (ret)# T7 g0 s; s- R3 P% t3 l$ [; c
                pr_warning("Could not register som GPIO expander LEDS");+ x9 h; A6 G9 U
        else
7 Z; y$ i/ P4 ~4 G8 x1 f3 O6 {                printk(KERN_INFO "LED register sucessful!\n");' i! T) J; |( \1 p9 i  S% e# l
' m$ X$ _6 p3 }- `
        return ret;
  p. v9 [2 A/ B}" T3 \* f& }8 k# _

& K# K- D6 {8 f; Q7 @3 Pstatic void __exit led_platform_exit(void)" E! G: z0 j; o. w9 h
{+ O% n% W) f  H3 B
        platform_device_unregister(&da850_evm_tl_leds_device);+ c; P: ]) G- A8 X/ J1 X
" [1 b% y  F1 E' A" q& Y" p
        printk(KERN_INFO "LED unregister!\n");
' ]8 t. O' k& M/ a8 n$ |3 K4 M}3 l7 p( L7 J0 J$ C" S4 G% ]6 C
/ F" g4 ]% R" }; \5 B
module_init(led_platform_init);8 z( d7 w; [) X7 K
module_exit(led_platform_exit);
% [5 O9 L% |4 J/ @! b8 {
& O' ?; h$ M' i) D% w3 t/ KMODULE_DESCRIPTION("Led platform driver");
/ m2 [4 z" H* |' V( X( e6 B/ I" jMODULE_AUTHOR("Tronlong");; O; K5 y2 p1 ^% {
MODULE_LICENSE("GPL");
. o- w7 K+ `* q. w6 O
. T" }) K2 y* f, i+ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-2-14 06:00 , Processed in 0.044156 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表