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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
  |+ \3 R2 V4 X0 |#include <linux/init.h>* I. u" w8 E  a- z4 _) B  f8 y
#include <linux/module.h>
5 I6 i9 F: s! S( u4 w$ {$ d#include <linux/kernel.h>
% j) F# U& S! S$ N, t! I#include <linux/types.h>+ V8 i) U; E; C: j' m5 N1 W
#include <linux/gpio.h>
7 s/ C& O. U/ p  m2 ^. T  h#include <linux/leds.h>  a0 w# d, u  t" O! o7 G. O+ T
#include <linux/platform_device.h>  |# ^: I6 ~% g" P! D" e% A* m

- n6 m% |1 S! P#include <asm/mach-types.h>1 U( [. I# ^" v$ Q0 C3 D
#include <asm/mach/arch.h>) |" ~2 \6 E! a: P
#include <mach/da8xx.h>( g+ J: s% ]. p  [
#include <mach/mux.h>7 Y# ?& ?3 b% S$ D; b& p
. ]' T8 H: X9 }& h0 {  o) x
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
; u, R3 B9 `2 s9 z( O#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)) z2 T/ y  k* K8 q+ g8 D" Y) ^" s9 a
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)' Z9 D. s6 T$ {# ?; {
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
0 f9 t- l9 L6 V6 g, Y/ a7 V1 Y/ T' {0 I+ i6 R0 Y& c
/* assign the tl som board LED-GPIOs*/* I2 o" ?4 s) }
static const short da850_evm_tl_user_led_pins[] = {, v. ]' }; Z4 d+ G0 A
        /* These pins are definition at <mach/mux.h> file */  i4 C+ a( L2 V* w
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
9 _5 ^& y7 R( a6 q! Y( g7 S! t        -1& r0 C0 F* V5 q8 W. {+ G
};; [$ j5 R3 }. ~
. U; {3 J; e- @0 N' f2 U) g
static struct gpio_led da850_evm_tl_leds[] = {
, M$ s7 M+ {+ e) l' o# T2 ]- h        {
, n, V4 n  _( E' s. C, \+ n                .active_low = 0,9 h# I# u1 c& Y5 D, n/ @
                .gpio = DA850_USER_LED0,
4 \0 ~5 O  _! Y3 n                .name = "user_led0",
3 R9 N' h. H- F                .default_trigger = "default-on",$ m' ?: d+ O2 |( s+ A+ j- I
        },1 o0 y) E$ L' h% k+ m& K
        {
4 j' b7 \1 r" }                .active_low = 0,8 b! W0 ?& o' ~/ L- q
                .gpio = DA850_USER_LED1,
4 B: i- h' J! B7 }                .name = "user_led1",: b( @% f9 X2 N) E( n. p3 V% C
                .default_trigger = "default-on",
- N  G8 ^  u+ ?+ J4 o& r" N. W        },  @8 {- L2 e9 y' S# }3 C8 S, C
        {
( g7 W/ U" F9 O                .active_low = 0,
. R3 E  ^7 d+ u+ B: i                .gpio = DA850_USER_LED2,8 [: n# w1 ]  G
                .name = "user_led2",& V2 k- g/ x# l) `# Z- {
                .default_trigger = "default-on",
1 j# {7 o7 {( D1 t* p/ C        },
& |9 r  ~7 E; Q, r        {
) D7 o7 d* e8 j& j1 n1 u" k                .active_low = 0,
) q2 S. d+ [8 @* o                .gpio = DA850_USER_LED3,0 u' y8 Y  e1 Q$ x, P; `
                .name = "user_led3",
% q$ B* m/ z( [! {, d7 `, ]                .default_trigger = "default-on",$ w0 c* z) I! z" B" q3 Z" v
        },
9 X( g; d0 C$ V) ]5 B8 ~; Z% I+ y};4 f$ I6 s8 x7 f( S, i
, M' t# R: H7 _6 J* n
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {/ S7 {+ V8 N  b) K
        .leds = da850_evm_tl_leds,$ B+ |; l' Y% d* j
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),* _( K# L2 p% Z! E; v
};
1 e/ V7 N' H' k5 w2 {6 o" H% N& b/ r, T7 I% P% K! H6 P2 Q+ D
static void led_dev_release(struct device *dev)
) ~5 o+ R- ^) |: y% w$ z{4 d- j/ Q* f1 l' f
};
6 Z( C# f$ c5 D- |. |2 M+ P6 f; `: n
static struct platform_device da850_evm_tl_leds_device = {) k1 \0 A  a2 E* {* |
        .name                = "leds-gpio",* y7 M& j6 t+ r  W% S9 F4 _+ @# u
        .id                = 1,
/ g: l& N+ w$ V$ H, }+ u        .dev = {
; j& [  r- ^% h                .platform_data = &da850_evm_tl_leds_pdata,' `, _( O6 @# L/ A4 [
                .release = led_dev_release,
3 T0 j' [+ o7 ~( f7 Z# l/ a' B3 T        }
. N: o# z6 r- a% l& W  _};
& G/ m6 ?* ]! s+ a8 l& m% d: ?& ]1 T1 k* _/ f1 L# Y; C" g8 V
static int __init led_platform_init(void)
) D. g" j8 B+ W/ q{: K% j, N! f+ B5 s  `
        int ret;6 }  @# B3 r) X: t% a
#if 0. G  _/ e8 O& }
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);8 v) X: i' }2 s: b% D0 `3 G
        if (ret)
- _' {, E& r. T" X2 h2 i. ^                pr_warning("da850_evm_tl_leds_init : User LED mux failed :": e% I6 n( r$ I+ k: x$ `5 k
                                "%d\n", ret);
6 ]: ]; E* S7 k4 G' r4 R#endif+ [' E% R% {; K' n9 C+ P! S8 ?
        ret = platform_device_register(&da850_evm_tl_leds_device);
" A% M, i' E; ]% }% V- V+ z! d. g        if (ret)
& p* F* ~. w; l/ G$ k( @                pr_warning("Could not register som GPIO expander LEDS");- \* |" n4 r! z, H
        else  @, Y- t/ w: O; B
                printk(KERN_INFO "LED register sucessful!\n");5 m7 I( _5 b3 H  c3 G
. h6 _# I( ?; l) I! I: e, ~% n
        return ret;( z0 e0 P1 p4 T& u
}
+ ]5 v( f. v- q8 F; Z
6 ~, j& r' g* W9 Fstatic void __exit led_platform_exit(void)
1 ?$ h5 |5 t# w) `{
8 [# [, D* F6 w' f        platform_device_unregister(&da850_evm_tl_leds_device);# B: X9 @( Z. ?/ R2 L5 S. v

' x& t8 r. Q2 N1 z7 G        printk(KERN_INFO "LED unregister!\n");1 h. {9 z. |. }, P
}7 N, Y' D* X7 U& z# a" z
: j" A. i* k6 Y7 _) \" E  B
module_init(led_platform_init);" C. g9 W3 A) I" q; E
module_exit(led_platform_exit);
  r3 f5 R, x, S9 S8 J8 j9 A/ \  j
; _/ \$ a# j! W* ?) H, yMODULE_DESCRIPTION("Led platform driver");
+ W8 T2 O5 `" d* N( ]& F: PMODULE_AUTHOR("Tronlong");
3 O% B2 ^5 O" X' r" m* d( ~8 }MODULE_LICENSE("GPL");7 \0 ^4 A. O$ `

7 ?- f* s+ e3 ?# s' j9 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 18:58 , Processed in 0.039728 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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