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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。. L( ~2 J1 t% F( N7 e' F, O
#include <linux/init.h>% p+ J5 ?8 ]# n# ~  i) p! U
#include <linux/module.h>$ H) W8 P: O' k, B# e7 m! J
#include <linux/kernel.h>% B& M, U. ^, E
#include <linux/types.h>. |. T  U, {% i! Q/ ~
#include <linux/gpio.h>
" R4 A$ j/ L" }; i#include <linux/leds.h>4 f/ a6 |' G" c2 c9 C
#include <linux/platform_device.h>  Q) }/ S. j2 w2 @
2 Y) m* q6 s4 [$ n! k+ I  c
#include <asm/mach-types.h>' E- X$ g1 I' o4 {
#include <asm/mach/arch.h>2 Z9 m; R3 ?: @) ^8 x
#include <mach/da8xx.h>
; s0 h) m5 U9 A#include <mach/mux.h>" J' [9 U) q+ U! G2 f

$ o' P# V! S4 B3 L#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
$ g3 O4 W6 {, M9 W- @0 F#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
. c# q6 T: J0 C3 ]3 f# o, |" W+ F#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
8 h4 `- _. R$ Y/ _4 V( h#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)5 W( B( X" i" u; C3 B0 t4 }3 P" D6 R

' u9 e+ l5 t1 }/* assign the tl som board LED-GPIOs*/
5 N" ~0 N; Z0 @6 Ostatic const short da850_evm_tl_user_led_pins[] = {0 n9 h5 T" \  C: {* t) U" f  y! z
        /* These pins are definition at <mach/mux.h> file */
' r2 |& }9 p5 x5 i. V+ g' R' {  |8 R        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
  q. v3 ]  b. ^6 v1 J$ \3 U$ ~        -1* S3 T: E% @1 L3 o' w: I% e
};
% f5 [8 A1 ~, Y" C9 o, g% j1 Z% I# a- h: X( C$ k& A
static struct gpio_led da850_evm_tl_leds[] = {
% ~5 j2 d8 P2 o. d5 A' e* G: z        {' e4 G9 z2 u; I4 q$ R
                .active_low = 0,
$ f; U) k( }( R: f! M3 L* n                .gpio = DA850_USER_LED0,5 R8 r: [" Q# W  S; t& U6 W  K
                .name = "user_led0",. l) `6 v" e. `- G/ {) `, i( m6 {
                .default_trigger = "default-on",$ W: S, F. ^& ^$ K; Q8 c3 j' F, S1 |
        },
" c' `$ I5 J9 J% j) a        {: ^. {2 K1 ]; I# Y
                .active_low = 0,2 c) v) ~! K4 v: d$ z; b% G9 N
                .gpio = DA850_USER_LED1,
3 ]# M+ J. W  h$ T                .name = "user_led1",
, t* \1 P+ j0 u9 Z3 C8 H8 R* d                .default_trigger = "default-on",
$ `/ L4 ?# h. j6 F  U0 Q" ^        },
1 C! n  o( j5 h4 h2 I        {
/ P" U. I5 p, [5 y" v8 {                .active_low = 0,
+ h# G. r# o8 E$ ?                .gpio = DA850_USER_LED2,
* n% s3 P% R6 ^; k                .name = "user_led2",
% J! l: e9 X4 f: a                .default_trigger = "default-on",  n! E4 \8 u/ y6 M% j/ M. w
        },( M" G1 }6 E8 @; f7 C# c# w
        {
" r) X% [* `& ^- j* a1 t                .active_low = 0,
) `2 }, S( u- r/ s                .gpio = DA850_USER_LED3,
9 Y# p4 p/ {) C* ?& B/ L; Q3 q                .name = "user_led3"," O) @% j8 I# Y' O% h" R
                .default_trigger = "default-on",
3 S# B9 |) t* e, y* p6 Q4 I        },+ o& P7 y% C, P+ r; ^3 D
};' I5 E5 i! N" @3 l9 J1 Z
2 g2 t. N9 o! l, @5 Q
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
1 q3 k* g: [0 G" F/ _+ W2 _        .leds = da850_evm_tl_leds,
# M* g# R. \: j6 r        .num_leds = ARRAY_SIZE(da850_evm_tl_leds)," k6 Z9 D+ n) u: X  z
};& e# y) Z, g8 p
/ g* E' C( m2 `& N8 Y; J' u$ w2 h: J
static void led_dev_release(struct device *dev)4 \% D4 {* _1 M' {& p7 Z& U* S
{: Q* G+ K0 C# @# F
};0 W, p0 T8 v1 f0 x) E% x
; y; ~& s- M3 Q$ J
static struct platform_device da850_evm_tl_leds_device = {
0 W- ]1 a/ }4 w) `' B3 _        .name                = "leds-gpio",7 z  i+ D/ X. [9 q
        .id                = 1,! q( j  ?, O, `- L4 C3 U
        .dev = {
0 U/ s5 m, ^+ N  P                .platform_data = &da850_evm_tl_leds_pdata,$ y) Z0 t% K0 X
                .release = led_dev_release,9 I' t6 d' V& n& F6 d
        }: @1 h; L8 r$ F
};* M7 A8 s/ a# B7 {0 P# ~
4 l& W: ?) d/ F7 N
static int __init led_platform_init(void)! X5 s/ E; L- r) k% N+ O: t/ ~
{
2 T+ Z& l. A0 E3 T# M" l6 B  T3 Y        int ret;: H% Q3 R0 y  y% j8 Y, `. a: P7 u
#if 0
2 |3 g2 p) a- l0 d        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);) t1 ?- _; U- E: S4 F
        if (ret)
8 o' f" `5 W$ y; g/ V0 r1 N$ v- C( p) T                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
" M3 r# p; O. j, M% S+ O' p                                "%d\n", ret);
/ i9 k9 \& e  w# {# I6 w#endif' H/ M* `6 A" G+ ?  E
        ret = platform_device_register(&da850_evm_tl_leds_device);& D( ^  r# n1 g$ F
        if (ret)
" v+ A8 l; J0 }, I+ v* N2 b) Y9 u                pr_warning("Could not register som GPIO expander LEDS");
* J8 ~1 k2 @9 x; \* u; t2 M        else
* @/ k% l- }/ \, D                printk(KERN_INFO "LED register sucessful!\n");2 c9 r) [: a: l3 ^* y

0 Y% g6 |! \7 t$ z9 Y        return ret;# ?  h! _/ p/ t0 H( \( O
}
" F  x7 p  S5 G' a) u0 @( `5 ?. c" u6 m- |( P2 E
static void __exit led_platform_exit(void)
8 O" j. h2 q9 g; y{- G2 y) \$ ?- D9 c) W3 t
        platform_device_unregister(&da850_evm_tl_leds_device);
0 m+ E7 S" B4 ~- U8 ^+ y
, o( n/ n) a0 I4 D/ H        printk(KERN_INFO "LED unregister!\n");2 V8 e3 V8 [2 S' i! G+ c. `* J
}  v9 ]  R8 m6 f( e- a& n& ]7 i
% ]3 u; ?6 j% E, h' d5 I- Y
module_init(led_platform_init);# C8 p5 {% l9 l+ Z2 |5 ]& o4 l
module_exit(led_platform_exit);
* G2 Y' ^6 k' z, u, o& g: u5 V$ g. `; F* x, i% i8 Q
MODULE_DESCRIPTION("Led platform driver");& `! ~8 ]( K: M( k8 @  b
MODULE_AUTHOR("Tronlong");" g' T$ E8 Y& B9 c1 T
MODULE_LICENSE("GPL");
, z( ~; N  r  }! N* ^
9 o+ h4 d# |, Z( E" O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 11:03 , Processed in 0.037346 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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