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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
. Y9 w8 _+ p1 c% r( q#include <linux/init.h>
8 l+ ~; j$ k6 S$ i  |8 f: ~#include <linux/module.h>/ A; s" O% c  Y4 Z6 M5 |( Y1 W
#include <linux/kernel.h>
) b1 X8 h; C0 J* e2 P$ R1 A#include <linux/types.h>
  j, [1 h& V1 p$ P& s0 |+ G) G#include <linux/gpio.h>0 r5 o0 a# B/ W0 V% W2 z
#include <linux/leds.h>6 ~, p% {6 R+ `; B3 P
#include <linux/platform_device.h>0 ?; f$ f' q  i0 v
5 B# E5 {9 J1 \7 n# \* e
#include <asm/mach-types.h>' B  d( B- j# [8 x- G# p
#include <asm/mach/arch.h>
: T. ?/ Y3 |( j$ b#include <mach/da8xx.h>3 ~( M  U& {: D
#include <mach/mux.h>
2 S2 s8 K9 n. [% y( v! x8 {1 a* f1 Q& C1 ~$ @$ b6 U: o, P
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)9 A) g- a, G' N1 \
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
( r/ c. B0 O; n: H0 W1 I#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
- c+ K. _' b! e+ z* ~: s, t#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)5 U! E5 }/ m2 ]# K3 F/ f/ i' W

- w1 ], g# q* a$ u/* assign the tl som board LED-GPIOs*/* p# G: T: \  X. ]2 [9 [
static const short da850_evm_tl_user_led_pins[] = {# ]7 h9 r& u+ K" ?9 r1 @' d- V
        /* These pins are definition at <mach/mux.h> file */
7 ]% |% w0 [5 s( p        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
: w) E' Z7 ~9 D! V, c  b4 T, c* Q        -1" w( D& F; R. c" w
};
2 a& U8 m) r) W( F- {0 J# q# s, {) Q8 ~: Z  d
static struct gpio_led da850_evm_tl_leds[] = {$ Z+ j( ^/ {1 t' R: o  x
        {- h$ c- \- _" W0 M
                .active_low = 0,
4 I% g% }' |$ t$ t                .gpio = DA850_USER_LED0,
+ A. G$ |4 |  H                .name = "user_led0",
2 B: T! z! x1 N# L- E3 R                .default_trigger = "default-on",5 A7 Y1 l! ]3 F+ n# q% _
        },
  n; a1 _3 G3 Y1 f' }        {
/ M$ Q  d* ]  S' V7 C                .active_low = 0,3 u# y1 y+ j( t# B( U
                .gpio = DA850_USER_LED1,; n) V8 A: d1 ?3 M/ n
                .name = "user_led1",) D% z7 v1 S7 ~' ]' @+ f
                .default_trigger = "default-on",$ j0 q: A; y1 a/ D/ H' r
        },
; I2 N- A& _' r9 f+ o        {
3 H( ~+ ]+ @/ ?1 Y+ r7 i                .active_low = 0,0 o+ t" g* O$ \8 M0 B
                .gpio = DA850_USER_LED2,) E! j! g3 H8 u7 j  T
                .name = "user_led2",& f  s+ P  [( x
                .default_trigger = "default-on",8 x. v# W) _& H5 O
        },% Q' }7 O2 t6 w+ c, V! s# o) R$ P
        {  y9 y7 w3 q# ?% B
                .active_low = 0,9 S( n3 C6 S4 l& o
                .gpio = DA850_USER_LED3,
( L+ i1 ?/ N$ U+ P0 u. r                .name = "user_led3",
* b. i  |- ]! P2 o- w                .default_trigger = "default-on",
# z" m( D) `( v+ X* ~1 r$ w        },
: K2 J$ L/ u* R/ ?$ W};
$ O" n+ W. |3 R. J9 V# y: ^7 U7 R9 i% Z' N& X) @4 x
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
( h" _: h/ x+ l8 |' K& {5 o: M9 L        .leds = da850_evm_tl_leds,
7 \5 ?  [8 A- M2 j0 [  }        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),: F4 H" Y" N' h2 B# s0 w7 a- f) r
};
# p; Z: r) _$ ~5 A) j; V! c1 p" M
' w1 ^4 X- V7 A5 S: n, _static void led_dev_release(struct device *dev)
: N" C- p1 }0 Y. `- [; B0 u! z% J% O{
$ K, Y6 ~4 B  O& p0 J% ^};
* F( n" q1 I& k3 p7 @0 Y: k/ U
. N2 }+ [  [: [3 s0 wstatic struct platform_device da850_evm_tl_leds_device = {9 ]* Z  L% i' z0 X, w5 o  s
        .name                = "leds-gpio",) t; X( E# {% V* t  M6 D
        .id                = 1,/ D3 W1 ?  H; ?' N) v
        .dev = {+ X" R- ?  g7 E) y# \
                .platform_data = &da850_evm_tl_leds_pdata,
: S7 ~" ?7 {  A7 E  W2 P2 n3 X                .release = led_dev_release,% T# `! W+ G( N+ A+ q, e
        }) s8 D! M, C. v  s
};
1 z( q. Y8 h. W' B4 ~7 B1 l0 @$ G6 W' ]
static int __init led_platform_init(void)
) W( v! O$ y6 W9 f2 z" d  Z2 ^{' ^! I( r; \! o& G
        int ret;6 H3 \+ l  Z+ h3 S) w3 m1 P
#if 0, A9 l( }7 r' Y$ ^1 c
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);4 \9 [2 s# F/ N
        if (ret)
4 ?$ `( a# ^4 B                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
/ v5 M: s: V# L7 g* `8 }) ]                                "%d\n", ret);
) \, ]7 F& L- l; H1 x#endif5 q- p$ t9 H' z8 J6 \) x2 J1 E
        ret = platform_device_register(&da850_evm_tl_leds_device);
4 b- ]+ ]+ T9 h6 V* j1 [        if (ret)
$ l6 ~- N+ c! w8 L) B- n+ _0 }                pr_warning("Could not register som GPIO expander LEDS");3 W, f# L& ~  H+ n9 [! U/ \
        else
2 G. f/ P! ?/ u- k* Y                printk(KERN_INFO "LED register sucessful!\n");- A( K1 a) c  z  d+ i. ^2 d

1 Q7 q1 ~, D) ]6 D4 y/ J        return ret;$ r  B9 H6 s( n
}. z; K; \7 t' {# n3 L

  e+ U8 p; [+ A! I) mstatic void __exit led_platform_exit(void)
& `$ G1 d$ G6 u4 d' h{, h$ k& \' f8 X2 |
        platform_device_unregister(&da850_evm_tl_leds_device);# W) G+ D$ W2 m

* N! \- P. q1 o: f1 z9 i        printk(KERN_INFO "LED unregister!\n");: @# U) v: ~. E# V9 I
}
( }4 J( \0 _$ l1 {1 u) F# g$ h$ b! V. l
module_init(led_platform_init);
' g4 _( Q+ B7 b7 W2 O0 Dmodule_exit(led_platform_exit);% j4 @0 Y% i' j

& d8 c4 C6 K5 DMODULE_DESCRIPTION("Led platform driver");0 c% J7 p( V! s) A: u
MODULE_AUTHOR("Tronlong");
* `# [0 T4 |: @& ?! W) W8 Y5 hMODULE_LICENSE("GPL");) i/ S" B# T" Q- C( v* P

+ b0 o$ _4 a" ?3 w8 P. q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-6 21:19 , Processed in 0.040622 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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