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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
' F+ U8 N  P$ I# i7 p* X3 G#include <linux/init.h>
# ~9 r) h% N( z6 h% L" q2 N. h#include <linux/module.h>
( y6 o: Y( S. \#include <linux/kernel.h>
4 u" w' H% t/ N/ f% l3 u4 N#include <linux/types.h>& `, J3 A# V, ]7 _0 _. A
#include <linux/gpio.h>  _4 G8 G: |9 G, @1 t
#include <linux/leds.h>1 t' h' p& w! ~" F$ V
#include <linux/platform_device.h>) I6 E  C8 W3 I$ ~: u0 Y9 y: v5 N% e
# Q, J2 y. T! }* J9 _2 {
#include <asm/mach-types.h>
0 k. h* D3 H# @( L! u1 }5 Z' \+ T#include <asm/mach/arch.h>  W$ j/ l7 P7 i9 c; {5 M" M) c
#include <mach/da8xx.h>
8 k$ R5 ^! Q- o% s#include <mach/mux.h>
% b- A5 g1 W: k- [8 z8 t
" E1 l& I9 [7 g$ l: T& P: o7 ~/ Y#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
7 M% j. j& \" y, o$ Q* o* i#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
& O- W0 ^5 V- U# E* I" k! D3 Y#define DA850_USER_LED2        GPIO_TO_PIN(0, 1); T, e( _5 u' w2 }( A4 s% i+ P4 l
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2); |- Y  @" h: ~$ I; v8 N/ D) k) F8 i

% o) J! r8 T/ q" n/* assign the tl som board LED-GPIOs*/; h# w8 Q, K, }* E0 Q* P/ M, g
static const short da850_evm_tl_user_led_pins[] = {
+ m1 {: ?- W1 `/ c4 B9 F( h; m        /* These pins are definition at <mach/mux.h> file */  H) o8 I$ o4 D  f! g, i2 f
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,+ i' a" }/ g. n+ Y; |3 M1 z7 I- M
        -1
# o5 @+ |* N) M7 c};
' R3 p1 h" k; k9 H' [  U1 ?6 h) o: t4 u; K2 _2 F
static struct gpio_led da850_evm_tl_leds[] = {
6 T! K. y8 A9 s% @3 o8 V        {3 H" Q6 B4 T: z" ?
                .active_low = 0,
4 A9 i- u, H/ U5 B5 I2 I                .gpio = DA850_USER_LED0,
1 K8 f+ C: B" i: v+ C5 b                .name = "user_led0",* l3 L) N4 D# \" I
                .default_trigger = "default-on",3 E1 \, e( B+ P
        },
! I1 n9 A, W( w' V8 {3 n' \! D  B        {' d/ }9 i! n& X! w
                .active_low = 0,. K+ @9 F( N# Z2 ~7 {
                .gpio = DA850_USER_LED1,0 F. e" L2 _. E, ~, }
                .name = "user_led1",
+ ^5 @( ^: z5 M- a" `! S; w  F  C                .default_trigger = "default-on",
; U. [) u% A* ~5 u, q. I; e/ A        },7 z; ~! g* V1 r$ V
        {
1 N6 P- Y, b* Y) {- Z& l                .active_low = 0,( }5 i6 B9 @4 h; a7 Z6 Z8 N! J
                .gpio = DA850_USER_LED2,8 x& u' X+ B; V* H) G9 E
                .name = "user_led2",9 f# _% J3 S9 H6 O/ b6 V
                .default_trigger = "default-on",  N' O- \5 U- [, M" a
        },
* V8 l. Z& @( a9 ^  k4 Z        {" Q. t: S2 H" o7 ]) Y- \
                .active_low = 0,/ }  k2 m) W8 `2 L
                .gpio = DA850_USER_LED3,
) c7 J5 y. H+ [  ^                .name = "user_led3",8 B1 U, f' X: y' M5 m+ s2 x+ ?
                .default_trigger = "default-on",
( r2 L5 A2 X  J# ?1 V# V2 Y1 X: ~        },
. W7 W* N6 F% j/ |};7 ~; V/ R2 R6 p% P4 ^# W

$ H& a& _2 t! x5 `$ d! x1 {' kstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
7 Y8 d0 e8 k5 B( G        .leds = da850_evm_tl_leds,4 U6 I" H  L. v# x0 J, f" i
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
# z  A6 K. n3 F4 \2 n$ z0 q1 i};
5 p4 @- s8 @# o. {5 `3 m/ \" Z  c  X% j0 A4 z' l9 `) }* T# E
static void led_dev_release(struct device *dev)) L3 a" j( i  g1 {8 K8 l2 i% l0 |
{: q' O' K- I7 H5 |( i9 y' A/ R( m
};
3 ]4 }& R$ v% [. g- C- j3 b, E/ D" P3 ^
static struct platform_device da850_evm_tl_leds_device = {
: ~+ H/ z! R1 D7 p5 J        .name                = "leds-gpio",8 [7 C; D" ^$ Y: ~
        .id                = 1,5 j/ ~- W7 r- W  Z6 _* D
        .dev = {
1 |/ k+ ]  o( n5 t2 m8 U2 p+ ^* [                .platform_data = &da850_evm_tl_leds_pdata,
8 e) l, V' k6 ^                .release = led_dev_release,; N  @. ?4 U" c6 z8 ?) H8 M
        }
% D0 ?9 h; S0 h( o1 `! Y' k6 i};
3 F5 i$ K# U( y0 ^/ _" \
. f. a5 ]* {' d3 q$ Zstatic int __init led_platform_init(void)
7 `5 I5 _; L/ P' u0 W6 U{
( m- C% O) k+ v9 f# R4 q, a2 r        int ret;% s0 v/ B. D1 N
#if 0) _, o% n/ R! n4 G
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
' G4 I" u9 ^* x        if (ret)
- w7 P; _, u" j% \                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
0 Z. ?7 S1 K5 m& ?" F  `                                "%d\n", ret);
/ q  v5 I3 u- Q5 ^4 @#endif
, S, X# B% h4 A9 H2 `        ret = platform_device_register(&da850_evm_tl_leds_device);% P; E+ V# Y: p3 C
        if (ret)
  W& W9 Z. z7 m; l5 ]4 _                pr_warning("Could not register som GPIO expander LEDS");$ z9 x% }' G0 Q( W
        else
# V9 @. F) d9 a" n                printk(KERN_INFO "LED register sucessful!\n");
# Q! k( ]+ i5 {% s: Y6 U1 M% [8 t8 a$ Q7 f2 j- f
        return ret;/ T$ M$ j. J* k0 `8 H& G, H7 D/ S
}
& k9 P; {  c8 X2 `/ k5 a: }9 @% {* G& }
static void __exit led_platform_exit(void)
3 }/ Q1 X5 g6 p{) [% g8 n5 D; \& Y: {2 q8 a# s) z
        platform_device_unregister(&da850_evm_tl_leds_device);
9 P$ ]; G& ?' i4 u8 r6 s
/ J+ M* X: }& u        printk(KERN_INFO "LED unregister!\n");
  I( P2 U) F1 S5 f( }2 V* R* z}$ e+ e9 u: e2 C1 y5 N9 E

; f. X. K8 u- Q3 L  k( _module_init(led_platform_init);8 b% C- {) C) _1 U* N9 c' o  `7 u
module_exit(led_platform_exit);
# e% w* E; H) ~( G
# r% |1 c7 w3 dMODULE_DESCRIPTION("Led platform driver");
+ A8 Y/ f5 `) U6 E0 N+ Y/ o( bMODULE_AUTHOR("Tronlong");# z8 W3 b3 j! P! P- U8 ~; ^3 ^. C
MODULE_LICENSE("GPL");. {( ?" m' z6 [3 [* i' _$ p; X- Q
, h1 r4 h+ E1 O$ O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 14:34 , Processed in 0.050466 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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