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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
7 |, X0 O, Q' P0 j#include <linux/init.h>
8 }- x7 V$ I5 T* }6 x/ _9 u#include <linux/module.h>6 S, T1 t+ Z; X7 I' K+ Z+ V
#include <linux/kernel.h>
/ c( p1 @% g- [9 ?#include <linux/types.h>
- _* c8 p. D! D9 [3 {1 Y, W7 T#include <linux/gpio.h>
3 G0 `# l, Z' _: ~8 a$ ~) T#include <linux/leds.h>
' U$ G3 X# G, j- q' {1 y+ L: u$ T#include <linux/platform_device.h>: {: X: a; y1 ~* v" l) M" E

6 }/ V! @7 b; h0 K8 ]#include <asm/mach-types.h>
  u4 }9 \. |" H* @5 t2 o& D, M#include <asm/mach/arch.h>8 z) }/ W/ p, r( P/ w: F
#include <mach/da8xx.h>
& s) a9 U1 g6 N1 P( ^# F#include <mach/mux.h>: [, r* g6 S: P
% B) v( G$ U8 ^% e
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)( S( t+ ^5 }$ K: `3 A6 Q
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
4 B$ Y$ H* |: }0 r#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
- n' r  V* O  c/ r! f; |4 e+ X/ {#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)5 h* L8 d2 W- [

" t. E7 q. _! ]1 y. J! h/* assign the tl som board LED-GPIOs*/( e6 t; b' a( w  _( i6 D
static const short da850_evm_tl_user_led_pins[] = {3 k) E% K" ^% J, W
        /* These pins are definition at <mach/mux.h> file */3 b' q4 x* e, v
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
' r6 @  J2 X( y- Q- `" t% C        -1
. F" C! H7 e. {% b4 w$ g};  W: o( o+ I# `8 C$ C

( v) [" ~3 S, Y5 _8 Ostatic struct gpio_led da850_evm_tl_leds[] = {1 k* F( W3 b9 D2 v8 N2 Z5 \+ L
        {6 Q, p7 {: E: \, M- h# X9 g6 \
                .active_low = 0,
- |8 d5 k- P+ X( k" T4 {                .gpio = DA850_USER_LED0,& |& n2 E4 g: h6 T+ Z' g# A
                .name = "user_led0",; N3 K: U, Q, `, d; r
                .default_trigger = "default-on",
' t8 L% ~0 r2 T6 @: y. k$ m        },. V+ V, [& V0 ]
        {
7 E. t, G( f, g5 c- z& H' w                .active_low = 0,( v! H; L1 e8 q7 d! G
                .gpio = DA850_USER_LED1,
4 ]/ P6 P' z) Y0 d+ r3 q( q0 m                .name = "user_led1"," [& G* ]- W5 a. Q
                .default_trigger = "default-on",
3 V9 u3 x9 I% r; \% y        },& T# {0 Q7 p" \8 @3 b
        {
, }: X8 M6 X* H  X# V, X9 g                .active_low = 0,
/ m* T/ u& B- M# L0 L! T                .gpio = DA850_USER_LED2,% J; k. O* V  R: }# A, K
                .name = "user_led2",
( X: m, r9 ^, U# e- L                .default_trigger = "default-on",: Z/ J9 N. }! y. \
        },
" [" Q6 D5 a, y4 V: K  U, @        {
( u. n9 s9 z! R, R8 ~% H                .active_low = 0,- R; j  c3 I5 Q! T: V
                .gpio = DA850_USER_LED3,2 K& l: |& V1 A: z9 J5 h5 z7 g% g
                .name = "user_led3",1 `& c: z. G' G7 P
                .default_trigger = "default-on",$ ]9 `8 i* b& Y9 L% a  w
        },% i# G/ V# P+ u: U' d% P, O, G
};: z3 C. U) x  P8 H2 V1 _$ T
0 m2 \$ W1 R6 f- E+ x
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {' G, z7 \3 b! W0 s, W
        .leds = da850_evm_tl_leds,
0 _' X, \0 `0 B8 k# o        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),1 @+ b, j, ]6 j- l+ Y
};
: B2 B7 _, n) s, @- N
) ]8 g9 J  E* v8 |# Z1 mstatic void led_dev_release(struct device *dev)
: H. h) o$ s  y* j{. Y$ w$ I, A( j3 A! E
};
9 E( {& n% N% }; [# f. B1 n1 j" K( O
0 Q* P" E) H3 c' Qstatic struct platform_device da850_evm_tl_leds_device = {
& a4 W+ Q2 @  o9 N, q  \; |( `        .name                = "leds-gpio",+ [' v1 s. T  k3 ]5 o
        .id                = 1,
& F' o4 M$ }. m        .dev = {" S) \8 q; _( ]9 T- W* Q8 i
                .platform_data = &da850_evm_tl_leds_pdata,
( w, O  r  J. N4 s; Z0 P2 v                .release = led_dev_release,
) \! p  y: h- r' h1 S' r        }
, p  C  f$ y' `: T; \) q& \8 X! j};+ Q" F6 k% ~$ C

7 z2 C0 |, x+ K6 a- Z, hstatic int __init led_platform_init(void)- q9 P+ Z1 r9 Q2 |
{# C7 X$ A' Y2 ^
        int ret;) I1 q+ U+ G! y* K$ w% }
#if 0
9 _4 C; N; B6 t, \: L        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
: [( ?# f. p, x" I6 X        if (ret)
: i1 F  I4 j5 N" T% v- I                pr_warning("da850_evm_tl_leds_init : User LED mux failed :") i2 K$ m$ z3 T* _
                                "%d\n", ret);
7 _8 }! _. [/ S$ I6 E#endif
5 v* l; g" u, ~! k* X5 E        ret = platform_device_register(&da850_evm_tl_leds_device);4 V2 s& [3 X1 k, \! u. u$ g3 \
        if (ret), {, S* P. g! F% r
                pr_warning("Could not register som GPIO expander LEDS");
- W$ E# A3 f. X( C" @        else
9 E- z! M. h" c  o5 f4 O* J                printk(KERN_INFO "LED register sucessful!\n");
5 ^3 C; t$ e8 V" S( V8 g* ?$ P8 A/ c
        return ret;
7 O4 o1 [. l3 H" o# Y9 {}6 ^( Z' z4 z( y. W

" f! y' z+ U: S6 m/ I  Ostatic void __exit led_platform_exit(void)# ~& T  m7 t* q" l- {+ Q' k7 X  ?
{
& P* [& p1 R" E1 _4 ?+ [        platform_device_unregister(&da850_evm_tl_leds_device);  U7 J) F/ g, j
% \+ l- v0 V3 ^+ A+ ^
        printk(KERN_INFO "LED unregister!\n");6 C  R( M2 m7 G8 q5 J# d
}
, `( i" G3 v6 d0 `2 r( w, E- r! K% `( W
module_init(led_platform_init);
( _, c% J& m( g! E( L: B' e% Xmodule_exit(led_platform_exit);
( Z, L3 A! K, O9 E( h' [7 [; |8 Z- t0 X
MODULE_DESCRIPTION("Led platform driver");
$ T5 b+ ^' \) D9 D6 w( T9 J! jMODULE_AUTHOR("Tronlong");9 {  u. r5 k' _& `; ]' v; q1 c: ?
MODULE_LICENSE("GPL");  h3 _. A% i4 a6 \0 w- Z$ j2 c

2 w/ W3 h  l6 T! M6 R3 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 14:37 , Processed in 0.038686 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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