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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
/ r* t  s4 i5 r#include <linux/init.h>
5 w$ |9 v8 A% S2 f#include <linux/module.h>
" `/ `  }7 e0 J#include <linux/kernel.h>
; B. _- P  Z& r5 k. M! B#include <linux/types.h>
+ D4 W2 N. e9 a# D$ G#include <linux/gpio.h>
) u1 [9 H6 |+ B4 X2 @5 f4 l8 L#include <linux/leds.h>
. o2 z# A3 `* E9 T3 }& F' _  N#include <linux/platform_device.h>
5 p* f" Y4 y- Z
' y6 c/ g/ A) S7 o$ S' `* E#include <asm/mach-types.h>
4 r) P: @6 e& ?2 d0 c4 D#include <asm/mach/arch.h>
. o: x5 A! n- E$ g#include <mach/da8xx.h>
8 y9 w0 Q6 b- U3 T' q- p% K# r#include <mach/mux.h>
( p! D0 F! X: f. ~! _8 B& s  R, a, ]& s9 w, C9 b. L
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
3 H# a! Q) Z* F6 ^& l#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)% Y* }4 t9 o3 g& m. A) F
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)" t3 \; X. l+ t& \  L$ C
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
2 O/ T3 Q. N) K5 M! W8 x- y& T% ]8 L- U5 @
/* assign the tl som board LED-GPIOs*/
* E  n0 S. N8 Q, Wstatic const short da850_evm_tl_user_led_pins[] = {
' \3 M3 `* @9 [        /* These pins are definition at <mach/mux.h> file */
4 L4 a1 k% U: P        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
$ v& l( z* F! O, K        -1
( {, V) m. `, s% e" B};
! y2 d, m  w! S6 v, Y
+ W$ m) H$ z( K3 n' |2 Y9 Xstatic struct gpio_led da850_evm_tl_leds[] = {! k6 r; _( D' E3 X* x
        {
( j7 [/ ]8 l3 e3 B& D5 |! s                .active_low = 0,: W8 p* b( T; N
                .gpio = DA850_USER_LED0,
5 N; ], K0 K. d$ r1 T                .name = "user_led0",
  t, e- W; Q- H! C& w; f( `* N5 G                .default_trigger = "default-on",
7 |; I1 w. d1 m  `' t4 T. G6 J3 P% _        },
( W3 D! Y2 i- f. Q4 V        {( \5 s/ \9 Y( x2 h5 l" [" v, M
                .active_low = 0,
: p0 V, L2 o3 ~$ A                .gpio = DA850_USER_LED1,
- B$ |" g9 F) M. q  u0 t4 e! B* f1 T/ f3 V                .name = "user_led1",
$ \/ j, v9 w; S8 l  X4 W  Z                .default_trigger = "default-on",
) Z- E: h1 R1 x0 f: `+ z1 f        },/ Z; S8 \0 i4 c0 u5 m4 c0 b+ u6 I
        {
3 V& g' n3 }$ Q' X9 f+ s                .active_low = 0,
: s3 e" t3 g9 h/ V+ M+ |+ z- D                .gpio = DA850_USER_LED2,
: `: m; _" d; O3 O! ]                .name = "user_led2",
0 {+ A9 S2 M: e8 c" B0 Z. X  p                .default_trigger = "default-on",
3 z2 ^+ |; b& H% p( O        },0 V' l6 ^2 B9 c, m3 E* X
        {7 n# k+ P2 n8 w5 O
                .active_low = 0,
, K% o1 f' C# n9 P5 |) x                .gpio = DA850_USER_LED3,
( c" }- Y$ R# R& y* {: g2 H7 P                .name = "user_led3",* z, h! n( k5 L* d5 j/ ^+ h, o; b, K
                .default_trigger = "default-on",
. R$ ^8 T( u. G6 c3 u        },. w" ~( j. o5 g2 ]
};
( V5 E0 J1 ?' [' K  a) e" [) ~& ]
0 Z* P  \- s! p. f- \% dstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {0 Q  A( a( |" k8 Z1 m
        .leds = da850_evm_tl_leds,# D  k6 L2 `$ n6 r
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
, q5 _/ ^) l: W' }6 O" |};
! G1 _3 |, m  B) s5 O% }+ ?& D# f" h5 d' k1 w2 a; q: ]8 ^" H' q( E
static void led_dev_release(struct device *dev)
+ \1 a) E: W: [0 }+ r0 ?{6 m' C& t& N' C. L, [4 Z
};
5 d" D: p" d' }7 Z) y4 s( X/ z! g
static struct platform_device da850_evm_tl_leds_device = {
% s. W9 x. @& ?  }/ w/ M/ _8 \        .name                = "leds-gpio",; I. U! J# d' V/ W0 p+ q
        .id                = 1,
& |% Z5 X2 H1 o        .dev = {. ], ~7 D$ Q: p7 k) I4 @& a3 N
                .platform_data = &da850_evm_tl_leds_pdata,
' Q6 }7 X0 I/ q: S                .release = led_dev_release,1 ^/ B& K8 i, V- d  u) n
        }4 y" w3 j% ^! n" g9 c7 X6 Y
};
$ I7 w4 R! v, n' p) y; ?& p0 q, A$ @8 ?# F7 p* u
static int __init led_platform_init(void)# Q! W: m  Y+ L$ i+ K! O  F( i% X7 N
{
5 L! [  }$ w" P9 f. }0 n        int ret;0 w) D1 P/ h  a5 U
#if 0+ I  |) A2 K1 u/ d- V0 t* U5 R  j
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);$ q7 `* D+ x# `8 w9 T5 v. l, x
        if (ret)  a: a6 @% y. a/ y9 G" O: D0 U
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"3 \( p0 ~3 A  l  G9 m
                                "%d\n", ret);
) I6 ^$ {" b" J#endif7 e+ y6 E/ j6 |1 v
        ret = platform_device_register(&da850_evm_tl_leds_device);
( I5 I* r, `6 f. ]$ k, b! [        if (ret)+ o' W$ F; r! K$ B) d* D
                pr_warning("Could not register som GPIO expander LEDS");
6 M+ r+ t# s; Y        else; p( C: w2 `) ~  i8 z
                printk(KERN_INFO "LED register sucessful!\n");
+ G: @2 \* k( J9 Y9 r* U6 @* `$ I8 d2 S, W  C! }- D$ W) n( {+ M
        return ret;$ ]; N: P+ l. b! Y  s4 G# B9 y9 X
}5 U6 K1 I1 N3 P$ U7 Q
+ Q  ~: v* \, H0 e8 ]; z
static void __exit led_platform_exit(void)3 f# B; L: K- m  A$ T9 t9 M
{. H* U7 `) q/ o- P1 i! ]
        platform_device_unregister(&da850_evm_tl_leds_device);2 {# z! c* v& Z9 G% y
+ t/ l0 h( H7 S! w/ Y+ G* v& \6 c' P
        printk(KERN_INFO "LED unregister!\n");
# m: `4 ]2 @# ^}
1 k, O: k* S0 O% l: B
3 V% e. F* ?+ c5 ?+ X" k- \module_init(led_platform_init);1 X0 j1 l% x  j9 a0 S5 @
module_exit(led_platform_exit);% K) l1 Q4 T: M1 g

4 \  D# e! w1 z6 {1 z0 [" u9 pMODULE_DESCRIPTION("Led platform driver");% i$ C4 C# z) ?, n0 J
MODULE_AUTHOR("Tronlong");1 A2 i, R- A5 H
MODULE_LICENSE("GPL");9 Y( Z% W$ s* `/ {% w

9 |) R  n9 U3 a- f+ L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 04:08 , Processed in 0.039187 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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