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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
" ?3 l* H/ W6 V( r4 Z8 b- B3 H8 b#include <linux/init.h>
2 K" d: ^. ^- z$ R' z( z/ t#include <linux/module.h>" z$ I8 ^$ e' N2 f, e- |- g
#include <linux/kernel.h>+ |+ Z7 q& a0 d4 \
#include <linux/types.h>* @% c5 F' v9 W& s
#include <linux/gpio.h>" b: Z( Y/ G. z. |( G
#include <linux/leds.h>
! j0 f& \" p3 u/ ^, C! {7 h5 O#include <linux/platform_device.h>
8 K2 t% n5 {/ u, J+ [) V
7 ^( |. m3 U& _' _; {* j#include <asm/mach-types.h>
8 ?; E0 V: A+ A/ ]2 _/ q#include <asm/mach/arch.h>9 Z0 d- q+ C4 q) Q
#include <mach/da8xx.h>
5 o4 o" p  }! o1 \. s( V- G% l! ^#include <mach/mux.h>+ T" C2 ?' h4 C  Q  j; _5 W
/ l. W) i( v* Q+ B) \3 W
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)2 n* h* W- u# L" C* r" y
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
/ ?  |" h" K5 v" V# \$ e0 L#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
5 ]! w3 e2 j4 S/ x/ z2 T#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
9 V! v1 O5 H' `8 {4 V* h. }' S" {8 J' `+ N/ `' _2 i  r3 ^/ y% }. y2 J
/* assign the tl som board LED-GPIOs*/
# v& e$ L9 z$ b/ |" H8 Nstatic const short da850_evm_tl_user_led_pins[] = {; d+ q% R3 |3 \# h: C3 K4 m0 X* }
        /* These pins are definition at <mach/mux.h> file */
/ y( a8 q* n. y        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
% w8 x' x; r8 J! i6 h        -1
9 i6 N1 _& N0 C( o& b0 s$ h};9 o$ z  P7 c9 E: x) p& K+ y2 ^

' u3 r+ T" w- b! kstatic struct gpio_led da850_evm_tl_leds[] = {
9 u0 ~) `1 w" d        {2 V* L2 W. m$ G
                .active_low = 0,
( f. W& o+ C8 B                .gpio = DA850_USER_LED0,0 ]) m; N2 |; p) ]3 j
                .name = "user_led0",$ M5 c, l, q1 i% I( s4 ]
                .default_trigger = "default-on",8 k8 V/ r6 k! e: P9 w7 y
        },. D& n4 G! q# X; x" }+ A
        {
2 B$ O  y+ h5 o7 u5 Y: m                .active_low = 0,# \" a1 ~. U! m& U2 ~! }
                .gpio = DA850_USER_LED1,. L" g" j- H8 W- p1 k& b3 w; H
                .name = "user_led1",
8 L( \9 b1 U# ~9 T+ U. e                .default_trigger = "default-on",
" j  e2 D. r; |  r0 @6 S1 ]        },6 B- a6 c" g% V/ k' y
        {
# b) @" f7 Q2 Q" Q/ t7 H" q7 v4 ?, a                .active_low = 0,3 r! p( E: q( B3 d
                .gpio = DA850_USER_LED2,7 u- d; Z) M$ w! V8 H- V' y; O5 C
                .name = "user_led2",5 s% t: a* e# x/ }* a: N) c" W
                .default_trigger = "default-on",
& k; _, z7 b/ t1 Q# D: ?  s        },9 ?6 ~3 w- B& j0 ]
        {
# J6 }0 |* {" X1 [% }                .active_low = 0,3 Y8 |5 s5 b+ w$ o  H  h. {
                .gpio = DA850_USER_LED3,
1 j' ~; R  P4 C                .name = "user_led3",, Y0 k- I6 E- @0 G* x, q
                .default_trigger = "default-on",
& `' {1 C1 V/ ]. b0 j8 R        },/ J' v- Y$ z- v+ K2 F6 D
};+ l* t( u2 o: I  J9 k# U/ U- \
7 _0 m+ d2 g  F+ _: H% ^9 B) i
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
8 P9 n8 B3 E* d  t+ \) H+ D        .leds = da850_evm_tl_leds,
  t8 z+ k. k$ b- {5 g' H! [        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),# l% t" l: h  h! r% v9 D
};$ F; _; X4 u7 _8 M; }

! m* p& F/ h5 c5 Jstatic void led_dev_release(struct device *dev)4 A: u9 e) ~5 |. V# W; O: w
{
9 t& c! a/ C, z6 q7 j};% t; a( `" {2 a0 w
! x) T; j; m, ?. q+ b* |3 t  y* q
static struct platform_device da850_evm_tl_leds_device = {9 W  G/ |7 |7 o: i' U
        .name                = "leds-gpio",9 c+ ]1 M) ^3 Q: _
        .id                = 1," i* V" H9 s4 k+ P4 R* I# j0 K2 n% D
        .dev = {
+ r) N" X4 x0 D; d2 Y5 R( P4 Z                .platform_data = &da850_evm_tl_leds_pdata,
& }: ~* Q# V; g3 C* @4 P                .release = led_dev_release,
$ N& E( c8 U1 l- O* B        }
+ c. x. S# N) y% A* N' R7 g};  c- `9 d, P: o' N: o( W/ U

9 g4 v) I! z' ]static int __init led_platform_init(void)
( `4 M+ p0 q$ g, W' v- q{
- \- q0 M2 e5 S5 m0 v        int ret;* t9 ~0 r; J4 f) h$ p$ Z6 c3 ?
#if 0
2 o) p2 l- r+ R( ~  U        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);9 @( I* n* [7 i1 F5 k
        if (ret)
, G! g' d5 R- S; l. _# N9 \                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
7 J% |& T; C9 \7 I                                "%d\n", ret);
: J$ G7 c: ?: U% ]' v" B#endif
6 Q+ I0 t2 Z* z        ret = platform_device_register(&da850_evm_tl_leds_device);. H* l$ ?( x, S4 H- F5 S
        if (ret)- V, M9 Q0 \) |# }/ i) u  T1 w
                pr_warning("Could not register som GPIO expander LEDS");9 z7 _4 @+ o& e. ?( t6 v1 _
        else
, p& T% a/ }% r                printk(KERN_INFO "LED register sucessful!\n");
3 v. J* V3 L7 s6 i" x& H) @7 k" q3 h% H
        return ret;+ F- F& l$ \2 {  U
}8 X( z% N) ?, ^9 {& L8 r( W% s

" n3 v9 E- f9 Lstatic void __exit led_platform_exit(void)
1 w0 n% V* k: K; x{# \1 ]* E2 j  o1 Q, a$ O  h9 E
        platform_device_unregister(&da850_evm_tl_leds_device);) E. n& _* @+ H6 M& Y1 f$ m( R$ G8 A

6 A1 z: L) p) e        printk(KERN_INFO "LED unregister!\n");& J' L& a# t$ f  Y/ S' \8 A
}
" ?0 u; w3 _2 e, _2 Y. J
1 |8 m) H+ p1 [" ~, N5 ]' emodule_init(led_platform_init);4 ?  c6 H4 I+ T; J8 C1 Q: b6 u9 P) ^
module_exit(led_platform_exit);
9 g5 j6 i" a: i6 M" ?" ^
7 o+ A2 U" C1 Z2 F" t3 M. sMODULE_DESCRIPTION("Led platform driver");
7 t  [9 [9 m1 F1 O3 WMODULE_AUTHOR("Tronlong");( r2 K: a0 ^; S' N. @
MODULE_LICENSE("GPL");
% {5 f; ^/ V4 i; F) F8 Q
) O3 z8 q2 c2 u  P& J: w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 19:31 , Processed in 0.057795 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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