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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。+ t2 j& `. I' l+ _
#include <linux/init.h>
  D6 y  |1 g2 s: u/ T* L8 Q: o, ]#include <linux/module.h>
* G! H! |- E5 E6 E. M4 M1 ?#include <linux/kernel.h>
* G% J; u  Y- b5 D#include <linux/types.h>9 u. h# D( v* }- E1 @4 Q
#include <linux/gpio.h>
" _& v( z3 ^* W" b$ k#include <linux/leds.h>
  S" [0 Q5 i6 J* \#include <linux/platform_device.h>, c# d9 f; w/ J) j
9 s9 Z( g' d) c8 U
#include <asm/mach-types.h>
$ C9 h- s, Z; @0 b! W$ d#include <asm/mach/arch.h>
2 i* T( K$ R7 n, @# u  i5 Y#include <mach/da8xx.h>6 U7 b6 x& N- M6 z8 P
#include <mach/mux.h>: |' {: q9 I. S4 K+ W- R- ?5 z

$ R4 I6 v; v" C4 H, v$ n#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)5 |% x' B3 V' L' i2 U& t
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)% d) H! |/ o( d$ ^8 E+ U8 S
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
2 x4 @+ H5 \+ O+ ^) E9 k% \7 `#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
: K, w4 D) R1 [" L
5 n( T" G; Y- R1 d- S1 y/* assign the tl som board LED-GPIOs*/! Z+ l6 w; U$ @5 h& F
static const short da850_evm_tl_user_led_pins[] = {) ?$ q! \* r9 w& I0 y. t9 D4 M
        /* These pins are definition at <mach/mux.h> file */
1 {. ?( g" Q" c2 w        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,' B( z6 f$ {: B. t: @
        -1
7 k7 c7 h3 Y+ U0 Z0 @& J. a  m};
8 s. @4 \' q7 @+ }1 a3 _( h7 \. f+ J& |
& l, O; u2 w& ]static struct gpio_led da850_evm_tl_leds[] = {# L- `3 Z/ l. c2 U- j' v0 I5 v: n) Z
        {. |+ i7 p3 S1 l
                .active_low = 0,: y; l  F- f, @) z! U& D& y4 |
                .gpio = DA850_USER_LED0,
& J% I: s0 d9 ~! b! u* c                .name = "user_led0",
9 H* D; a5 U3 v- P  @                .default_trigger = "default-on",5 _: w- O( X" k9 Z$ a
        },! w$ n% g3 \3 J9 @6 `4 w
        {
* N/ |) @+ \/ b6 @# u5 l; V  \                .active_low = 0,
8 r8 F8 ~2 h# d# J7 s" v" ]6 ^                .gpio = DA850_USER_LED1,
. t+ [' d; S/ }/ b                .name = "user_led1",2 P1 w( d% @# a: x' W, M5 L4 v$ m; u
                .default_trigger = "default-on",
9 ]- X  I' }, P        },9 C0 ^4 a7 @4 `0 v9 W
        {  y2 p  Q, t% {, K( s
                .active_low = 0,4 q1 F% t  A2 Y
                .gpio = DA850_USER_LED2,
0 Q. u8 A, p5 E                .name = "user_led2",6 _& t1 ^3 _( I6 A& e
                .default_trigger = "default-on",( R2 ~; A' W+ [1 Z3 E+ D
        },
: l1 ?, d8 ]+ r/ s        {
# D/ O6 ]1 f( p/ s( }. T5 Q                .active_low = 0,6 @; N5 K8 a7 A
                .gpio = DA850_USER_LED3,
0 {; _% }& ^( I+ c                .name = "user_led3",
) x" E2 c9 p0 [# s' X- {3 Y                .default_trigger = "default-on",
) `: ], H( [/ S8 f+ ^$ c6 |8 U+ z        },0 A$ d$ s/ D& g1 L, I) r1 s& _
};# Q3 k1 u, A/ M. [5 t

# V& s$ G1 t. m* e; Jstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
$ o% W' A% X! H4 t  o        .leds = da850_evm_tl_leds,/ r4 Q9 _, w# I% F
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
1 b# H! X7 Q: K: g( [" t};
% w" i$ x: \/ ]: A  C3 a9 K5 n9 q. k
5 b5 p7 F% O- K7 ~: Cstatic void led_dev_release(struct device *dev)
( Q0 b$ P& d+ e{
' c) t( a1 E; ~! i( x};9 X2 ]5 m$ T' M$ [7 q7 S0 _
4 k* B/ ^3 @) J  v
static struct platform_device da850_evm_tl_leds_device = {
: [4 }$ P0 f. d& [        .name                = "leds-gpio",
! ^8 i# R0 O8 {1 ]* T/ S7 Z2 y        .id                = 1,; a3 V) N" [4 L5 j& D
        .dev = {1 Q) Q. T: X" d% Y- A
                .platform_data = &da850_evm_tl_leds_pdata,
" ]9 O9 }& \' c$ J4 i9 h! W; J                .release = led_dev_release,) j- \% S; Q+ @" c$ r' C. g+ x/ i. k
        }! c" u; {. c% f( ]
};
4 O9 c5 ]- c  m0 b( \
  s) A/ d) q) G0 e& Q: f+ A" ostatic int __init led_platform_init(void)
0 }# s; X2 |# k5 w7 i) o6 \{* i6 h* Y/ y# P3 a8 r& }6 a! ^
        int ret;# z9 m9 j- X, d, @8 I
#if 0
. R6 f) d+ ~$ M5 a) D) b        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
% m7 z8 l9 d- W" N        if (ret)7 S4 O% ]& h: V* \5 _% _1 k# T- F$ U( Z
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"! {2 C% o  }4 @$ O  M# ~) }
                                "%d\n", ret);. k& q" E9 |$ N! R- m- Z
#endif
9 o6 Z8 {2 a* Y1 G        ret = platform_device_register(&da850_evm_tl_leds_device);2 X3 {1 G* ?& Y9 W4 Q1 q/ d) ^( p
        if (ret)
/ x1 p; E: e0 ?                pr_warning("Could not register som GPIO expander LEDS");
0 S9 y1 D5 I* k2 l        else
2 o2 W& ]( f3 G; O4 Z* E! @+ T+ A& l4 K                printk(KERN_INFO "LED register sucessful!\n");
( w% h3 c& c/ U! J  t4 |
% A, O8 n6 J) ?        return ret;
3 \* k& f6 o2 b; r% U2 l8 c}1 S5 v# I4 ~5 Y

+ X/ L. r# T4 n* w3 Lstatic void __exit led_platform_exit(void)1 ]+ I: ~& p4 w
{
# P' s  ?7 ~& N6 |3 f" j        platform_device_unregister(&da850_evm_tl_leds_device);
) J, u1 ~$ Z2 d5 ]* l# j$ p3 ?8 h% P( K/ `) ^& {) v
        printk(KERN_INFO "LED unregister!\n");2 O' a, u0 O9 |' m3 d! v7 q
}
8 B8 i4 a9 ^  z8 t3 F  U! w. C- y) ~4 f% Y
module_init(led_platform_init);! E, ?- q5 m& M
module_exit(led_platform_exit);7 p. [5 r7 h9 F5 ?# }
& M9 V5 b1 h. J8 E
MODULE_DESCRIPTION("Led platform driver");
, i, E  c4 }. I0 a$ x% `5 HMODULE_AUTHOR("Tronlong");8 L) H6 N% f/ @: Z1 E
MODULE_LICENSE("GPL");! E3 R* z% K1 ?: ~  N4 Q1 m  e
4 j% ^" `$ G0 T' r+ H6 U: @4 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 04:34 , Processed in 0.041783 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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