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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
1 A; T1 s0 P( h#include <linux/init.h>2 p% B, ]* \) _, I
#include <linux/module.h>  V8 g1 B) K: X! `. H. n4 V
#include <linux/kernel.h>
/ @2 s7 s/ D, ?, r#include <linux/types.h>6 Y5 [1 G. H; u( G3 b
#include <linux/gpio.h>. c( D1 t- `8 U  t* N
#include <linux/leds.h>
: l& m0 [! X2 D4 O6 ~+ ^1 L' T#include <linux/platform_device.h>
- m+ h7 Y7 T/ k0 y" o  r' T7 y# c* J( [9 z
#include <asm/mach-types.h>5 P4 n6 ]! I( S! P; a
#include <asm/mach/arch.h>6 g- j/ q; \( B7 J$ a! l# v1 o
#include <mach/da8xx.h>
" U- h3 K7 F: |" {2 {& F#include <mach/mux.h>3 }+ R; u2 D% a0 R
* g$ p. p; b2 A6 K# U
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)4 e3 U1 `2 ], Z3 Y) |9 O- u
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
# `# g: J, h4 m2 @9 S+ D#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
9 w1 A4 ?. G( b6 {2 y2 m$ K! E4 Y2 ?#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
8 t' U* `" I: p, o( x' }% }3 N+ z+ }" x/ H$ s2 r3 M! v2 k
/* assign the tl som board LED-GPIOs*/* \7 P% V2 ]* {( X) _4 N3 f
static const short da850_evm_tl_user_led_pins[] = {* Y, N; h% o* k) g# ?7 N9 X' ~
        /* These pins are definition at <mach/mux.h> file */' K& N8 ]& G: V# T7 b6 \
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
* b% n7 a5 t, L6 v- W- a        -1! k3 V: ?0 t% d8 a
};7 I# r& [. c0 q3 R

* e) W0 P2 |9 L0 e0 e* k1 Tstatic struct gpio_led da850_evm_tl_leds[] = {
( X) l& H# g9 F. z6 [2 A$ V        {( j7 j9 X' H0 a9 S" ~
                .active_low = 0,
) Y# ?5 J) I5 L2 g                .gpio = DA850_USER_LED0,
" ^- m* s, a1 l- r' X8 o: V                .name = "user_led0",
9 I4 L( @' q3 [6 {! r( ]: S$ ~2 I                .default_trigger = "default-on",
3 M9 F( V# q) G- T        },
8 j5 i9 y( e" O- {- m        {8 w0 V8 s+ u2 w6 o6 ]
                .active_low = 0,1 G9 \' Q( w3 V& a7 z
                .gpio = DA850_USER_LED1,/ t2 i0 z4 `" b6 S, M
                .name = "user_led1",, G; x+ q2 Z+ A$ {7 ]- U: g
                .default_trigger = "default-on",) I+ v9 @. B& c7 E
        },
+ ^2 b/ [- T+ T" M, ]        {
( C8 o, R6 r) H# D                .active_low = 0,4 ^: V* }7 O2 _  P4 _* a. Q2 Z" D! n
                .gpio = DA850_USER_LED2,
' L. \# n% Y1 ]3 a8 i                .name = "user_led2",
+ `3 I  Z% X9 b5 _: P$ a                .default_trigger = "default-on",* i0 L: |& G, N7 d9 Z! c' T3 r
        },# U. ^4 h2 S; @
        {
' f( ~$ H% j' t- |0 }' W                .active_low = 0,( s4 E  J7 l* c- \
                .gpio = DA850_USER_LED3,- Z( b2 D8 n' |3 k' f9 b
                .name = "user_led3",
! F/ Q  T. e$ m% x* m: Z  G/ X4 K                .default_trigger = "default-on",
' s! n* }/ K- m3 I2 O, x        },
8 ]6 O0 g: K, r) J: T( r/ e* t};
& Q- q* |  l% h* }) p! Q: N: V
- I& D6 r# ?  V4 xstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {# W" R0 z7 W4 M- s9 G7 o# ?
        .leds = da850_evm_tl_leds,- K4 d; y3 D8 P
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
' `" a8 i$ i) u  ~$ G) @8 Q. a};# D1 v  \3 C) A3 N( Y4 t1 A5 \

# q0 K7 h) n# C5 Bstatic void led_dev_release(struct device *dev)$ r8 n. N; k; \% g3 f0 M
{7 b& H* T$ V' W
};. K  \% K" P4 h) G
3 `7 z) d/ t+ d2 u: W1 v
static struct platform_device da850_evm_tl_leds_device = {  ]3 i0 H( ^' V' X
        .name                = "leds-gpio",+ k/ Z* g6 Y7 d3 i
        .id                = 1,. d) \% P+ R- P' ~; w, S0 I
        .dev = {
# O" @* n# e$ X2 O6 C                .platform_data = &da850_evm_tl_leds_pdata," J: k' }6 {5 _6 X3 n0 w
                .release = led_dev_release,# l' W) [# T$ {( L, W1 c
        }) N) I( M( }' R/ k; N
};" E. a- Z/ |; g. Z

  n3 K" i8 x- z' Cstatic int __init led_platform_init(void)
! H* S! t" Y. m. @- B7 L2 Y{1 w( j) t1 X/ _; i  C; f; a
        int ret;
* G1 b' Q/ q$ s5 D+ _#if 0) Q* p1 F& u, W0 ~
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);4 b# ?5 ^! E, V) m. N. @4 G
        if (ret)$ h& ?# A, K$ f. P$ @
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
4 C7 c4 o/ i' C7 K8 ^/ {# u                                "%d\n", ret);; P& V% e8 w! l) s) m6 Z( x  t
#endif; L3 i. ^2 l# E3 N$ ]) S( o. U. S2 W
        ret = platform_device_register(&da850_evm_tl_leds_device);
: t: q; K- }4 T1 i2 M, H        if (ret)0 T9 W) q" d! H# ?$ L
                pr_warning("Could not register som GPIO expander LEDS");0 [* }" t. f- W/ M3 I# W
        else" H' B( e4 Z1 v+ U$ {/ w/ ~
                printk(KERN_INFO "LED register sucessful!\n");) {) Q4 M" Q7 V* Q4 ^, c

# P7 t. T2 _' O* t# L        return ret;
1 }: n  Q, w) F7 z& P/ V7 }5 n}
: j; a/ C, \# ?& {- K8 ]  |# s% c* u  H6 r! V
static void __exit led_platform_exit(void); h4 L  c2 k' \3 W" |% h( e
{
% i3 K4 G6 C# y7 @1 w. D0 O        platform_device_unregister(&da850_evm_tl_leds_device);
8 x$ g; m% }9 f3 J
& e/ H1 ~+ M# |( S7 f        printk(KERN_INFO "LED unregister!\n");0 |- n; @3 P% A3 t1 i" {7 j
}- A, a4 Q' S. D  f, U% O  M

. Q7 q2 i$ y. x# a: B6 m9 ]module_init(led_platform_init);
0 J/ k! S* |$ N* e- b2 dmodule_exit(led_platform_exit);/ c! ]% `7 n# s1 d: U3 V
' R6 n; U* ?, Q& L  ?9 h
MODULE_DESCRIPTION("Led platform driver");
8 q7 R- x6 M5 E. O! a1 R8 U, f, rMODULE_AUTHOR("Tronlong");
. U; t3 \$ l0 z1 S- @MODULE_LICENSE("GPL");
4 {$ S2 Z5 {, k% \' e
+ R2 k/ H2 M* O7 f4 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 04:54 , Processed in 0.042151 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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