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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
! Q0 t3 S% u- i4 d#include <linux/init.h>
2 ~+ l2 L* h) U- C# D" u+ I7 m#include <linux/module.h>
/ J( U" Z4 W4 N* i. m#include <linux/kernel.h>+ \% g5 g9 [# `! e. S
#include <linux/types.h>! M) n  w# S3 d
#include <linux/gpio.h>
: G- ~0 h9 V7 ?#include <linux/leds.h>
7 t3 T1 p+ f* |6 H( V#include <linux/platform_device.h>0 _1 P) X2 C8 B- e% u6 r  Y% P/ i

6 h6 ?* \  ^6 U& j$ l3 U5 F  Z#include <asm/mach-types.h>
' x; h/ M4 r! |3 \/ O#include <asm/mach/arch.h>
) j( A+ I- F& s, B- w% M#include <mach/da8xx.h>
- q$ j3 K7 ~! b0 q" h" b#include <mach/mux.h>  U; ~$ k# e7 R* J: t/ `

- G% M* O4 m/ f3 B4 K# K6 ^2 N#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
. j% f! o4 k1 r8 }! b! u' a#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
' \1 l- h6 M# l5 Y#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)* }9 k" ^$ _) k7 V; }
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)7 k. g6 Y6 t! y( R
" \7 }! K' |6 N2 }
/* assign the tl som board LED-GPIOs*/
" `* Q# k& Q; l& K* j- zstatic const short da850_evm_tl_user_led_pins[] = {6 a& A+ l/ _3 f* j3 G6 w
        /* These pins are definition at <mach/mux.h> file */
# k7 U2 H+ Y  b% ]        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
* r: P; l( j# }5 D- c+ e8 w        -1
7 `  s/ X/ T- U% P};
: H- b8 v9 V# k) e
) S. k) @$ A0 _! p! Pstatic struct gpio_led da850_evm_tl_leds[] = {. M+ M+ O7 f  q
        {
9 s6 h' }5 z: J                .active_low = 0,1 t+ o% o( T/ T- w0 W* K/ O
                .gpio = DA850_USER_LED0,
" o3 o. v9 O5 x& S) O                .name = "user_led0",6 V" ^& C3 b4 T/ M% L/ r/ m" q
                .default_trigger = "default-on",4 T! K/ {$ c5 B
        },
) h$ M1 K' f3 g. L; A+ l        {* `$ @0 U* P& ^1 S1 w) U8 |
                .active_low = 0,
$ {0 S1 q" ~" b7 ?) O( `- ~. o+ y' b                .gpio = DA850_USER_LED1,* u# r4 X# y; j+ i) T* L/ n- k7 d
                .name = "user_led1",
5 C3 w3 G  Q, @                .default_trigger = "default-on",
. d1 o9 U: p% c2 E+ A        },% X8 z2 p% ^3 Q
        {& }" N8 P& {5 w& ]+ G
                .active_low = 0,
' a: U' S, c4 H5 r$ l" s                .gpio = DA850_USER_LED2,% `3 {! e6 }& }& X0 r5 W
                .name = "user_led2",
/ M% A: d: P$ W" J( v                .default_trigger = "default-on",* ?5 e8 z4 U/ F4 T* \% o3 Q( x+ z
        },
- X# I& l, e$ \1 a. d8 K        {
" @- m( I, l( D0 r                .active_low = 0,0 I& {' _4 Z! n5 M! j: \9 \1 X
                .gpio = DA850_USER_LED3,! }; n4 g# g7 j+ z. r9 G
                .name = "user_led3",/ Y3 y: j2 P( ^1 L. E" F1 Z7 j
                .default_trigger = "default-on",+ J4 u7 I9 c0 ~5 a8 f
        },3 i* D! J7 S9 {) b5 c8 `
};
9 f* S% R+ C/ D3 f9 K
+ a2 Z/ i4 p8 {) e5 w3 Y$ i! ostatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
2 ]/ G1 Q5 |- R# a% Q" o        .leds = da850_evm_tl_leds,
& g) c, U1 Q5 }; O. s: S9 z- s        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
/ ?8 @' W$ R( X& M};% X* A/ h0 K( F' O$ N
2 c  J& G4 O. M# V) o8 d
static void led_dev_release(struct device *dev)
# l& u& q+ w4 O0 u  L{
8 y! j2 S/ B1 y9 s9 {2 Q};' B0 N$ t: F6 O

+ V/ }3 \) P( N6 Dstatic struct platform_device da850_evm_tl_leds_device = {. c8 y3 Y3 B. a2 S
        .name                = "leds-gpio",
5 U9 \$ a# ?+ X% n3 ~/ b7 Z' w        .id                = 1,& V( U6 A5 `" c
        .dev = {$ S' E2 Q& c6 A2 R  G" ?- M
                .platform_data = &da850_evm_tl_leds_pdata,) v) \1 H, t2 T; p; I
                .release = led_dev_release,
, X6 r' [' O9 ?5 x, o' P6 ?6 S3 n        }
& B0 ]' v" d6 g5 W6 {$ {* D};
+ N& r+ d0 [8 x2 Z6 [+ {' p: k1 {2 j2 n/ `  O, ?
static int __init led_platform_init(void)/ L5 ~6 G, L& L* t# C8 d
{% h! f5 g, @# o* S3 G: J0 ?" ?7 H
        int ret;% {# O/ s6 ]* |3 \
#if 02 g; k# b, g7 s
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
+ c2 \) F, u3 u/ [" _        if (ret)
  _, t; ~5 D5 o6 o2 x                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"5 L5 W: H! f* W8 T# U( o& b2 ?2 M
                                "%d\n", ret);
1 E# @' X( D' n7 q# ~#endif  `- ?$ P# m2 |; A1 ]
        ret = platform_device_register(&da850_evm_tl_leds_device);1 K5 t+ L+ }7 [% i: s/ O: z
        if (ret)
9 M/ e, |1 C: `. F. {                pr_warning("Could not register som GPIO expander LEDS");
$ ]4 F+ \% T1 B1 f4 z        else
& I& ~$ Y6 ^) O; d; ?5 F+ w( M                printk(KERN_INFO "LED register sucessful!\n");3 v  L+ B  Y4 y" P3 w8 p

) E( e! v1 v+ _! `! R, \- \        return ret;& T5 H% b7 O# l' K
}
% a3 ^7 D- x3 N3 L. r) L: b( H  ~- O6 U. K1 b, k& k* k
static void __exit led_platform_exit(void)' j1 o0 J& R* z1 f' n! P/ |* t
{$ Y0 u4 i' @4 `6 r
        platform_device_unregister(&da850_evm_tl_leds_device);6 d4 k0 r( p2 V+ o

( b/ `$ b$ Q+ M6 g6 {        printk(KERN_INFO "LED unregister!\n");; q9 z& s# l0 j$ |3 D8 h  X
}
0 M, M& S; K# B; j; Z6 R
5 Q( v& B; v& ]module_init(led_platform_init);
% F5 y  s5 z* S, S* H# s0 ^) f9 i% _module_exit(led_platform_exit);: v- _& b9 i" [# x! K# T+ A) v
0 N* ^1 ?9 K* m+ Z# j
MODULE_DESCRIPTION("Led platform driver");) }. b/ T5 U' H# U6 Z
MODULE_AUTHOR("Tronlong");
  [" |+ q1 z6 f: J! f* ]MODULE_LICENSE("GPL");  b: w+ T6 p& k6 b4 i
8 I. I2 [* f( V3 K) L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 06:25 , Processed in 0.039355 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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