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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。1 ~$ G: r' e" X& P' d  |
#include <linux/init.h>
# |+ [3 \  d7 k  ^#include <linux/module.h>
2 M  j- I+ x- D1 t1 m#include <linux/kernel.h>
+ T- q1 X. g+ V% I6 d' }1 Z- j#include <linux/types.h>
; Q2 |" O/ t% |) a& V' {, h#include <linux/gpio.h>6 I% t5 m$ h0 w1 v+ V( ^8 u
#include <linux/leds.h>2 ^/ x. Q- ]! H& q
#include <linux/platform_device.h>  W2 r# b9 |: p: U6 T
4 n# H4 [$ y; I
#include <asm/mach-types.h>3 _% G, z0 C( ]6 K# y$ C1 B) \
#include <asm/mach/arch.h>" l- k5 u% O! V# t7 |9 X
#include <mach/da8xx.h>. X8 `$ _/ g0 ^, Z& N6 ?( x
#include <mach/mux.h>* q! ^+ l4 S7 H; f. ^; y- G

5 h) g+ h9 b- E4 a  V7 E( m9 j9 t* ]#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
+ e( I  C' P5 }#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
9 h$ M! k# I6 \% `#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
8 k1 ]# ]1 f! @  ^  E. ~; k4 V/ M#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
" _$ N" I4 k& V/ b
, @, J8 e! W3 l3 e0 ?. G: d/* assign the tl som board LED-GPIOs*/
4 V! K2 J8 ~) P+ M% Q8 W; u; ystatic const short da850_evm_tl_user_led_pins[] = {+ B; B) p" Z  e; A- o! k
        /* These pins are definition at <mach/mux.h> file */
* a# J: O9 v3 B6 z! M/ T0 S        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
3 n5 F! w, F* o7 a: Z        -1: q3 l# Y6 P7 l2 [* L% ]
};
$ K: i( j  ~1 j2 X0 U/ U0 p1 g/ k; O5 [% O
static struct gpio_led da850_evm_tl_leds[] = {
5 L2 j6 t) @* [9 V        {+ ^* d9 R" `. K( O" f) a
                .active_low = 0,, g; p4 e, h# i* f1 G6 }3 [
                .gpio = DA850_USER_LED0,
$ W9 b) n" d" L- d4 M% X                .name = "user_led0",% H: s5 `2 L' A6 L
                .default_trigger = "default-on",% I6 R/ |2 P+ Q5 i) L) i) P2 ]
        },3 \( b+ Q! l9 ~1 u
        {" B  E& R5 M/ z9 w
                .active_low = 0,1 _9 j+ }! j/ a- g8 S) w
                .gpio = DA850_USER_LED1,
$ Q8 z& Z" o9 s8 f0 K9 \6 b                .name = "user_led1",, T3 l* E' P5 V
                .default_trigger = "default-on",( N# Y: l8 Q0 x, _
        },- W3 Q5 Z4 N' j. R3 F# O8 V
        {
+ m& L! Z! l1 R8 A7 T  o: a$ i7 v; l                .active_low = 0,% I- w- X" s- _) d# G# w6 Z% c
                .gpio = DA850_USER_LED2,
# _! C& j" c7 T  u                .name = "user_led2",7 H- q. T1 j* ^+ k, _
                .default_trigger = "default-on",
5 ~% F- Q1 X6 `5 i8 t' x! T7 }4 [        },
$ |$ _& X9 N/ s7 s& Z) m: q        {
* {- D% G: v8 {                .active_low = 0,
9 J5 M$ M$ p1 n+ c& B; J                .gpio = DA850_USER_LED3,
3 ~, x0 @! x% G- P. E6 B1 O5 z% j  G                .name = "user_led3",
- L: m1 s7 b6 ^                .default_trigger = "default-on",0 K9 ^$ [) C5 Q( b
        },
+ f% d( `; j$ a: R6 q1 Q* |};1 W+ W% Q4 c& v8 x% j& @; m
, |$ o. I# l& D9 P6 S
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
8 g; |; ]/ ~  n# B4 M        .leds = da850_evm_tl_leds,
8 B9 X" ~- T5 U6 u/ \' A+ U2 {9 c        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
4 ^' b5 n) c  ]2 O* p/ x; G: F};; A' y( A1 \* g6 @6 E
9 P6 d" o8 S, R1 P; R
static void led_dev_release(struct device *dev)% b$ ?& D( S1 {7 {5 P  C$ [
{
9 U' n! M2 M8 {9 _2 y: _1 r7 H; W" G};
; n: f/ C& i4 C2 M" l2 k4 V2 P( A; {( f8 I
static struct platform_device da850_evm_tl_leds_device = {7 ]1 p0 k, v. J7 t
        .name                = "leds-gpio",
( y/ E3 c$ V) L9 m* o        .id                = 1,5 d+ N+ p1 t' Z
        .dev = {
# q6 B. [) {) U; X# M. m5 f                .platform_data = &da850_evm_tl_leds_pdata,8 |3 i3 o: y  k+ f
                .release = led_dev_release,  D6 g% q0 z* X' D) x
        }" _& l" U5 M- V& v) H3 {7 x
};
1 C1 s6 x1 A" R# n. u% {. M: Q$ D
: P3 ?' j) X, y6 I) G% A' E4 kstatic int __init led_platform_init(void). D2 [# b/ g7 v6 y0 @7 z  R
{
) F2 `6 K( P# u* _* W        int ret;2 c: y$ _& Z3 C+ Y; T
#if 0
9 f! r. k5 x" ]; W1 o% K4 H        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);8 J2 q0 s  ^6 |
        if (ret)
, ?; h, i/ {9 {1 E" N                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
2 F. J& Q: a$ J0 c% r. q6 A                                "%d\n", ret);
9 B# S2 q  t; g#endif
7 o8 A8 m6 l, P! u. a, K. n        ret = platform_device_register(&da850_evm_tl_leds_device);* e6 v! W& w8 s2 y( z3 b  A( d: U
        if (ret): t: @8 Y5 I" W1 s+ ~* |) f
                pr_warning("Could not register som GPIO expander LEDS");3 l2 i$ ?7 X! ^. ^5 U; N
        else
3 |+ V& y1 ?1 h; m1 p2 H7 p8 b                printk(KERN_INFO "LED register sucessful!\n");2 _& d: u- y) `
5 D! D4 c  k2 o4 E. i% R# ~" I
        return ret;
2 @! U2 R2 `! O1 C# p}) ~& S$ q$ M1 v6 x4 I( d( l
8 v. @: \" T( Z8 L. F% ?9 m
static void __exit led_platform_exit(void)5 C3 h" |: L2 R& n6 F+ m( R* U) f
{( K. H* ~2 d  S( s5 V  ?. o
        platform_device_unregister(&da850_evm_tl_leds_device);
" c# `, w+ g: h# M: a2 z$ f6 v" U& h$ i6 @6 D5 y
        printk(KERN_INFO "LED unregister!\n");6 b5 f, ]0 L, g. s
}
+ I3 b4 k5 O( A* o" O8 H, T8 Q0 Y3 R' `
module_init(led_platform_init);
' o, D; U0 R+ C2 {5 n+ [& `module_exit(led_platform_exit);4 @( l5 l# r5 [; X1 u

& _8 F& Q7 i9 A( M; ~; |7 UMODULE_DESCRIPTION("Led platform driver");: t  p+ `3 G! K9 Y: F
MODULE_AUTHOR("Tronlong");+ ^4 T" |* [( N& S  t
MODULE_LICENSE("GPL");
7 ]( |) \  Y3 {- B  Y$ P  x; e
0 I) p- g. m9 x! d, k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 18:12 , Processed in 0.039924 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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