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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
6 E* t( I" S4 h4 T$ m' D#include <linux/init.h>
, \: K: c0 G5 h5 ]) `" J( O+ w#include <linux/module.h>. M- H/ f3 W/ p- b  G
#include <linux/kernel.h>4 G6 B; J5 ~! w3 v0 X
#include <linux/types.h>
* f1 t6 E- A1 D+ A; z4 [1 e2 @#include <linux/gpio.h>6 d" o* H+ y  l& @5 f
#include <linux/leds.h>. d% c. Q9 R) H4 a
#include <linux/platform_device.h>( E3 w: J7 `0 l" L* W; K4 }
0 \0 t7 i( B" V. e0 J- w
#include <asm/mach-types.h>' T. N0 g, |5 V* K  F+ R
#include <asm/mach/arch.h>
- B7 k; q+ }/ g$ {/ t2 \* B' a#include <mach/da8xx.h>6 ]" i8 K/ W* R" P7 Z6 f
#include <mach/mux.h>4 `! E  y2 M1 ?0 n' _+ r$ f8 w
5 V$ D3 c6 Y! Z; ~1 v
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
4 X$ _$ a* ^, H/ w1 \: G#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)2 [( A& g5 e( s) t
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
1 s& ^/ {( K; A#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
3 z) O% v( N+ X4 M1 `5 a8 ?3 Q, t- M( U, I
/* assign the tl som board LED-GPIOs*/
8 R5 l/ f* u4 vstatic const short da850_evm_tl_user_led_pins[] = {
* G# m- ]' z% J0 o: M        /* These pins are definition at <mach/mux.h> file */& {8 ~$ ~8 y; }1 A& B
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,6 N7 ?% _9 C, Z, F! ]
        -1" m8 t: C( p  Z* X8 O+ C
};. A. S+ r3 d8 d& t9 P

8 B/ g) L: U  {' G7 Sstatic struct gpio_led da850_evm_tl_leds[] = {4 Z& K- Y( |6 m5 q/ o3 J4 H
        {* _' s: D" }) u0 f$ D) V3 y
                .active_low = 0,
2 J3 h% d. u4 N6 i6 a* {                .gpio = DA850_USER_LED0,
* j/ [5 O9 [& N. E( N! q( k                .name = "user_led0",. z) s: S' b2 }
                .default_trigger = "default-on",5 |$ r1 y0 l' O
        },
# g6 @7 K% S1 `- i) G6 a: E( N        {
0 c0 K7 C* T' S4 U- T% M& A; ]                .active_low = 0,
, u! D, w- P& L6 o                .gpio = DA850_USER_LED1,
. p8 N2 b) u& _  x3 b                .name = "user_led1",
5 j! \( c+ l  P; j  y+ Z                .default_trigger = "default-on",
# ]5 I+ x, }' W& G( s4 x' c        },. X; A: V8 _3 l, H6 f+ P% n$ C
        {- e& ^8 X+ N# B8 q% H- k
                .active_low = 0,
6 I$ B0 z4 C) Y7 M; a                .gpio = DA850_USER_LED2,
' K- ~' g8 T; x; s* J                .name = "user_led2",3 E( U. X* I/ {
                .default_trigger = "default-on",
. z  ^* V; Q  H- H        },: w0 k  i: x1 M! H0 Q' r
        {
' O3 k4 `( C  E1 E                .active_low = 0,8 H- c6 f3 I4 H9 `
                .gpio = DA850_USER_LED3,! g7 S0 p1 |2 u( s( E/ Z' p+ N
                .name = "user_led3",  o& V8 F: B1 m) ^7 b, ?, e
                .default_trigger = "default-on",
& C5 T3 ~, |8 @! V1 a        },. d* H3 s) w6 h5 J& _$ S
};
, A$ O" Q3 {* }: `4 S9 n0 H% P# d  k: Q1 U
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {' i7 b, A" m* s  S- M- `
        .leds = da850_evm_tl_leds,
% N8 b6 F. U+ R# X; q6 M; V* n. p        .num_leds = ARRAY_SIZE(da850_evm_tl_leds)," d! E6 R& A$ }2 E8 x
};% E  U' w& s! _# ]4 B4 m

: y5 s) R  `, I/ b) K5 Pstatic void led_dev_release(struct device *dev)5 \3 H8 \+ y; Q  `; U
{" [4 q' L8 s5 t
};+ v; v8 D. g. e5 I  f: @
6 y9 K; Q6 S" v- t
static struct platform_device da850_evm_tl_leds_device = {! P$ _/ Q$ V% z
        .name                = "leds-gpio",
7 T. P* B9 l- B        .id                = 1,
3 s1 j4 F5 H" h4 _        .dev = {
2 P6 o) q! o% G3 B! q' e& @0 g. F                .platform_data = &da850_evm_tl_leds_pdata,' H3 A, \0 v% G* @1 D% o
                .release = led_dev_release,: I' I1 F( R2 S9 D
        }
! w& R* C$ x, f. x4 r, P6 i};
8 t( ?& H" r. b- ~8 s- r9 S7 L
$ ~, [, T3 F9 A8 \) }8 P" ustatic int __init led_platform_init(void)
' c" T. F  V4 v: Q# h{: C; Q2 y3 j# L0 m/ Q1 u$ K
        int ret;& I" D* j1 C; L' p
#if 0# z' K4 h+ e' t4 Z7 k
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
/ o  q. G* A+ \0 a& j3 o        if (ret)
- O1 u2 R$ }. K5 T7 X                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"4 n2 I; H$ T. D5 k' \( q
                                "%d\n", ret);
4 ]( f) L; a) A/ T! e( v) m#endif
/ L/ a% _$ a3 B) ?3 b# w) ]$ M        ret = platform_device_register(&da850_evm_tl_leds_device);
6 T0 o0 `4 ~" H0 `# v/ [7 f& b, ~, ^        if (ret)4 F( i  F4 q* X. y5 P3 c
                pr_warning("Could not register som GPIO expander LEDS");+ A" F" _. l6 s" s/ Y
        else
  c; e7 X) H1 U7 B9 j1 O                printk(KERN_INFO "LED register sucessful!\n");
/ D, V4 b/ a; @, H& U# S- W7 J2 c4 O  E/ [" M- @0 k2 ^
        return ret;
+ q  s' P9 z' l1 k) B( g8 r% b}( R' y, N' L4 I
- V6 m3 e( e( J7 ^) j% w0 @3 F
static void __exit led_platform_exit(void)
: ?7 _, \& u2 u3 |3 |. X{
7 Z3 m' Y* U. `1 ?. _" ]1 g& `        platform_device_unregister(&da850_evm_tl_leds_device);
, d' |$ |1 k( @3 B9 `  @2 ?3 s" F
+ s( k* k- i) p) D: [9 g8 r7 V        printk(KERN_INFO "LED unregister!\n");3 r! n- c0 {  I
}) j: p5 K. q! ~) |0 J7 `  B  y
6 k5 B1 I6 }  ~, j% Y5 D
module_init(led_platform_init);
/ V# u9 s" P' k) Q7 q& o; U! ymodule_exit(led_platform_exit);
1 ], h4 D8 s* [0 e
3 ^: |: W5 B  @& {! j6 IMODULE_DESCRIPTION("Led platform driver");+ ]. }, n1 G3 g
MODULE_AUTHOR("Tronlong");9 B5 g* J7 ?' I/ b4 \, I& B
MODULE_LICENSE("GPL");
) w1 [. v0 v2 Y. v4 ]& u* N. d: D
& k! E$ {2 x3 L4 w9 ^% w6 V  D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 16:06 , Processed in 0.040651 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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