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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。8 w$ |# O5 u& s  c. i$ @$ M
#include <linux/init.h>
. H$ k/ I& U, w  l#include <linux/module.h>2 k* R' v$ _8 I
#include <linux/kernel.h>
  Q! `* J7 \/ a#include <linux/types.h>
. z# e1 k) S% Z$ A. Z#include <linux/gpio.h>4 U' V& G# _& Y% v0 R
#include <linux/leds.h>
  F, k3 ~( E! M#include <linux/platform_device.h>; q  j5 @% K2 g$ t! d' w
- l! |) _4 V8 z( W: ?& }
#include <asm/mach-types.h>
2 {+ i- z5 s. p' a4 I% \) V- ?4 }; q. x#include <asm/mach/arch.h>) D" t$ W" D; M3 Q: @" T& I
#include <mach/da8xx.h>) O+ w1 Y1 D9 \! n( e1 ]
#include <mach/mux.h>
( X8 G( h- I% G7 e6 d  n/ g5 O# w) E# P5 D: U" n# y7 U
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
, I' m4 V& G. t# U#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
% x0 \( ^/ e7 C$ J#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
0 |$ r/ c' L7 R#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
0 W. u( ?: d2 Q8 s2 [: J: Q* ?  E+ n" P
/* assign the tl som board LED-GPIOs*/
9 g! c( K# l1 x" Sstatic const short da850_evm_tl_user_led_pins[] = {$ m4 ]2 }" s8 ^/ ?
        /* These pins are definition at <mach/mux.h> file */, {  g: {, L6 o; [$ Y
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,( n6 x# P0 |1 D' O$ e4 u
        -1) l/ I- S6 b( n: M# ~" v" r# Z% @; e
};5 a$ W! k& n! r5 m4 d3 |2 V2 }9 Y% `

* ^9 n6 Y  x4 Estatic struct gpio_led da850_evm_tl_leds[] = {) b( f4 k- w3 y) Q$ X
        {( _, p  w, }4 k, D- w9 d
                .active_low = 0,# N3 i" V' o/ E. S! [
                .gpio = DA850_USER_LED0,% ~+ S3 T* r! B, ^
                .name = "user_led0",
8 c0 T7 C$ p. e4 h                .default_trigger = "default-on",
" v) M. l5 h( j, `: V        },, c! |/ I- c3 z8 [& F  `5 n7 s
        {  O( Z; C% T" A8 r7 X  n1 R
                .active_low = 0,
7 \* S" M& ]) I; s5 J8 X2 ?                .gpio = DA850_USER_LED1,
3 Y/ R0 R# A7 O9 m                .name = "user_led1",
' a1 N$ E" e% L" I/ ]                .default_trigger = "default-on"," L" Z3 I8 R6 c/ i. K/ n7 c
        },
  E: O& e: S4 b1 R& p8 ~3 h: H        {/ `) f7 }( c9 `+ B% t
                .active_low = 0,8 E2 Z3 M( N% W/ r
                .gpio = DA850_USER_LED2,4 o/ W* B  @% ?. T+ N; M
                .name = "user_led2",: ?( a8 y7 d: `8 U8 c1 B1 F1 \
                .default_trigger = "default-on",% q; ~/ P/ d8 r/ v& Q
        },
8 g: }. H4 M! c9 R7 K5 Q, P$ p        {5 R7 s$ I8 j+ m$ g2 h' j# ?8 G
                .active_low = 0,
* n) T1 \* d8 f) l- V                .gpio = DA850_USER_LED3,
: w/ M4 i1 f" {; B                .name = "user_led3",
' e4 J' H7 Q0 l9 |0 C                .default_trigger = "default-on",+ ~0 p; j4 `7 k: w5 O% u0 G- @) A
        },5 w9 h9 y/ a5 [+ V5 W
};
0 z5 q& ]4 w; Y' J5 u' a& z5 r2 Z8 O; ]* s( q( ^2 U  `
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
! h& b+ p( G5 y        .leds = da850_evm_tl_leds,
* s, {8 c1 N; ^& |5 T1 T; }        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
1 K2 w; {( z8 P9 c};. A& ~% F9 |% |

: W6 r8 F0 L* y2 e+ t: I$ C# qstatic void led_dev_release(struct device *dev)
6 K- l8 t& m" R{& V7 d# \# C' E, ]# }  H" n
};3 K9 f/ a$ J1 O+ Z% g9 ^; _
; A+ S2 B. v$ j) r" x: _( y' P, Q
static struct platform_device da850_evm_tl_leds_device = {
( i/ U! x* V0 R' h( T* A4 m# c$ P        .name                = "leds-gpio",1 d, T  D+ s4 ^
        .id                = 1,
7 R7 \* Z- t+ N2 x$ q# L. i: `        .dev = {: }) V' c1 O( ~7 Y+ e: v5 b2 |: z
                .platform_data = &da850_evm_tl_leds_pdata,
- F8 F. g' I8 L0 X# Y1 ~                .release = led_dev_release,, }& ]- t3 m' m( p# F5 E* w
        }. k# E, |3 C+ S# O* S
};2 M: h) p% ]6 d3 h9 h
) N/ B9 d3 |) u/ L
static int __init led_platform_init(void)
2 s7 c6 m, @2 m{' U! K' z. N' V: ~
        int ret;& k9 N7 n$ N2 u& a9 P
#if 00 j* J# c6 R8 N; a' e
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
9 x! x3 J$ E/ a3 m% R8 ]5 E8 u" y        if (ret)
7 k8 b; z5 E$ U& a: p4 ~                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
6 K6 |+ H+ ~2 O+ p" b                                "%d\n", ret);
' U& N0 q: r1 d4 y& x#endif
- _: |, U1 u3 P& T9 u        ret = platform_device_register(&da850_evm_tl_leds_device);
- r' M5 H! n% F( s% B        if (ret), Q  S% ?5 N* {
                pr_warning("Could not register som GPIO expander LEDS");
  D. Y- Z4 m8 T" O0 \0 W+ t$ _        else5 \) f: c( b& z. x+ j- b2 N, t
                printk(KERN_INFO "LED register sucessful!\n");) ?4 c+ K; f& d3 V
/ J. C2 a; Q+ m3 G$ {- |2 j) M
        return ret;! f, r0 y0 ?# B$ K7 j9 \; f
}
6 o& t( y  s+ ^1 i4 L' R5 J2 D+ o. k! p
static void __exit led_platform_exit(void)
0 R$ P- x" f" q& v7 E8 G1 x{8 Z# T6 |* m5 v1 f) h0 l1 H
        platform_device_unregister(&da850_evm_tl_leds_device);
3 m' M6 c& s' [) Q. {4 X6 a
- Y" N" g, D' M# i- |& A        printk(KERN_INFO "LED unregister!\n");2 g' T  U: W" f6 r3 H3 S7 y0 e
}' T# Q: @8 _, o& T3 D* z& ^  h  u
- d0 C5 P5 m6 Y% k8 W5 |1 f
module_init(led_platform_init);( X2 f5 b; O. \6 N  X
module_exit(led_platform_exit);
, W& G2 r, a5 J8 r* N* J; i6 N9 e* B' g. A4 i8 z4 {# p
MODULE_DESCRIPTION("Led platform driver");
2 \, \' I) x, A% p! `! h3 IMODULE_AUTHOR("Tronlong");
8 H* ]  ]4 D5 E) I9 O& z. O# KMODULE_LICENSE("GPL");" ~% Q+ |! D& ]

1 d( G% V0 w9 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 22:43 , Processed in 0.044502 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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