程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
& R' I4 k0 h; H+ Y#include <linux/init.h>$ d: E. |1 }4 S
#include <linux/module.h>/ N4 w" t7 D$ U
#include <linux/kernel.h>: Q5 \- f/ e8 n: N# M4 ?, b
#include <linux/types.h>6 D/ B  l5 e; a( T5 h7 S0 K
#include <linux/gpio.h>- |4 I. }$ n" `) K9 ~' X* O' j
#include <linux/leds.h>
5 P# I. ]# c; T#include <linux/platform_device.h>
8 d4 i/ j7 J4 N% g7 w: k
9 u+ l, _8 |/ a$ O$ _#include <asm/mach-types.h>' O% G7 g% c! Q8 {
#include <asm/mach/arch.h>
+ O  T/ J# f3 x4 \#include <mach/da8xx.h>  g6 k9 C# M$ P- ~9 |0 U2 N# n- }3 s# t
#include <mach/mux.h>
' t- J% }4 l; w$ ?+ [" O4 M9 {( v- m" y8 M/ ]
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
& n! ]" ]0 a% _$ ]  ~#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
/ `5 E* m% k3 R! H5 P8 Y#define DA850_USER_LED2        GPIO_TO_PIN(0, 1): F1 ^- e9 @9 P5 P, F" R
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
4 I0 w6 d% y& A, X& ], F  t4 [6 `# Y+ Q  ~  L, y( o, v% f. O
/* assign the tl som board LED-GPIOs*/
( v& \6 i$ F. {* B! D7 i* Estatic const short da850_evm_tl_user_led_pins[] = {
& Q8 R! U4 u! b        /* These pins are definition at <mach/mux.h> file */: l5 \% T  \  ?7 m" ^1 I
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
* z. g: m( }8 H5 G+ I/ G, u5 I        -16 [8 a  ^$ y, v2 G% O1 ~
};6 _- f$ l, E  V' o. Y

1 F3 L2 z* c! }( I5 G+ v# H$ Z' ystatic struct gpio_led da850_evm_tl_leds[] = {% P; n+ H$ s' o$ ]8 s5 H
        {
0 X. q4 Z, J, m* v# [1 X                .active_low = 0,4 m2 m8 j3 I  \. j$ t0 T: b. n
                .gpio = DA850_USER_LED0,1 x: z) `- i9 l' l+ o9 b" D
                .name = "user_led0",% i- ^, U  _/ U% ]
                .default_trigger = "default-on",2 x) ?( D( `0 v3 C- W* |. n8 J
        },8 E& ^* p7 ]1 S- e% [6 l" U
        {3 G  _* @9 a! Y
                .active_low = 0,6 a5 b; U" |; _+ }
                .gpio = DA850_USER_LED1,
5 g) [& y$ {9 I                .name = "user_led1",
! o6 H8 F" K4 t& j- i  l0 R                .default_trigger = "default-on",
5 x6 p1 ?7 q# o8 N( I        },
4 T! O" B! B# `3 V4 q; D0 Q" ]        {
, C/ H' W% i# d& Z& B4 {" C                .active_low = 0,
. \" b% S4 Z8 B                .gpio = DA850_USER_LED2,/ \; `4 X. q: Y' `! R. t' I. E3 r
                .name = "user_led2",! q% B) L" b0 x
                .default_trigger = "default-on",
2 M  e/ I: e! o3 o. y        },
8 A; t$ }" b2 I* r" M        {
( N. O  j. R; ^3 S) d/ T                .active_low = 0,8 ^' L1 n$ O: C: l
                .gpio = DA850_USER_LED3,
$ M8 I2 f" r7 T: Q  g( G                .name = "user_led3",
8 e9 l7 W! _4 e% n, y: z                .default_trigger = "default-on",
( N( J' G/ c7 i7 r+ a7 ]        },
# \. E2 C' `+ q/ Y. V$ F};4 ^# L. `$ ^" [: S& Y

1 N  r! t3 U$ W( F+ Ustatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {- w7 J% b; y/ c  I' W; B) |: e
        .leds = da850_evm_tl_leds,
1 g3 U8 ?4 J7 X        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),6 }1 K  a& @3 @9 w" `
};/ j- o' ~8 }# w

7 l0 ~8 C/ V! O, j" ]. b# c9 ystatic void led_dev_release(struct device *dev)
8 e7 Z) B; j. y9 L; S' m- a5 h/ b5 c{; s1 r0 l1 B- `6 E5 a: @: @% k
};7 B; a! A' ?* P

  M7 v2 d" z$ {  F% v* p1 Pstatic struct platform_device da850_evm_tl_leds_device = {( ?  o# ?. \( {
        .name                = "leds-gpio",1 r8 ^! y5 G) |+ C
        .id                = 1,
/ W  l& G5 S; j, A        .dev = {
* x) g% a  z8 ]9 Q8 H. s                .platform_data = &da850_evm_tl_leds_pdata,2 T- Y+ J# Y! U3 i$ T; z/ |) I
                .release = led_dev_release,3 d) R4 h, @0 \+ J
        }- `% p2 a9 ~; x$ ?8 T
};6 g# X8 t. M4 t& E  l

* n% x( g" H- \9 ]; [static int __init led_platform_init(void). w- a0 n" \7 T9 H1 i
{) e0 J1 f, E/ r4 O
        int ret;
6 `  d' b& m1 I. T. p0 H4 Q#if 0
7 W: z7 ~; X9 s  u5 L7 _6 j$ V" C        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
1 n! U0 E4 |% U  X' M6 s  M        if (ret)
$ `% h% S" [$ K0 Z% u2 M                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"' W4 ~: k' J/ v" u
                                "%d\n", ret);3 o) r6 [6 i, G; ]) ~
#endif/ ]7 Y+ U- n; v! k& a- v, ]
        ret = platform_device_register(&da850_evm_tl_leds_device);) D* m3 Y6 n/ ~2 Q( r5 ~
        if (ret)6 y* I1 S7 c; y. c7 J: A7 }& q
                pr_warning("Could not register som GPIO expander LEDS");
) J$ x! v8 B: ]8 ?( Y" v3 w. W1 ^2 `        else
# `: S$ z0 d1 j6 p. B1 o                printk(KERN_INFO "LED register sucessful!\n");
* [% R" a4 S1 `5 e
  p  b: h# a# `. I7 _' a        return ret;) S$ u  z  G- @. c& K
}
& a! Z1 G/ n5 }' a( X
4 p0 E1 f- a9 l9 ^& H  sstatic void __exit led_platform_exit(void)
- z4 e1 K) z! l0 z' Q% ^{
# d8 o/ w% C7 V: N7 H# o2 d        platform_device_unregister(&da850_evm_tl_leds_device);
1 ?3 u8 h* i! a& W' v4 X* a( J: s; @4 a$ `# X' e$ m- i
        printk(KERN_INFO "LED unregister!\n");  b% m0 g* `, x" f3 T
}
+ P0 @1 R+ g# z$ A# H8 s& s* _1 i: P: B3 A+ T2 ^
module_init(led_platform_init);
- A" y; D0 A5 N$ n" m- T  mmodule_exit(led_platform_exit);7 K+ v. C2 g0 [/ U

+ ?; t3 a- U, I, SMODULE_DESCRIPTION("Led platform driver");
4 R8 V7 {# N7 ~! iMODULE_AUTHOR("Tronlong");- [- R- I# E& R9 x* v' `
MODULE_LICENSE("GPL");
( O& Y- S4 v3 L- w4 V
7 ~: h3 T8 Z1 K# T( D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 15:46 , Processed in 0.042616 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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