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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
( v8 U6 F" d7 R2 n1 u! A8 N: A4 ]#include <linux/init.h>
1 n! G7 f6 h# Y! L- d#include <linux/module.h>
8 s+ R: f7 y. y* O5 l#include <linux/kernel.h>+ P$ N6 c2 D5 ?7 Q
#include <linux/types.h>
' A+ g; R5 h* J/ F1 v9 T( r#include <linux/gpio.h>
+ c7 B+ n; T9 `$ K) K9 P#include <linux/leds.h>+ ~* G  d! u# `# n6 c
#include <linux/platform_device.h>2 z3 o2 X4 d! m( z- l8 i/ t- Q  R) R

6 ?  ]6 u. X8 ~#include <asm/mach-types.h>
% f* o) ^8 u$ L, r' d#include <asm/mach/arch.h>" L' R8 o9 a" f# f- J& J/ b# F
#include <mach/da8xx.h>+ q7 c( m6 X+ O) C" o; T: W
#include <mach/mux.h>+ n% X6 K7 C3 h1 @
2 c6 Y# |1 e6 E1 B, V/ i! I- N6 k+ G
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)4 l0 B5 Z% r# M( X0 X1 Q
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)0 X' v3 }: V8 U1 Y7 k7 F
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
- g% X; U4 J( ~+ n; V# t#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)3 O7 Q/ h6 C! ^5 }8 K- x3 D
7 S* [; w: V. q% v
/* assign the tl som board LED-GPIOs*/8 c  \- j4 M5 W+ ]- _! U: l
static const short da850_evm_tl_user_led_pins[] = {
4 T+ {! C& ?; Q8 M7 x; ^8 Q        /* These pins are definition at <mach/mux.h> file */
1 |# O& M' y* ?" p        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
7 Z7 A* F1 }* X5 w9 Y        -1
. O4 K9 m  v+ ]% m};8 l3 u2 v8 d; l9 R; Z1 {9 g
4 J. ~. w7 F0 x( q0 T
static struct gpio_led da850_evm_tl_leds[] = {
- k; T7 w. z1 ~. k/ w# a( n        {
- l; e/ l5 t* W/ D                .active_low = 0,
/ `$ ], R; n+ w) z  m# X7 \1 s                .gpio = DA850_USER_LED0,5 h, o2 `% X( W% V. i
                .name = "user_led0",
* \. g0 g3 L9 A+ C                .default_trigger = "default-on",
, ~) j! R1 D- _* p- k        },
7 h. X% a2 Y# N0 b- j2 r  X" m        {
- `9 |% M3 S5 y7 ]" L, @                .active_low = 0,4 g+ \/ L) [1 g7 f
                .gpio = DA850_USER_LED1,% Z4 e! W; d; L/ W
                .name = "user_led1",
7 C3 s3 ?0 }) p" `; \- F! b                .default_trigger = "default-on",
0 n5 B7 r9 e0 [) I1 M* `9 X        },, x3 U8 X9 R% z- l: c% t: \
        {
* [' G: J' K; o" u0 o% i/ F, I                .active_low = 0,; Z1 e* z4 j+ ?8 F
                .gpio = DA850_USER_LED2,, m- _* n0 @& x* C) s( K1 D
                .name = "user_led2",7 n: d, {- T7 _% e8 }$ J; C4 O
                .default_trigger = "default-on",+ R' E! b5 L( y9 M: d: ?( i2 J2 P
        },  u4 A+ m( ^9 a4 _+ R
        {
( z: ^# X2 b$ `  k                .active_low = 0,' S" a3 m$ ~3 K  D# ?
                .gpio = DA850_USER_LED3,
( L# \6 z$ T9 t" D                .name = "user_led3"," }" E' f, k" U" W! |, q
                .default_trigger = "default-on",8 T$ b. j& H+ t- c
        },
3 j' @( P" @1 R9 k$ h! _};
. o# ?" s1 k0 o! R
, J- S! N/ [8 c! @- N7 Zstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {; t/ t# ?, X* ~, Q
        .leds = da850_evm_tl_leds,
$ n5 R0 I+ d: r. B* E0 `        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
+ D" ]& t6 s2 D7 X& U7 ?};2 s; D& |: I. u5 t( Q
  K$ C" L3 q& S% Y" z
static void led_dev_release(struct device *dev)
" P. ^' i8 `2 R* n. u{+ K% {' y! n: u
};
% @' ~! n6 e" J1 k6 u* h
) x  ^+ L* O: \( D# I5 @2 F& Estatic struct platform_device da850_evm_tl_leds_device = {9 G4 k0 v: m7 n' ^
        .name                = "leds-gpio",2 f! X+ K/ I# S% T
        .id                = 1,
) G$ \6 n1 B( R: P        .dev = {1 D$ f: y: ?) Y& _. }
                .platform_data = &da850_evm_tl_leds_pdata,
  T7 z. [% e+ U                .release = led_dev_release,. C% m' m: N% O+ J; P
        }) z' z/ w9 R1 x. |
};
9 p2 h/ q  c6 `
/ x- e3 E7 [9 x; Z; p; A9 Z- M" _static int __init led_platform_init(void). ~9 B& L) R% }  {4 X1 Y+ B
{
6 v2 y& y$ n+ A% J  [& T        int ret;
1 |8 l- R, C+ @6 i7 [6 q" f: U#if 0
/ `+ _/ H# M  K( x  \  K$ k        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
* n/ E. N- i6 d; P        if (ret)# g$ \8 n/ ~! T. t. g: y* r
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :". T5 E# B' P% u# S
                                "%d\n", ret);
" ]/ |" r: d( A& v! T#endif) ~6 e  f3 e2 F2 i
        ret = platform_device_register(&da850_evm_tl_leds_device);
3 d  S, R) x! d) C" [% h1 K1 s        if (ret)( h) ?- o) s  |" E2 D4 r3 h: Z
                pr_warning("Could not register som GPIO expander LEDS");' |2 T0 K1 e/ S9 ]
        else
8 M! q9 v, D6 G3 a% M2 N8 q7 S7 {                printk(KERN_INFO "LED register sucessful!\n");
1 y% i' A/ v) X* }5 p6 U  j( Y) s7 O: a
        return ret;
: |& h, a3 l& H" E9 r) z( i}
, o0 ]- Z' {/ l; R, \; ^7 P; [, O
! k. s( _" v' F' Y; pstatic void __exit led_platform_exit(void)
+ Z. q( r2 x4 {+ |- E$ a" D{
% `2 G$ C, ^6 q4 a4 J) l& S; b        platform_device_unregister(&da850_evm_tl_leds_device);& |' q! _2 Y& M# }5 g/ \& S
6 C- b+ r- [! n8 [9 U( E
        printk(KERN_INFO "LED unregister!\n");' S: G1 p+ }) u+ i- h
}
7 H2 [# t: C6 b, d, r/ [# d9 j* u  O( Q: M. e  i
module_init(led_platform_init);/ J9 x: l# c- b2 T
module_exit(led_platform_exit);1 s% Q2 Y2 m9 w: f' U0 ]& E
1 k$ @& N* X$ H, I% F- W
MODULE_DESCRIPTION("Led platform driver");! ]) u# M" p& S' O0 R; d
MODULE_AUTHOR("Tronlong");8 V1 C0 f$ I$ C' \
MODULE_LICENSE("GPL");; _6 [+ p  w! \7 X/ v

5 g; A5 I  w" F. z9 R( N' K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 03:24 , Processed in 0.042195 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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