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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
( P8 q& M1 i5 s) w3 u# X#include <linux/init.h>
# w+ G4 ?, y, Y) r8 f( }5 Y#include <linux/module.h># D! }2 B, [/ F
#include <linux/kernel.h>6 m! z1 {. |7 u5 g' R# |2 O
#include <linux/types.h>
; d% Q/ O- O2 G- h#include <linux/gpio.h>) j( n1 x  K# w& W3 c4 p
#include <linux/leds.h>$ d# j: |3 W$ {6 p1 y
#include <linux/platform_device.h>
, l" w! ?4 y, f, x  p
8 A( n* u) S  t+ i0 n! Q; L#include <asm/mach-types.h>/ T6 h; h6 C% e+ Q8 T! M; M2 n9 |
#include <asm/mach/arch.h>
/ @* \: N) a# a' t) l#include <mach/da8xx.h>, T8 o9 H% l* R% x; _) ]
#include <mach/mux.h>9 W' B. l% A) L; L

/ P+ J# h8 U$ ]/ d3 D#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
/ W! \) e2 U: N# r( P: \5 q#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)3 R% Z9 A7 |5 s# [: Q) p3 Z  c- j
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)# \: n5 \5 m2 L, `5 n/ N4 c
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
6 [9 i8 \5 |, t4 X" V+ \, w( o4 [+ `6 r7 h& T% U+ g/ q1 g/ |
/* assign the tl som board LED-GPIOs*/
$ P; Q, h- p5 \# N& p* u+ ystatic const short da850_evm_tl_user_led_pins[] = {
: {* p& a/ G# y, F- W- i4 Y        /* These pins are definition at <mach/mux.h> file */
0 S) w- ~7 ~+ j) m% H. e8 r        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
7 O9 Y" k- V  u        -1
9 i& {6 M$ u5 ?/ Z) }};- Q8 A: ^% J: Y: H$ }

; u8 i, h% |& {% }* x! H7 g- dstatic struct gpio_led da850_evm_tl_leds[] = {' B% p3 R+ d$ c* N4 O! S3 _' p1 q
        {
8 u' p' d# d  g                .active_low = 0,7 g5 j; [% s6 g5 S* X
                .gpio = DA850_USER_LED0,
" _- _1 h/ m% S! {                .name = "user_led0",
# }4 V( \3 P+ g, d& K0 ~                .default_trigger = "default-on",& P4 Z6 b) S. L; V& q2 b. S0 o
        },
# L- O/ i2 b# P( k4 J& `# u: R0 e" i        {
+ r, Q: \' E7 G- t                .active_low = 0,( P( r% s" p) A- s! b( N" S
                .gpio = DA850_USER_LED1,' O5 `6 E5 T; U
                .name = "user_led1",7 {/ R- y# F/ {2 S. \# n/ ?  v
                .default_trigger = "default-on",
2 q5 M& J7 d' `/ Z9 B. R        },# n0 k' c! f* s4 `, q) Y1 r' W3 ~5 |( f
        {
  ~5 }# y+ w4 m5 ?0 Y                .active_low = 0,9 j) u3 d2 W0 g6 l9 o: L
                .gpio = DA850_USER_LED2,
2 D$ d3 ?0 j% C; g; g3 [4 c2 G. b                .name = "user_led2",* a4 J1 _+ v& ^) _+ @
                .default_trigger = "default-on",5 x$ {! J- u0 i( ^
        },% E0 }8 @) D; c( {+ d: r0 L( u
        {
5 F/ e9 C  q2 S* y$ V, T                .active_low = 0,
+ {7 y7 I$ O0 {0 @9 F3 p3 U3 P                .gpio = DA850_USER_LED3,
) T4 x8 a0 d, X9 i- k! h                .name = "user_led3",) A3 B* O* B. C1 h$ t
                .default_trigger = "default-on",' X) b* r# L  K9 x% a" f
        },# i4 s, D( X) w- H, r/ M
};3 O- G$ @1 j! u7 J. x# o! K9 C3 C+ u

% b8 K3 i) E2 V- b  o" o1 Zstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {' n6 D, d. w* F" p
        .leds = da850_evm_tl_leds,
- I2 k6 o; }4 x6 N: x# B0 ?0 Z+ ^        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),# |2 Q* O/ e+ T1 ]& G! J
};' A& R6 Z" t. |' M: Z: O

8 G, B& B) H, U& \; ~# Mstatic void led_dev_release(struct device *dev)
' s# C; h1 K, H' g% ?1 v" H{* K% k: r/ a  t% J" y8 V' {% T
};# \4 O. r- y1 _2 L1 y, C

7 q6 l, R: B) N5 i( H# h- A7 I* _static struct platform_device da850_evm_tl_leds_device = {( g+ D. {9 O3 V+ A% O
        .name                = "leds-gpio",: x. I, t2 y7 |/ [0 R
        .id                = 1,; l  j& g3 y. l# a, m
        .dev = {
2 n: S. s% J7 k                .platform_data = &da850_evm_tl_leds_pdata,! I" E4 f4 D. C/ ]; }
                .release = led_dev_release,. ^* j. x0 ?- T. W
        }5 J; D  a% ~% ^5 \
};( {1 K* J$ v- [5 f1 e: Q. \
* @- S/ H& W! h/ g) p9 n5 e
static int __init led_platform_init(void)
+ g# D7 q: d# {/ b& l  B{
. @3 o2 h+ B# y+ v1 ], w6 d        int ret;
1 C8 v! Z! |% D7 @9 o* U/ v#if 0
# L# X* z3 K6 ^0 F! M        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);5 k  L. {( n: l* M- [% s
        if (ret)
! o) t# S) B. \! X                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"% {! n# I& `+ d/ U
                                "%d\n", ret);
- S1 v+ |" V# z, d4 v4 C% Y1 b3 w) J#endif
- L& Q8 v5 a2 H( K9 O; J* I2 H( O        ret = platform_device_register(&da850_evm_tl_leds_device);! C9 f, x6 E  X7 d0 \) ?8 J
        if (ret)
, J7 V! H% A; u% ]8 B3 |                pr_warning("Could not register som GPIO expander LEDS");( _! Q9 q! S2 E5 N, f0 @
        else
/ @0 F1 V, Z  ]1 E8 t                printk(KERN_INFO "LED register sucessful!\n");2 d6 ?- I# H# D( O
" A: [5 u" U' Z  G% z
        return ret;
, _; H8 h. Y; N( T' r}: l9 z6 l$ j; t7 h  T2 ~0 T2 n$ Z" g

7 `7 O$ U2 Q/ [: f8 @  ?static void __exit led_platform_exit(void), @5 B1 O' O! E7 P
{
$ d/ U$ r: z' b( Q3 K* m        platform_device_unregister(&da850_evm_tl_leds_device);# C9 W8 C- g8 B( i

- M, G0 ]4 d* |5 P) e        printk(KERN_INFO "LED unregister!\n");  v8 C- |# H5 U9 ?* c' n+ M
}3 s$ W& O/ n* E

  m. _' H( p! o" l5 E0 C4 zmodule_init(led_platform_init);
$ {! @' l. |3 w; |. ?- `module_exit(led_platform_exit);& y9 |; R$ R4 y) A

* o6 ~! B# ~9 t4 M- gMODULE_DESCRIPTION("Led platform driver");
* Z, B0 f' J' g4 V7 @# U9 oMODULE_AUTHOR("Tronlong");( n% ~! U6 Y# G5 }0 X+ c; S
MODULE_LICENSE("GPL");( h8 Z0 b" K3 G

) b8 c8 }5 Q- w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 05:47 , Processed in 0.038773 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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