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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
& a2 a: g; Y3 |+ ~- k#include <linux/init.h>
+ r$ z& q) R/ W0 A/ s$ x#include <linux/module.h>
+ A  x1 W, t& _% ~2 }5 ]) u; e#include <linux/kernel.h>
! y/ [! ?: f& o  W3 ~#include <linux/types.h>3 f3 z- b- D2 X
#include <linux/gpio.h>1 R  @' C; D, M% }" y2 B& z
#include <linux/leds.h>: [3 u. X9 T2 }; k
#include <linux/platform_device.h>
& \% V8 W3 c2 C4 `; Q, t# P* z. N. i  B$ {
#include <asm/mach-types.h>4 v5 `+ ]8 Z$ l) m- w
#include <asm/mach/arch.h>
, {7 M" ^) q5 l3 F# o4 r#include <mach/da8xx.h>; I" \" x( c- m' X2 ^/ r
#include <mach/mux.h>; w9 L6 i7 \. K4 c: {" D0 }& A

* M& U& L! Z% G- N/ A#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
& ]& X( E  |8 G$ k- e#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
! i8 E0 A6 Y: ~  o#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
8 m: n0 ?" o# \1 O#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)) ~; Q# M1 \# s# s: }4 t1 P
( D4 S6 j: b# T/ O1 F8 U* d
/* assign the tl som board LED-GPIOs*/
* ~% Z" h, V2 c, r. h7 y0 istatic const short da850_evm_tl_user_led_pins[] = {6 b& ]  `7 ~8 \  v* `: T3 v
        /* These pins are definition at <mach/mux.h> file */
' n2 C8 c( |# D. ^1 ~1 ~3 \7 h        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,* ?) r; Z* Q% e: P: a: ~
        -1
5 h1 m+ o) m1 }% Q4 p; b  h};) h6 L( ~6 j' q5 k( r4 z

2 R4 f) n% y9 j; Z+ s  Lstatic struct gpio_led da850_evm_tl_leds[] = {
# t8 p  f3 G1 T        {5 p7 ~* W0 b! }4 `$ P
                .active_low = 0,. C0 m) X) ^* p6 N
                .gpio = DA850_USER_LED0,
/ c4 ~4 f; x" A: l  U; o: e                .name = "user_led0",
8 V: ?: A; J' a( @                .default_trigger = "default-on",
6 M9 O2 a; W, ~2 R9 n        },8 _; d" q9 [, @. o$ ^! m
        {
3 g2 u- E9 D/ k6 ?                .active_low = 0,
4 D% \* T0 X3 N% p9 M: E                .gpio = DA850_USER_LED1,
% }: }# p7 I2 R3 \( e                .name = "user_led1",
5 p0 Z' b* w8 _2 }7 |% v                .default_trigger = "default-on",
% O( d+ r& K5 X$ Z, s4 m! D8 y        },9 s4 v4 @3 M1 W0 O
        {- q5 [1 n/ [& G
                .active_low = 0,$ ^- o$ f; `% y( c4 S
                .gpio = DA850_USER_LED2,
7 S: d- o; j6 t' k# N# P                .name = "user_led2",! r1 h0 ^2 d$ q7 ]; M2 d1 A8 i
                .default_trigger = "default-on",  n! Y3 `6 k' p2 m' Q6 n
        },
6 r* Q  g  W  m: g; B1 ]7 s2 l  q% l        {
% |. ?, M( i) F  A2 k8 U                .active_low = 0,
" f, J# I* m. M/ F                .gpio = DA850_USER_LED3,
+ K2 @% n9 r. |* `' F# ^                .name = "user_led3",- R# b6 x: C# j: ^5 F3 s# B
                .default_trigger = "default-on",
5 H# D$ ?8 d0 \        },. e7 [" U. Z0 S
};2 i# `: Y  w$ i! F

5 T: X" E0 M( m& q% ?0 Ystatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
/ w, A1 ~4 T- m1 u5 J! M7 y. l2 S        .leds = da850_evm_tl_leds,
8 g8 E$ |* U; D. T. P& O        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
2 [/ t' f  A% W" u};6 H: y. w( B$ }- ~( F+ }

; ~  Z6 \1 Q+ P% c% N+ o" Dstatic void led_dev_release(struct device *dev)4 h. k" C+ m5 o$ P8 g7 M$ U
{3 q$ v- ?0 P& R1 a: I
};
8 ^4 _, O& \8 |7 L( ?( y8 f. G: D
$ f3 D& p3 t' G, a2 }2 i* ]static struct platform_device da850_evm_tl_leds_device = {) \, L9 v  W. p2 N0 w+ o& B
        .name                = "leds-gpio",
9 i% r8 C* O9 K+ Q! r2 E        .id                = 1,
8 W9 x' D( x( I        .dev = {
# m$ q5 `! `8 G: n                .platform_data = &da850_evm_tl_leds_pdata,
6 i: g# @& F0 U2 H/ d, _0 s  H7 X' }                .release = led_dev_release,
8 V3 s1 [+ S3 k  C  r" L/ E( H        }3 c9 ^6 u9 t& _" w1 o9 f8 @( A6 C
};
' m/ h: E+ _6 R! x4 a6 q$ E5 I2 V8 \8 I$ C1 O
static int __init led_platform_init(void)7 w, b& N1 }$ _
{
! }7 S8 Z( c0 d- G8 G        int ret;8 P" G$ c7 c( [  ?4 ]# @" x; ]& A
#if 0
# _) n* U& L1 }) R        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);/ w$ E# }+ ^. A. r+ p( X* D
        if (ret)  X& l/ k8 @5 i1 x, \
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
% P; j; h3 N$ a& J                                "%d\n", ret);8 ?' O8 H" k# L5 l
#endif
7 y0 |9 Z4 M* I9 S, m" {' }' X        ret = platform_device_register(&da850_evm_tl_leds_device);& T9 Q& p' j* v( i+ X/ B
        if (ret). T% O" b5 u3 b
                pr_warning("Could not register som GPIO expander LEDS");* b0 ~& l$ h) L: O' ~" k; D5 r
        else
6 w7 q) k6 U) w6 ]* n/ F                printk(KERN_INFO "LED register sucessful!\n");
- t  W* c2 I% [$ ?
% O7 p. n$ n$ w$ h8 T        return ret;- z5 e1 p/ h, ^& o1 H, v
}
* I& h" C# h3 m- x. s& k! X8 \
! c, b1 r) K' U( p* I' u* ustatic void __exit led_platform_exit(void). \5 Y% x$ l1 m2 e8 }
{
& e6 P3 Z5 H# l! ~! K        platform_device_unregister(&da850_evm_tl_leds_device);
' Y. L; V+ o9 R4 [! [- M6 Y7 U2 A
$ C7 |3 s4 V* k; P8 \: y        printk(KERN_INFO "LED unregister!\n");
2 b* h9 X. ~, e# ^" r' K5 T}
  i) r0 y: W6 J# l& D
( `' F+ A7 f' Z$ L7 L6 a* u0 e* G% Nmodule_init(led_platform_init);" |/ c7 H# B/ _3 c3 v
module_exit(led_platform_exit);
7 |0 {7 A3 w; x5 `
6 Q' Y/ W  d9 LMODULE_DESCRIPTION("Led platform driver");) L6 P( \1 f- e9 I2 d$ M: C
MODULE_AUTHOR("Tronlong");
0 `3 C- `, u) b1 O7 u8 X5 _MODULE_LICENSE("GPL");
6 n) k, e& U/ z* N" ^" r% @2 G( @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 21:14 , Processed in 0.039520 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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