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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
' t6 w- b, P0 A# |. l) b#include <linux/init.h>
8 G; N0 R, O6 b" [#include <linux/module.h>
% P) R, Q: `% t#include <linux/kernel.h>0 t" I1 o8 x8 y; o( N# I  E$ Z/ u; |9 V
#include <linux/types.h>
# |7 t0 X# g" t9 l+ q#include <linux/gpio.h>
  \8 |$ P( h1 e  M/ t3 f3 |  `* f#include <linux/leds.h>; k9 s2 \6 d& |/ @
#include <linux/platform_device.h>
9 `7 o& m6 S! k5 I% P  R
# i$ N" k) G' m#include <asm/mach-types.h>7 i$ v. A6 l" Y/ p6 t' t" s
#include <asm/mach/arch.h>; F/ g$ s% y% _& j2 p
#include <mach/da8xx.h>5 S6 X% m5 Q0 ]) W- y4 Q; T  K. n/ Z
#include <mach/mux.h>
% D& X( w* L: {( F5 E* I6 C9 J% B6 E. {, P5 @7 R0 |
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)4 x8 o4 W9 n& s
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
6 B5 D' b0 y1 O" m& L8 G$ {3 R#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
" i1 x7 j3 N% w9 e: N8 m6 |#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)3 b4 {& v8 ?* Z( U

  L6 f7 J# p& }" Z, Y" Z$ {/* assign the tl som board LED-GPIOs*/( m9 B8 H0 K/ D; n7 Q
static const short da850_evm_tl_user_led_pins[] = {; w+ }0 ?9 D9 f
        /* These pins are definition at <mach/mux.h> file */2 l% }$ W, u2 |( L8 Y, q' @. v3 b
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
9 B! J4 a' L% w        -1, t$ j9 v# A+ P
};
' e3 E/ l7 r7 f' u1 J! x8 K2 M3 r
2 J, i( L0 O1 U' [! K5 a' astatic struct gpio_led da850_evm_tl_leds[] = {
, ]8 z; g2 ^! J. L$ K        {- m! t5 |) d) K# B. Q* _
                .active_low = 0,) z0 I/ G- @8 E/ _8 A
                .gpio = DA850_USER_LED0,
( i3 S5 }; }# f2 N$ s: V                .name = "user_led0",: g" ?8 Q# s! O! c
                .default_trigger = "default-on",- W- R% L: G5 Z4 Z
        },6 [6 L0 {, `# U/ _2 ^
        {
/ w. |0 r( P) N9 A2 z                .active_low = 0,
: {2 U' ^# ]  Z) U+ N# O- _; B  K0 ~2 C                .gpio = DA850_USER_LED1,
$ p% O$ K9 l. o* g3 x+ F                .name = "user_led1",( O% v0 n4 O- `; F7 O
                .default_trigger = "default-on",
/ q% W' s+ D* G7 O( o2 {        },
: L1 v% Q# N4 [4 G, ^% I        {( B( U4 B. e" _# L0 c* t
                .active_low = 0,. Q* M0 Q: P) B% B2 N. t
                .gpio = DA850_USER_LED2,( A' q# T* \6 i1 f8 n( j( D
                .name = "user_led2",, j! B0 ~1 Y5 G: A* ^' x" C
                .default_trigger = "default-on",7 b' `0 w2 X9 F. S5 w
        },3 H& u! m+ Y2 b- U; V( V% ~0 Y: g
        {- z. N* k. B/ K
                .active_low = 0,
% b1 U0 B9 m; S                .gpio = DA850_USER_LED3,2 ^( [5 T9 |- M+ J4 c
                .name = "user_led3",# \# B* X  }; a! A9 `% k/ h. C# s
                .default_trigger = "default-on",
$ u' L' g; F4 Z        },
: A/ j* g7 H3 @* a9 T};; L! [1 F, L+ y( _5 M& x

4 e6 v- ^+ y9 \8 Zstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
* \" q/ E( U6 V4 ?6 y' s3 h9 W6 A        .leds = da850_evm_tl_leds,& L+ O: q$ @5 s5 j! \' ^
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),- g! C# u6 `, D  `. p; ]3 i/ T
};
8 F$ o) o% s% }1 B8 M9 ~8 K
0 J8 s$ g' f7 Q' C1 t+ k: y7 [static void led_dev_release(struct device *dev)
5 m' s6 Q4 q# ]  j# l! B{6 p* a9 H7 W: r# [: h# ^0 u8 P1 V+ a
};9 _4 D4 h* K& y3 p* K
5 W/ t% a& a1 y% u: h
static struct platform_device da850_evm_tl_leds_device = {. B/ n4 I# Y) }5 J
        .name                = "leds-gpio",
  T! r) N5 P/ ]3 q# H. J, ?  W4 s        .id                = 1,6 h+ S; R- q8 E& B' s, ?! M
        .dev = {0 ^0 `2 l. p; V8 P& v% k* |
                .platform_data = &da850_evm_tl_leds_pdata,! V6 j$ q2 i# F7 z; k/ j
                .release = led_dev_release,
( D( f+ K9 G6 D8 R% }, T        }
3 i1 R8 D/ j4 O; P  j};8 P( }8 k  Q* u; \% x

* r* }- x% x, S4 b! [' ?: rstatic int __init led_platform_init(void)
1 w+ c- {2 `! @3 z6 D' U{! S/ D/ o; W0 S2 S; `" l- R
        int ret;
3 G  D4 k! [9 V+ n#if 0
) j" n& V1 o  M- N$ q% C        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);+ ^; \$ ?- p5 S  i; O0 a
        if (ret)) G1 W" P8 X5 `
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"# q3 ]: Q" L' A- v3 @
                                "%d\n", ret);3 p' E/ e/ y2 a% P4 m4 K
#endif
) B- \/ Z1 y, q' V6 S        ret = platform_device_register(&da850_evm_tl_leds_device);
; F: K& w5 M6 B8 N5 z. F' c4 d        if (ret)
0 L! m" {% w! E1 o4 c0 o                pr_warning("Could not register som GPIO expander LEDS");" `; T4 A/ ?+ R% W) B8 k, _
        else
/ e9 A+ h: u8 l0 R1 F3 v! P                printk(KERN_INFO "LED register sucessful!\n");+ l& Q7 k9 M8 i. h) u$ C( c+ Q. |

$ l1 v+ I# |1 \; L" d" q* f        return ret;6 s% o& {  S. c- \& M7 l
}. R, K6 Z* Y. g# C2 w0 y- \
  b- d4 r1 P4 t# y
static void __exit led_platform_exit(void)
% y, ?( A- P+ i0 h# U{. B5 ^0 m* t2 D
        platform_device_unregister(&da850_evm_tl_leds_device);
! Y* M: l+ W* b8 }% K' R; Z% J0 |  `1 E7 T4 \  l. p# J
        printk(KERN_INFO "LED unregister!\n");
4 W0 e8 E  _9 O0 t" ^5 n. I- w8 A! D, F3 F}& V4 W: l, c% x+ P7 N- ~
: ~% U& ^! S, I* O
module_init(led_platform_init);
" W) F& A( [) c8 qmodule_exit(led_platform_exit);
+ x, v& R% ~7 G- a% a! X$ V
, V5 D' U2 n  bMODULE_DESCRIPTION("Led platform driver");
) _  ~/ w. S- A* V6 H3 u; {MODULE_AUTHOR("Tronlong");0 A6 X% U6 k8 J" B( Q% j$ T
MODULE_LICENSE("GPL");: H' R5 f( v+ a! Z- o3 v

) k: T/ P# a5 ]- N, B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 05:38 , Processed in 0.040878 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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