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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
: M# h* u. L3 B, ?+ L+ k5 |2 \#include <linux/init.h>6 N. l( L3 i0 F1 H) U1 O4 G" c
#include <linux/module.h>/ I# z& G& z5 j; A
#include <linux/kernel.h># W% R+ q, ]6 }0 |7 e) A& s
#include <linux/types.h>& o2 A# w' v$ X. h
#include <linux/gpio.h>: D, n" }2 @4 d+ c- e
#include <linux/leds.h>( n0 }: |6 ?( \4 D
#include <linux/platform_device.h>
2 ^. D7 v9 [: W% F
$ ~5 S, t% ?% l+ z& M#include <asm/mach-types.h>7 G% e" f4 W% g% j2 E# }
#include <asm/mach/arch.h>; Z! _. K( ?& K4 e! w. E
#include <mach/da8xx.h>4 o2 Z# |8 r, V' P( _3 l
#include <mach/mux.h>1 t- o8 M( w4 q. r
: @8 r" g. i6 m2 W6 k9 `8 h7 T+ V+ T9 X
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
$ S6 i6 |" p. D2 @' v#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
  i. x8 q* j- q1 C! F* Q/ r#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)0 r7 C! S% G: m( W6 z: B
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
9 _& P. Z, s- J; e1 X* s4 ~6 y) {' V1 o! g) J$ l# D/ S- p4 ?
/* assign the tl som board LED-GPIOs*/
' T1 y4 O' `- D6 Qstatic const short da850_evm_tl_user_led_pins[] = {
# i4 V; I5 s/ B( A5 c        /* These pins are definition at <mach/mux.h> file */
5 }5 o& c" L- }; o( q$ A0 M        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,0 n' @: @1 i* f$ T
        -1
: B: }6 y# G3 V. d};
7 u! I# ^. Q$ ^5 Y- y) K
. L" L% E/ S! n2 ^* sstatic struct gpio_led da850_evm_tl_leds[] = {, o: v9 k, T! e3 T: p  O
        {3 \2 E' y1 X' S
                .active_low = 0,
3 |5 l: U6 t/ `) Q                .gpio = DA850_USER_LED0,
% {- K3 P4 V% n; _6 r/ a- w# W                .name = "user_led0",
; C# X$ E8 w% U% N5 Y                .default_trigger = "default-on",- I; @: R) K/ a: g. [( ]
        },
/ R# \8 H0 o  o. i- U        {
: F- j7 |* Z$ s# \; w                .active_low = 0,- }1 e# f+ }$ T6 X9 s, n- N
                .gpio = DA850_USER_LED1,
) Y9 |. E. j# Y: C2 {                .name = "user_led1",) z3 K: O% `: u  b2 Q# D5 B" ~
                .default_trigger = "default-on",
+ ]9 z- B: c/ O8 w. U2 u5 P        },
$ ~6 B& x7 {! g        {% V& Y+ k- V+ _0 T9 g# I: G
                .active_low = 0,. [/ o8 v, Z% \, o5 Z. K& k
                .gpio = DA850_USER_LED2,
" c, j3 o, X- t9 b8 q# {( K1 x" O                .name = "user_led2",. p6 B: s3 ?, s
                .default_trigger = "default-on",
+ P) U- I: i. k        },
/ V- h* P4 T1 a        {
8 d) X5 P9 h7 ~4 o6 }- x. P& g" U                .active_low = 0,
4 ^5 X: {% J- J2 q1 ]: j7 D3 L1 v9 x" _# j                .gpio = DA850_USER_LED3,8 l( y4 W' I' p! W# O
                .name = "user_led3",
$ f3 ~3 G+ a$ v6 A                .default_trigger = "default-on",
* `3 `' W0 q* B1 ]3 x2 Q5 B        },0 O  \; V2 p1 [+ g# w6 a1 N7 u; {( a
};
2 C! Q3 }  ^6 _& T! m+ s4 G" w3 {( l$ R; _- Y1 d" ]0 x8 h" p
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
  Q8 f# B" _/ D        .leds = da850_evm_tl_leds,
+ u4 R3 M$ O% U( E        .num_leds = ARRAY_SIZE(da850_evm_tl_leds)," P. f3 D1 R$ k# F& o
};
7 u8 n% `: [1 k1 `
3 T+ ]9 U; ~* r/ k/ Xstatic void led_dev_release(struct device *dev)7 X& F7 Y$ g3 H8 G
{6 b( \0 e: r! U  M6 h9 {6 f
};
' T$ @3 c6 B1 ?1 H2 o/ F
  W  e" I  h3 ~9 m. N# ystatic struct platform_device da850_evm_tl_leds_device = {
0 S9 A+ X# q6 l* u        .name                = "leds-gpio",6 V9 D6 U: Y# Q, q' |: r  k0 s6 D( I' s+ z
        .id                = 1,
2 j% N; ]' `1 E# G3 d/ h        .dev = {
! P" p& Y7 ^& l9 ^! \9 b3 M) H1 b/ J                .platform_data = &da850_evm_tl_leds_pdata,
( H3 \0 \0 ~( p7 o) P; O                .release = led_dev_release,! A, ?7 g; F# b* A; w# V3 V( \1 z  j
        }( d1 f4 L# r1 r7 j$ A3 t* ?/ t/ ~
};
. m; E3 K3 P9 l$ z2 r$ Z" p
& Z: h. f. g7 w" W! |3 mstatic int __init led_platform_init(void)
, {9 W2 [, z+ U0 h1 H{4 E/ B+ p3 O7 R* ?7 {
        int ret;* B% }$ y2 S: D, Y' y! C+ {
#if 04 H; r* G) C: V$ r( Q8 F
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);8 `8 |9 G) m$ e  M" q& |- Q
        if (ret)' C. g8 i1 ]) R
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"" s4 D) R; z5 e3 v& ]8 d
                                "%d\n", ret);
& m; h' Y- h3 m3 k% h2 r#endif6 r) Q( }% l5 F. g" A
        ret = platform_device_register(&da850_evm_tl_leds_device);% q8 K# D2 V& \, J( L: c$ m4 ]
        if (ret)2 L! J* w1 R2 _- g0 N" k3 m
                pr_warning("Could not register som GPIO expander LEDS");. o; G# |- r, z% ^
        else
0 b& M5 p& L6 A' T8 k- z- @. K) p                printk(KERN_INFO "LED register sucessful!\n");
6 ^3 u6 j6 p" a2 u7 g2 }; X8 e0 S3 z0 c6 O) X
        return ret;" m3 u  G% k. j$ Z1 |& B& k9 @* w, F" k
}$ [# K/ k! o+ o' l) m

: r' G7 V# C7 Q3 E) vstatic void __exit led_platform_exit(void)# ^; j, P1 e( Z# Q, p
{
/ S7 Z1 |1 {# o- @5 H1 X        platform_device_unregister(&da850_evm_tl_leds_device);
8 Q. X. K: f  R# M/ K
& a1 ?7 |: E9 p7 k8 @; g        printk(KERN_INFO "LED unregister!\n");
+ r4 C- O# l0 e, b}
8 [6 }( f# I# O7 Q: C* z0 E1 U8 n0 U8 R
module_init(led_platform_init);9 [6 f# m7 p& s
module_exit(led_platform_exit);
: g7 p7 K  o6 Y! F( `" z
5 X" P  A8 Y  `: ~5 r+ S8 YMODULE_DESCRIPTION("Led platform driver");
# @; i) S0 u) [6 A: l/ d8 |7 F, UMODULE_AUTHOR("Tronlong");* r& ?7 d# y. `1 Z- i( q
MODULE_LICENSE("GPL");6 r6 w2 o+ F( {; J; P% b$ d. \
! w; {4 C& g1 w3 Q4 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 04:37 , Processed in 0.038966 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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