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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
$ G8 K9 M  v, x( ?& |#include <linux/init.h>4 L0 S. K' M5 N6 }% }; L
#include <linux/module.h>
( L8 f0 i* ^$ s* W$ V, K; L#include <linux/kernel.h>
8 x% `/ o' x; ]4 ~5 O5 Z. y#include <linux/types.h>! X$ |: v0 y0 E3 q7 t, E
#include <linux/gpio.h>, m6 d. c  t% m: w& S0 Q  q1 J
#include <linux/leds.h>
  D( b* l+ ?$ G3 U1 a0 ^#include <linux/platform_device.h>9 V# d+ A; C% c# C- G9 [5 q
! _, i7 p8 K3 h( P# n# @
#include <asm/mach-types.h>
6 U4 x# s& f5 I4 s- ~: s/ o  X#include <asm/mach/arch.h>
1 s" F" u% E; L! R8 A8 h9 z2 [#include <mach/da8xx.h>, ?: D2 D( O/ ?* R; s8 ]( ^  p# Q
#include <mach/mux.h>2 [7 s# ]4 B$ {9 w$ V0 {# {! b

. ?7 I6 `$ F6 V2 {. U#define DA850_USER_LED0        GPIO_TO_PIN(0, 0); d% W- R& b* m  k& a
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)' L: D/ a0 U1 }/ J5 ?) V
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
* _% i, [0 s% B% J" K2 W. C- D#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)  ]  n: A3 {; G2 v

9 K' i1 V/ a  B. u; g# R2 ]2 l/* assign the tl som board LED-GPIOs*/
$ M; r: h$ r( f; \static const short da850_evm_tl_user_led_pins[] = {
8 f' h, m( u/ U& t5 |" H+ B# {        /* These pins are definition at <mach/mux.h> file */6 ?& L* R6 ^+ e: }( o
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
- R0 g: ?  a3 y2 j. R/ f        -1
. B, P. @4 F. g) S" ]};
8 s- b$ Y% K$ H- v! z, T, z& E% q$ J. y8 T7 u; K% m- `% ]
static struct gpio_led da850_evm_tl_leds[] = {
. v4 P  @+ J" J% p8 n) ?5 U+ _        {
/ E1 q; `4 Q0 e. A% `, `: {                .active_low = 0,# j- E, K# R/ o  y. f" }7 [" ^
                .gpio = DA850_USER_LED0,
* b9 F4 q4 b- g: G+ |& i2 r                .name = "user_led0",4 [6 K4 b# [6 ~+ U: D* f
                .default_trigger = "default-on",6 _* f8 E- A* e( h7 C! l
        },' q' u. o' e7 _- }
        {& D% {/ F' O4 W& _1 d* ~
                .active_low = 0,( B% B" _3 Z& `0 c- ?3 h
                .gpio = DA850_USER_LED1,
$ O2 O0 N! c1 C( ^# s. ~                .name = "user_led1",
# i6 Q& G% r9 Y7 B6 k' w                .default_trigger = "default-on",
# ~+ }  Y& e& P* u        },* r) A  l- o. ^- g* l9 y
        {
) G# d9 b5 ?' E" p  v" n                .active_low = 0,
7 ~2 l, A  _; s: }# c                .gpio = DA850_USER_LED2,
7 E6 e5 B, _3 I: {1 W                .name = "user_led2",+ R8 p2 K2 T8 U8 H
                .default_trigger = "default-on",
0 {7 C+ ^4 B! [+ E- s$ d' h        },# @# L9 K9 J0 t9 [9 @2 x
        {! I: l0 Y" Q" J% E3 {" R
                .active_low = 0,7 Y( h1 G: P; s) T3 Y
                .gpio = DA850_USER_LED3,
- M: a! u  |2 l6 M+ Z7 G3 k                .name = "user_led3",# A$ ?9 M5 w& _3 U. S
                .default_trigger = "default-on",
3 N, B. b' @  j5 |7 @9 E; H        },
( V$ @/ i3 d- ^8 \" }: G, H: n};
( e8 {* p8 J+ F5 R. H  r4 }( M
# d8 p# d4 A6 G( A/ cstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
! ?+ Z, C* ~: L. ^2 i        .leds = da850_evm_tl_leds,/ c8 Y" p) o# }( q
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),1 c: @% w2 x  [1 z5 ]5 f) k- D" ~* y
};
2 i2 E8 v6 M7 v. z6 H+ ?( h0 T2 y" E8 {7 Y' m3 m
static void led_dev_release(struct device *dev)
9 p8 \' `2 X8 Q. y4 _8 Y{
% |4 O* f/ Q; _1 X' {- K3 T( _* ]};
9 D" R* {8 K/ D6 ~. U# t$ E
# K( \/ L5 N6 V/ P* {3 P1 c. }static struct platform_device da850_evm_tl_leds_device = {
. @, P1 c* H  h0 h/ d& u        .name                = "leds-gpio",
% c0 _8 A" E4 P8 {$ K0 U        .id                = 1,# P* z$ P9 X! c5 q- q, ?( @+ h
        .dev = {! u: z) `2 }% P; C( {
                .platform_data = &da850_evm_tl_leds_pdata,  j! H8 |" ?, G0 ~
                .release = led_dev_release,
# C4 e& B# F# t: e; d; S4 A5 Q* S        }
0 T( Y( Z" r$ P  k/ ^* d};
8 ^: q; U' I" `5 X: G+ P3 }0 X/ j
static int __init led_platform_init(void)# k% E  x7 W/ c  b& l
{0 {8 n" w+ y- K. m, `
        int ret;# i! s$ W( L4 ?4 u, x6 j
#if 0
3 j" m$ ]7 u* X; m        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
8 Y/ i9 |2 I' l5 l        if (ret)& e; Z3 n& C+ T! r& N/ g; R
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"( v6 @  f/ h2 @, [4 G
                                "%d\n", ret);# ~. M' D, k* p3 [' W
#endif
" t* _- s  f) }. d( X; J5 Q/ M        ret = platform_device_register(&da850_evm_tl_leds_device);
1 u$ f, b* T1 a/ P        if (ret)
1 a2 s; q3 P3 R; o" P                pr_warning("Could not register som GPIO expander LEDS");
3 F' x3 l! v* s( i% A        else8 [% Y, a+ _" j- r3 F+ Y/ ~) j
                printk(KERN_INFO "LED register sucessful!\n");
0 N7 F8 `0 L" `  h4 e$ U2 V: y0 H/ e/ D* p1 D7 \
        return ret;
  @  H: t0 d& ]" n' y  G}
* W' N  L7 c: a7 c) H+ B; E0 D/ X/ k! A  o9 k8 p; |
static void __exit led_platform_exit(void)
! \8 C' a4 S/ u" a4 r% _{
/ e# k! ~( N% v  S8 d& E% {& v        platform_device_unregister(&da850_evm_tl_leds_device);% h! s" K! A- N- j
- N. A' J7 p' _- j5 g. S
        printk(KERN_INFO "LED unregister!\n");
9 V! Z$ @/ a* O! m+ `}
7 h! q# g: T* K% [5 V1 D3 M2 ^* r, U8 n. \! w3 \7 e
module_init(led_platform_init);) Q: v8 L5 c9 E/ Q5 V: o  f. \
module_exit(led_platform_exit);
9 f$ r' ?1 m# |# C0 N
$ V- E0 o" N: V* @3 t  ~MODULE_DESCRIPTION("Led platform driver");& `1 H2 B0 W5 }: H) v/ S& O
MODULE_AUTHOR("Tronlong");- y7 u+ D* m) _5 _6 C3 V
MODULE_LICENSE("GPL");
" V  Y, a2 {) J2 g9 q/ a0 s" S6 n: W; t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-21 19:26 , Processed in 0.036949 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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