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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
- c; A; S0 E! X#include <linux/init.h>2 B) F: l! D# e5 G
#include <linux/module.h>& G# |8 G- ?/ |
#include <linux/kernel.h>
: Q9 k9 z: _3 b4 s9 o#include <linux/types.h>, h! v- y- P, R( a
#include <linux/gpio.h>- O" k* p- c' R- R" }0 p
#include <linux/leds.h>
7 T/ F! c9 b7 a- n8 v, v#include <linux/platform_device.h>
$ T6 n- s: Z: C! J6 G
) ?" }% u# V8 _. j+ k- [! X$ g#include <asm/mach-types.h>
& w: \0 p) d+ j#include <asm/mach/arch.h>2 J! C% g2 T% s* ]! d/ l
#include <mach/da8xx.h>8 A( S) m1 H  x5 t9 k8 G3 c% B7 E0 K
#include <mach/mux.h># I* G/ Z1 @) C: n
: Y! d9 C& s( A) `8 G
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
. o0 l% t4 J5 B; M* A9 T# z' \" i#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)* [# ]* s  D/ I/ ]% D- Z* W+ ]
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
8 J; A+ D+ B( n9 Z6 o% f3 ]- Q#define DA850_USER_LED3        GPIO_TO_PIN(0, 2): ], n7 v3 T! U5 l
: b/ T9 ^/ g0 X' U- N. O. w0 |7 v* k
/* assign the tl som board LED-GPIOs*/
$ v! v! }$ |% K, n; W! ystatic const short da850_evm_tl_user_led_pins[] = {# P% V5 U! C$ s8 C
        /* These pins are definition at <mach/mux.h> file */
* s$ _( Q' ~7 T- d9 k4 X3 N        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
( A) c) ?) ~( b7 o        -11 D( ]& c0 m/ W$ K
};2 K% G4 x, N3 r6 ~5 V: {0 T3 Q$ W

/ i: o, m# g% @% }static struct gpio_led da850_evm_tl_leds[] = {
2 S2 c4 ]) G4 _        {
' j; ~* \7 f) \2 w: ]5 K5 c                .active_low = 0,. h+ ]5 z" W+ @1 g
                .gpio = DA850_USER_LED0,
, _3 n2 P8 F. s" k                .name = "user_led0",, m9 M" X: m! v7 n/ c5 \3 H9 s2 r' i
                .default_trigger = "default-on",
- Y$ g+ X; B/ a( |9 B        },
9 V% E2 J+ P) n) x7 |        {) Y! p# \9 _0 r8 R4 X2 }; C1 Y0 `6 V9 G
                .active_low = 0,
/ V0 F8 R/ F. l' k1 E7 Z                .gpio = DA850_USER_LED1,
# [: G0 u2 C1 Y, f; ?" e) b" D                .name = "user_led1",( {' P2 u$ H9 n( @6 g
                .default_trigger = "default-on",. m+ e) c* o; N. S
        },7 ]$ d  P0 A* v
        {
: _0 u/ v" R5 b! r9 @6 r9 C                .active_low = 0,3 x5 p, L" Q' a* m9 B# F5 U
                .gpio = DA850_USER_LED2,
2 o4 ^& o7 S  O" Y                .name = "user_led2",2 ~  _2 i& R% Y8 _/ `$ s
                .default_trigger = "default-on",2 q* I0 M/ K$ S; ~" S) n4 J5 A
        },
' _1 R7 d$ M  t3 H( _8 C, S        {
. T3 |2 Q/ j% _5 k9 E. H& M                .active_low = 0,2 }! k3 u8 K- Z* ^1 m/ f8 U; C( [
                .gpio = DA850_USER_LED3,+ ]  A- f$ T( R, `5 C- E3 O. \' I
                .name = "user_led3",
1 U# t& x' r4 o% K# p/ a6 G8 l/ Y                .default_trigger = "default-on",
* `+ [5 `9 M/ @: O9 V        },
% @) F% Q5 X7 }- E; t};% f% w- |- B; d  J) d3 V
6 `7 I* h% E; @1 D/ }
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {  ^1 {9 _$ {& z: G# w
        .leds = da850_evm_tl_leds,
( z7 A' m# Q, ?( Z        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
1 u& A4 U& L1 O7 w/ X% a% c6 d};/ r, h  a) f0 q2 a6 h% p

& v3 n7 B7 E2 v! N& K2 Dstatic void led_dev_release(struct device *dev)3 ?& L: i1 m* x+ M1 o
{: F; Z8 w" u4 `  J5 x
};9 Z# |% `* a& G) w

! \+ u3 j! D& K8 A. k5 m0 Estatic struct platform_device da850_evm_tl_leds_device = {* k. ?& ~6 X: |4 N
        .name                = "leds-gpio",
" Y. V. s+ Y/ F  I% E        .id                = 1,  d* Y$ k% T3 N' r4 K& y
        .dev = {# |/ H2 I$ t8 [6 W( j6 ]
                .platform_data = &da850_evm_tl_leds_pdata,& a5 @% ]4 N5 s/ I+ \
                .release = led_dev_release,# h# e; B3 S5 {" }' s7 Z
        }7 s" Z8 ^+ ~7 E
};1 e0 U4 T) B+ m. E- v

1 K% G+ k; W) F6 Gstatic int __init led_platform_init(void)  R/ V* P* n3 q) C  Q- A" ?
{! _6 o9 |  v: h$ U1 P, h/ ^2 H
        int ret;
+ o8 f4 R, D) m: z5 R( q! a* J#if 0
7 f- e  }/ ^& V& d0 }2 w        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
" }3 t8 \) j$ y$ b8 D        if (ret)
1 e7 e* r4 u* J8 [* i                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
3 B/ t& w1 P* w; s                                "%d\n", ret);9 F$ z4 m; H' q4 C
#endif
/ Z8 i- }. p' o% ^& c3 r1 `        ret = platform_device_register(&da850_evm_tl_leds_device);1 _2 i" V8 X) l! j% p' P
        if (ret)+ q- E+ T# `  Q/ w: ?. c/ J
                pr_warning("Could not register som GPIO expander LEDS");3 U; a! i% o% M1 X0 B! E: X
        else5 I5 [: H  P- n. F0 i1 Z% Y5 o
                printk(KERN_INFO "LED register sucessful!\n");
2 k& t; q$ n6 _0 o& c4 x
' f% A. c' c# |5 p7 ^( l: H        return ret;5 N& W0 B% y! o
}( B; U9 @# |5 J: o" V

, D% H/ o- Y- l: Q3 o; I* S/ Xstatic void __exit led_platform_exit(void)) [) d* m6 Y5 V6 ?4 d
{' b$ P! Z- ~+ n8 |
        platform_device_unregister(&da850_evm_tl_leds_device);
2 P! I# F+ u' ~' F0 N! z- M3 z9 f5 h/ E$ r% [, `  M
        printk(KERN_INFO "LED unregister!\n");
: R& `, f' Z3 r/ m9 ?  }& ~+ p}
1 P$ H5 h0 X0 ]" E+ q( Z5 T; U. q% U3 m
module_init(led_platform_init);$ p! u) f( k. J. n* t3 s, B
module_exit(led_platform_exit);
0 R/ p% O" g5 X5 b3 _$ l
" a) o4 N2 h: d- P/ A* w3 uMODULE_DESCRIPTION("Led platform driver");
+ Y' i2 C9 a# T# h4 k& wMODULE_AUTHOR("Tronlong");
1 Z7 L9 D9 r3 N6 [- [. uMODULE_LICENSE("GPL");
& W5 V4 K8 A: \8 r2 O/ P3 |; g8 e& I* u5 g) P8 y2 g# H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 07:53 , Processed in 0.043848 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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