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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。4 ~6 P$ ^) V. U5 v# b! x
#include <linux/init.h>
: F' J4 g$ X7 g#include <linux/module.h>" D/ [) o( f* x+ v( W! Y& B  q! {: |
#include <linux/kernel.h>! ?0 ]0 b, q$ a
#include <linux/types.h>
5 Z6 D* |4 H1 P2 K#include <linux/gpio.h>) N, d, I0 X; V: {8 x1 j
#include <linux/leds.h>
: C7 a! I3 n% W* T/ Z0 s#include <linux/platform_device.h>: ~6 K0 S) {9 Q7 d) m( H
# E; L; U+ ^2 C5 D1 b: p$ t9 R
#include <asm/mach-types.h>6 d4 h: J& V& |3 T8 N# M7 ^
#include <asm/mach/arch.h>2 N6 v3 s( j0 }
#include <mach/da8xx.h>+ V% e% E  }+ r" F' u* ?# W) C
#include <mach/mux.h>; [3 T0 t" I# V+ H
0 l( A% g& K" F  O% n9 a& w& k
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)- Y/ g* N! x2 s6 r9 k# B9 P- d
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)$ j; V* S+ r+ ^
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
: l6 q. W6 I8 y! f#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)1 [! X& q& A' \" g
; {# p' J7 ~2 s8 [* t) a/ f1 q/ A
/* assign the tl som board LED-GPIOs*/
* s+ b  L/ ?! N' e; ^5 y4 i) h8 estatic const short da850_evm_tl_user_led_pins[] = {
- h: ]; k6 W6 ~& e( U        /* These pins are definition at <mach/mux.h> file */
0 o1 o' p) n  O- B3 ]        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,: o; Q9 M# |2 ]; N5 _7 E9 e
        -1
4 K) N; u3 w# T! _, D1 Y6 Z};: K) G: w  O, r9 a/ K$ C
" A5 V8 D6 S# s8 c# C0 T* C
static struct gpio_led da850_evm_tl_leds[] = {+ s5 v; ~4 R8 Q2 k0 K8 o$ ~/ D
        {
+ O1 [8 W+ y) k1 j- i3 b                .active_low = 0,
; j: o/ W5 m5 R* T2 V6 R                .gpio = DA850_USER_LED0,
4 X; L! u. A+ T( @0 V- ~4 d5 x4 ]* \( g                .name = "user_led0",  q* h% {1 f4 g, c
                .default_trigger = "default-on",9 t- O9 l3 Y! O, g$ f/ k7 V/ Q& \
        },+ y" y2 N: w- A3 w2 P3 m
        {& Z2 D" G" E: m
                .active_low = 0,6 F- d3 ?2 {4 |6 {0 B
                .gpio = DA850_USER_LED1,
1 B$ M7 L0 b9 Z2 d2 I( R                .name = "user_led1",
% R, _2 G& `5 F2 m5 _9 A                .default_trigger = "default-on",
; G! X$ m5 U" A. G3 m        },& w" p- Q6 j) j
        {' [6 ^1 g3 Y1 b" n: s& {
                .active_low = 0,
+ T7 o$ w7 Y& y" W! y7 S                .gpio = DA850_USER_LED2,$ V7 h  y8 d6 J0 G3 W  i; a7 t
                .name = "user_led2",
# U9 E7 ^" I- G9 s: a8 p6 F& I: b                .default_trigger = "default-on",
& Z3 Q: ~" I3 q# p+ {        },9 f, W3 e6 w6 [* r# o
        {' o7 i. z" z* P) \- u4 `, M
                .active_low = 0,
# V- i' }, }5 {+ h. J                .gpio = DA850_USER_LED3,
) i( _# K4 {* v  Z# X& U) ?" _; ?                .name = "user_led3",
  G4 g& D+ H1 h8 w                .default_trigger = "default-on",; N8 e$ n; y1 F. U
        },
) S  h( M& \' d6 A/ N7 I  i};, v+ }! y* C% k4 v6 s% a* @: T2 K

+ U3 V, O5 T  K" ~& V6 C+ Astatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {! `: m. Y: s" J# i# j2 x1 L
        .leds = da850_evm_tl_leds,3 ^: r2 r5 |4 i7 ^8 T  x
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
! z. e# M$ D/ _$ Q& [% `9 c/ O( O};8 l0 w+ D- n# p, }8 p

0 t- Y( n( y" R4 Fstatic void led_dev_release(struct device *dev)# C3 U$ \! {: X$ b6 j) q; z5 J& l
{
5 a0 |2 ^+ w% ^};
7 V  k+ h) J- H% n% p0 P9 o8 B
/ a- @2 F+ N. b1 pstatic struct platform_device da850_evm_tl_leds_device = {- a& x+ W3 c- I, @2 `# |) @8 P
        .name                = "leds-gpio",, b6 b  s9 g  z; l% B1 x
        .id                = 1,1 ]$ j9 H/ p5 ^2 O7 Q( v# x
        .dev = {
. ^$ \% T, z6 z" w/ R4 |3 C; ^* O                .platform_data = &da850_evm_tl_leds_pdata,- _* E' m& E: X2 U) a
                .release = led_dev_release,: {& M0 {4 V5 q) }+ h5 `1 n2 o
        }1 D4 L0 E, C# O7 f" @" N
};# C0 D7 \+ n/ A! r( @+ ~! }+ {

, N" Q( G: n* F  i% W, ]1 O, n3 Hstatic int __init led_platform_init(void)
8 A0 O) E9 S' T2 Q; H{
# j. {0 t9 k4 i/ U4 y        int ret;
( I3 u6 }* `* r8 N#if 0! f* y% h1 y6 [7 p& L& v0 l
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);. H- Y4 H; S2 E$ U" N3 N, d0 \  h* H
        if (ret)
( z& j$ h9 _# |                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
) R0 c+ y$ n4 f* R7 n                                "%d\n", ret);9 T3 r- U- ~1 }% X
#endif
* \. t  O" p7 V) X' h  g        ret = platform_device_register(&da850_evm_tl_leds_device);
' |; Z0 p0 K1 |( S; x        if (ret)
2 z+ Y, n+ f/ e: X* h% U9 a2 s                pr_warning("Could not register som GPIO expander LEDS");
$ l4 O5 {" b. M; U5 G" P        else* D9 O! x' S0 O+ y* t- X1 R& E
                printk(KERN_INFO "LED register sucessful!\n");+ w- r. _! y7 w" e& r0 g6 i) P

- {! L# u$ I! _& O        return ret;" x- j  K' k3 D
}
# ?! A# X" _6 E# Y1 Y* r. ]% _7 |9 t' N+ n" B: k- N3 x* a
static void __exit led_platform_exit(void)
. \' P# g5 s2 K{
/ H0 {" J5 I; U2 w# H$ V        platform_device_unregister(&da850_evm_tl_leds_device);, |( K3 u- P, }; Q) f
7 N  M  w# S! {; f; z
        printk(KERN_INFO "LED unregister!\n");, D) r: O! [) a  _' Q5 o8 b
}4 s2 b4 E8 j, S( Y
" J  N6 K5 ^0 z
module_init(led_platform_init);, n: A0 |8 w6 M8 Z
module_exit(led_platform_exit);
! ]% O, M9 r7 T; B( q( P2 n4 _; I1 o4 @# f; x% X
MODULE_DESCRIPTION("Led platform driver");
9 i1 Q7 D! c/ O. s7 tMODULE_AUTHOR("Tronlong");
. C# }& ~' \" s( U+ C! x. M$ MMODULE_LICENSE("GPL");5 J2 ?3 ~+ C$ U1 s, v; f
' E$ h' B) N. B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 08:27 , Processed in 0.040711 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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