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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
, g4 I8 B1 e; T: a% K5 Y#include <linux/init.h>: j& ~3 X* T$ I% D0 N
#include <linux/module.h>
; o% R) W! l3 b$ ?/ k- O: a4 Q#include <linux/kernel.h>6 Y! b6 ~8 u# L
#include <linux/types.h>
7 K$ M; H6 e" M7 N/ ~#include <linux/gpio.h>
, G* r# F4 Y! D. O5 ?2 p#include <linux/leds.h>1 W3 _! Y/ H  C: P3 x) q0 B
#include <linux/platform_device.h>$ \6 a! r( U0 }
1 _: J  `% {- s& J/ l
#include <asm/mach-types.h>  e+ P# q. b. H7 I0 }& g
#include <asm/mach/arch.h>' _; m/ q5 n2 I  a$ r! m
#include <mach/da8xx.h>
2 k  I, w' B$ l- v#include <mach/mux.h>
" |1 S/ U3 g) Y, a. N/ q' L6 E+ Y) U9 S
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
. a2 p# \- P5 n8 p7 n# \: K#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
6 }# ^) {, h1 X0 R#define DA850_USER_LED2        GPIO_TO_PIN(0, 1). e) L3 u/ ^$ `& G3 }9 t/ _
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
, x! \9 w5 y% R3 A
7 t9 ]8 W7 o( W- A/* assign the tl som board LED-GPIOs*/
1 ^% K, ]& M7 t; bstatic const short da850_evm_tl_user_led_pins[] = {
+ j+ m% G6 r- ]$ i. K7 i/ F1 ^        /* These pins are definition at <mach/mux.h> file */
, F' v) [3 b; Q4 _( E# U+ O# q' ^: Y        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
: P! Y: q* X% b! D5 A: r        -1
1 {9 P; k$ W: [+ v4 u1 L7 w};
# b: [5 `# R+ x* |- z/ V
7 o$ N/ q( }0 b' Z& ~% O7 Q, r5 cstatic struct gpio_led da850_evm_tl_leds[] = {& A9 q8 y4 ^% ?
        {4 ]* B# n& J2 J* W) a) A: z
                .active_low = 0,
' W4 U5 I  l9 m1 D1 B2 `                .gpio = DA850_USER_LED0,
! d& {4 ?- T! C+ Q  b! w# n  s                .name = "user_led0",
8 k3 u! V! k9 k* n                .default_trigger = "default-on",  W2 a8 O& Y. r8 p
        },7 p+ e3 H8 C3 t4 ]  C# T+ k9 A
        {
7 @- i6 x! Z) }5 M3 b0 A                .active_low = 0,
# Z# D2 f- A" G/ o& N                .gpio = DA850_USER_LED1,
5 W' Z, R/ V% d7 s) a: E                .name = "user_led1",
  a5 r# m) m; `$ w7 {) m3 ?                .default_trigger = "default-on",
. A9 I# b; [3 R9 G        },0 m7 K7 \# G# c) y
        {+ S0 p3 |) F) j' }6 s
                .active_low = 0,) `( t0 v8 m1 \
                .gpio = DA850_USER_LED2,
- h0 P6 _7 Z4 Q                .name = "user_led2",
" S% o% D$ k# o! f: u: M! M                .default_trigger = "default-on",
+ m7 S2 U4 f7 @6 j) m3 `7 f        },7 o( C' u8 {! {+ j9 m/ _! Z! F: G( Z
        {9 |. G5 ]( M# n  u! C1 F$ {* b" B! N
                .active_low = 0,/ a9 D6 O  J1 w$ h% R  h0 u7 m
                .gpio = DA850_USER_LED3,
7 J. b# {! w9 s/ O9 K7 h! T" b7 i                .name = "user_led3",' v7 z+ T; `$ Q$ M6 b
                .default_trigger = "default-on",2 S6 w7 J$ ]' z% G- f
        },
6 ]' W; S; f" e};
6 x, k9 K' V( n1 R! g9 @* ]' ^
) t8 N8 |* `; x* xstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {4 C) k$ w) f2 Y
        .leds = da850_evm_tl_leds,
1 y0 I5 ?+ r5 o* H  C8 A3 J8 M/ A7 F        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
$ G. ]0 v4 K& t};
6 `8 T; x# E6 f8 t* y
/ v& f! ~8 J& C8 }9 k3 rstatic void led_dev_release(struct device *dev)
3 Y! [0 K, c3 o0 {. J{
2 G% y' O/ R9 F( M3 Q};
0 p! i5 w7 B* \, B
* P" l* o( @5 a) a6 Gstatic struct platform_device da850_evm_tl_leds_device = {7 N6 R  |  i8 n; g- z  X4 \% Z3 R% K. t
        .name                = "leds-gpio",
5 ?1 Z# ]8 U' k# x        .id                = 1,+ B# X0 g+ P3 S7 I3 y% U; F1 L
        .dev = {
; A, W( L- x0 E+ z# R                .platform_data = &da850_evm_tl_leds_pdata,2 n+ E3 ~* j2 g9 q2 r" X( K! D: {
                .release = led_dev_release,
0 u7 r1 j. g2 q. h4 b2 w        }/ Y, \8 w0 V- ^2 B7 t
};
) b3 n6 F6 [* a) d: G1 ?0 `( z6 o  b4 T" v& P
static int __init led_platform_init(void)
1 K) H( F$ r' U{
4 i2 Z. v6 X$ {  R( ^" t        int ret;2 V5 |( T% D2 v% V! W3 Q5 ?, {  B$ K7 M
#if 0
) N3 w! F3 L  a3 n        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
) I/ o# t" d4 E7 i' c6 P        if (ret)) j; K! L" A! K# S: N  ]* k
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"  ]5 c2 l2 x- u( r( ?1 j) r: i0 l  `
                                "%d\n", ret);
* I! n9 O8 c- I, R#endif
, k0 z+ X3 z0 |2 ?4 L- M& U        ret = platform_device_register(&da850_evm_tl_leds_device);
: u: L4 n8 }2 t" s6 D4 P# n        if (ret)
7 R) I, p: Z" |                pr_warning("Could not register som GPIO expander LEDS");# l7 U, }+ q7 Y: b0 i
        else
/ D5 W& }% @$ A1 s- W( |                printk(KERN_INFO "LED register sucessful!\n");+ ^# U5 a, ?0 F

, L3 C4 T% U; f8 p# v. G        return ret;
+ f$ ]8 S; ^5 C* k+ s( n}( h. W+ g- B1 E2 b0 b; G

/ Y. D$ z& w6 m4 Y. {1 Mstatic void __exit led_platform_exit(void)/ ~8 b5 A2 X4 v0 U" p0 e/ M
{% |, y$ h( b& p
        platform_device_unregister(&da850_evm_tl_leds_device);; |, [7 {$ X1 w
' k7 p9 p: x9 f' @/ j3 [
        printk(KERN_INFO "LED unregister!\n");
; O3 ]6 O+ j2 C# @- b}
' J# ]" _$ y: k& y9 x) ^4 [( F# g; N1 E4 ]) e4 P+ C9 f+ X, |
module_init(led_platform_init);
" K; r& K- @7 B) W: _$ }3 i2 |module_exit(led_platform_exit);1 `% R% O8 ?7 I( L1 M( c% g$ B

" @% J0 [* X1 W# @, IMODULE_DESCRIPTION("Led platform driver");
5 c( x6 }/ G9 O7 |% [9 d% tMODULE_AUTHOR("Tronlong");
4 ?, G' b6 R( D. |4 N) l4 R3 M8 sMODULE_LICENSE("GPL");
/ h$ q2 L' h2 F1 s2 d3 X6 }9 p3 U, W0 ?' c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 19:11 , Processed in 0.039028 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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