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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
2 R3 p: g' X! h; n#include <linux/init.h>" p2 N0 u! n& \; F* R
#include <linux/module.h>% x* _- y$ x( v
#include <linux/kernel.h>4 k/ o! \. q5 t
#include <linux/types.h>' M" I' T) A2 K9 M8 B
#include <linux/gpio.h>' W% g" M( e! k0 e( Q7 u
#include <linux/leds.h>. r& x- @6 L9 h7 M* Q5 Q, x
#include <linux/platform_device.h>
6 E. `) v/ w( C8 P
, t8 U. U$ |3 M$ t, Y9 H: O#include <asm/mach-types.h>* n/ M& v- p; J& k' [' |; S
#include <asm/mach/arch.h>
. \, ~! [. v, q+ N2 v* s#include <mach/da8xx.h>. m  d  s) a; Z( B; q8 D: W! a3 D; a
#include <mach/mux.h>
8 R5 b! I: n0 h, }) _1 [. L( E: h- D' G5 T6 a% k. v4 B: l3 ^
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)$ a% U0 I% Z) I' l( E1 X5 Y  x
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)( |2 j0 ]/ l* f
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)0 ]. W1 G4 N) ]4 ~, t% h2 W
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
! o0 u0 `9 I% X5 P. o* a& t: w$ R5 |" i4 _4 U% j% O9 O! ^
/* assign the tl som board LED-GPIOs*/
8 s! k: c% n& hstatic const short da850_evm_tl_user_led_pins[] = {
( U4 m) G' w% D5 `  ]        /* These pins are definition at <mach/mux.h> file */0 c) c6 r) d4 A- J
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,. M0 u! N5 z# K) d
        -1" l" X' ~$ I7 M1 j
};
9 G8 M7 i3 v5 s$ k5 N6 b8 O3 A  J/ k+ |  r; w% L0 l5 M
static struct gpio_led da850_evm_tl_leds[] = {
1 n- f/ T: Q% i" F. e- b. h* z        {
4 M" G# E& c1 R                .active_low = 0,- k6 z) N  s- P; f: h% w$ j
                .gpio = DA850_USER_LED0,
2 H; _2 Q9 {/ o8 ]- v! k                .name = "user_led0",
) `% C5 \# {" x* l$ W( f7 r                .default_trigger = "default-on",
2 I+ o' c4 V7 [6 N& G$ A0 _) ~- M        },
- A* H, ~4 V' ^5 f6 k        {; O5 h# ~8 q0 {' `) J/ a( \5 U
                .active_low = 0,
; s* \/ u: L2 q$ F) E                .gpio = DA850_USER_LED1,/ t! a( N# {1 ^- E7 V
                .name = "user_led1",
& r* g/ V# U+ x# K! S1 K8 b                .default_trigger = "default-on",
6 k9 M; W4 o/ Z1 x3 K$ y        },
/ Q0 N% B1 p2 v        {
0 d" \! l$ {$ M1 D                .active_low = 0,8 ]$ V" J0 }2 F
                .gpio = DA850_USER_LED2,; _& w* T0 p3 X" i0 q; h, Q
                .name = "user_led2",' L, F8 P; y! b) m; K4 X
                .default_trigger = "default-on",$ y# ^6 s! @" u
        },8 I0 M$ t9 `8 D' |8 I; K
        {7 F3 a) b! w6 [, K3 T3 w2 ~
                .active_low = 0,9 J% D4 ]( ?' I, T/ T5 a
                .gpio = DA850_USER_LED3,
! z; ?1 u- Q7 s& x- K: [- B                .name = "user_led3",
; K' B  n* T9 ~! b0 {, F& Y                .default_trigger = "default-on",3 o; }% s) U5 Z% A: ~
        },; ]2 d+ p; I1 f2 _( P
};# ]- d/ K5 i3 z- b- U; o
$ I, }+ z7 U' _  V! q+ t$ x" x
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {' f  F$ y; h" }; M
        .leds = da850_evm_tl_leds,
) `) D9 t4 C1 A; M' q7 K3 p1 Y1 {7 v- N        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
7 C2 ^6 D+ h  z  p};! w5 y2 O; M9 k* n: p% ]+ X$ F

- J: h: Y3 Y0 L5 q' `- B- r( F( rstatic void led_dev_release(struct device *dev)% B5 j: z# n  r9 ]% w7 n
{& ^. z, g5 j& X+ C" a# \& _2 L% s
};5 y4 R+ X$ f4 Y0 N" D# W6 r+ R
/ s  ^. d0 ?; g. d" J5 B2 c
static struct platform_device da850_evm_tl_leds_device = {2 B2 C) X( V- _7 C5 O3 B& I
        .name                = "leds-gpio",1 ?3 N0 l, E6 R3 P3 w
        .id                = 1,1 x7 O! U) g1 K5 _5 M4 ]$ U
        .dev = {; A3 T5 {6 u: c) H7 F. v0 V1 n- ?& o& ?
                .platform_data = &da850_evm_tl_leds_pdata,0 f" Y) j6 D. \( t( `7 ~
                .release = led_dev_release,
+ _( l+ }5 i) V0 ~- W        }  Q0 T; M: f1 K2 ?  r" h2 \
};
: z/ {4 g6 x: |, j
, V! S6 f8 f9 f0 z& z/ J( h8 Mstatic int __init led_platform_init(void)
+ I  h3 g5 _+ L% _1 b{5 {4 u. V# ?' |
        int ret;5 U' W% \3 [! Y" D% a
#if 0
& y  F% y) l4 f7 s$ ^; o& B        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);/ u* W% f& e( ~1 {% p: _$ N
        if (ret)' F2 f* [. D2 v  E  Y  O
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"* B3 n( D" E3 K  t8 v
                                "%d\n", ret);" Z( y" U7 O! T; f" Z" v
#endif+ c% {% r5 E1 S
        ret = platform_device_register(&da850_evm_tl_leds_device);
% }" l/ u* k  m2 d+ B        if (ret)6 w! K; O* x! X' ~8 v( D
                pr_warning("Could not register som GPIO expander LEDS");
% G3 F( J/ c0 p4 w3 X9 x        else. A+ o5 Z. T6 C* C6 X  w
                printk(KERN_INFO "LED register sucessful!\n");. s1 `6 R. n' I2 J; F  P

2 Q$ |9 m( Q3 I! u        return ret;
$ P/ p. d; B4 E  i! n}
0 @- w/ j) r' ?8 T9 r
  _& F6 f" a: b# i4 \, F% B9 Pstatic void __exit led_platform_exit(void)3 W4 U& M- G- B3 u
{8 q5 c; k$ }- l1 X! O. |% A
        platform_device_unregister(&da850_evm_tl_leds_device);
& ~, r7 u; i9 }5 [/ c) l0 `7 n& [- V) Q
        printk(KERN_INFO "LED unregister!\n");" E3 Y. @: T7 L! B+ |0 x
}4 B% n7 \( o1 h

+ O* x. f9 T" q' t# }0 e) {module_init(led_platform_init);
2 G6 U! K6 Q+ E$ Imodule_exit(led_platform_exit);9 v# f9 e3 r) s; c' Y7 o
4 C, c# [7 q. t( J* f
MODULE_DESCRIPTION("Led platform driver");
; Q, u: W2 r; s2 d9 vMODULE_AUTHOR("Tronlong");
) O/ Z3 ]3 x. D6 Y) bMODULE_LICENSE("GPL");
0 e: H+ b- R- d0 y" h) l
) [) h* ]; u8 ^( n0 I, L8 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-16 11:07 , Processed in 0.039765 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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