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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
- ~" ^3 o  b' z/ Y- J# i+ `+ T#include <linux/init.h>0 @# V/ |7 S7 G
#include <linux/module.h>
! J- A3 E+ E; K& I#include <linux/kernel.h>9 r) A% Y; k: |5 D6 F
#include <linux/types.h>
8 c8 ]0 C$ p- y' a$ p#include <linux/gpio.h>
, s1 s9 k1 h' u/ S9 a' Z) e4 G* A3 U& }3 C#include <linux/leds.h>4 `: h5 S4 q# R5 o
#include <linux/platform_device.h>
! e$ i: y/ [0 k* P: ]. W& V: n' n& p( E6 m  V/ J
#include <asm/mach-types.h>3 f( y2 u. q" |3 J) L, W
#include <asm/mach/arch.h>
# k0 F# ]. R* m: U9 r% |#include <mach/da8xx.h>- ?1 B* O. Z2 C: _' r+ c5 [
#include <mach/mux.h>5 \5 \! E- L) l2 w' Z
. q" r% K+ |5 u- `7 w
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
/ _3 c/ q7 z5 P1 J4 o/ J0 r#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)- q7 q6 }* [; s; o; x
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
9 M, K& ]/ m, S7 F' w$ E#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)- b, t! b4 Y3 U/ e0 ~  Z

6 f/ {' M& T3 i$ Z/* assign the tl som board LED-GPIOs*/
: p/ x1 \8 g# T" `: c" X6 ustatic const short da850_evm_tl_user_led_pins[] = {
2 B( y" P$ X' Y/ a# ?9 K% O        /* These pins are definition at <mach/mux.h> file */8 C  @5 P2 I9 t8 p. L8 H% W1 h
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
( b5 G- W# i$ v6 J' e) t, N        -1( r$ J) v1 v3 B3 o$ @
};
( J' j' w7 q5 d$ I
0 z2 K  E1 r& `. a) F* [& h& Lstatic struct gpio_led da850_evm_tl_leds[] = {/ a0 c0 _8 s6 E8 t1 ?
        {- R0 w; [. n+ R. P2 |
                .active_low = 0,
4 I% I/ r  |$ [6 v" ]- {2 b- d' n+ l( s                .gpio = DA850_USER_LED0,# X, P+ E6 k0 p0 u" j/ Y5 d7 F
                .name = "user_led0",. O: ^& V* b, _
                .default_trigger = "default-on",
; L) q4 W  B( i& l& U        },
$ g# B, ]" [! L" U' V. l        {! D6 S$ B6 t. _3 n0 |; S
                .active_low = 0,
- M" `$ T5 z/ h7 S                .gpio = DA850_USER_LED1,3 z: S2 Q1 h8 ]/ }/ ^
                .name = "user_led1",
' e' t: @+ j8 x: `8 [                .default_trigger = "default-on",
( l0 A8 u9 R% h) z/ d* H        },
% Q% }" g0 i# r/ {  x        {
0 @) f# O& L3 a% i6 U4 }                .active_low = 0,/ i) p3 P7 K" U5 @
                .gpio = DA850_USER_LED2,
+ A' ?  H" n" D; j- F% b                .name = "user_led2",! `: C6 z- ~3 n" u$ F/ {
                .default_trigger = "default-on",( V9 Q- q6 I7 Z$ u5 i3 x! B
        },3 a/ m# D) N- G' V4 K
        {7 W% i8 }8 L5 I- _9 i
                .active_low = 0,6 U' |$ e1 w. |% N
                .gpio = DA850_USER_LED3,
% [$ y4 ]: W+ t  @! {) Y                .name = "user_led3",' [, s6 X3 }0 y, W; I: n; {
                .default_trigger = "default-on",0 r1 ~+ h' H8 }1 Q
        },
5 Y+ D' F* r$ K" p' [2 v6 [};
( a* E* `4 i  z. |! t2 h! Z  j# \! w! Z! e4 V% p
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
; D& `9 A- m& ^        .leds = da850_evm_tl_leds,9 N2 c; ~* S4 }- ?
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
5 @% c, s" y( v) |};  K" R6 D) I. Q" _
# H( e0 _' e  B1 R; l, j0 Z
static void led_dev_release(struct device *dev)
4 E7 ]2 D9 v# V" ~9 }9 ]{
- V0 ?' n8 Z1 F5 D/ a' m, h+ C};
/ r: g! O/ m) `. _1 J# M) `3 B
2 }7 s. k9 E/ ]' d! C' \static struct platform_device da850_evm_tl_leds_device = {
  F& r! B# U3 S3 [        .name                = "leds-gpio",
9 q* x+ \8 i: ~# d, t        .id                = 1,
; n7 A/ ~( g6 V  t* W( H. W3 ]        .dev = {
% u+ B. _# ^, W5 J1 x+ U                .platform_data = &da850_evm_tl_leds_pdata,
' g' S1 L6 C# H3 X1 R: h                .release = led_dev_release,
. y: S9 x2 X0 T; @# ]* d        }4 l' ^9 |5 @3 h8 S
};' Y8 d) b( ]% \7 @
& Q7 s  x8 \' [/ b2 T
static int __init led_platform_init(void)) f1 \# J* Y+ t6 y1 M. t
{5 h# ]4 U, l+ n9 f& T; G
        int ret;
7 f1 A" [* A) b* E- V#if 0* K* P: U. N) L
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);+ B+ _' F& g) ^+ ?# f. J/ j
        if (ret)
6 S1 |2 |& p9 S8 S                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
' q1 }4 e( ^) W' g- W4 l                                "%d\n", ret);2 f9 a; I/ B7 |
#endif) X. ^6 h# _+ m  t. p. H; b1 b
        ret = platform_device_register(&da850_evm_tl_leds_device);
" E4 ?; p2 s" q5 \# h        if (ret)
3 Y2 S5 g: \7 F9 \9 _7 V5 k6 n/ t                pr_warning("Could not register som GPIO expander LEDS");6 ?& |  P! n* i
        else+ ~0 M* f5 R* L( r0 {
                printk(KERN_INFO "LED register sucessful!\n");
9 r( Z7 m5 ]+ m. c  A5 w4 V6 ]! |5 M& s
        return ret;9 s& {6 X  T8 @1 t/ {3 d
}2 b# e5 `& G9 g% ?/ y+ f' H- c

1 N# _! @3 e6 x% ?  \+ mstatic void __exit led_platform_exit(void)
$ T0 ?7 E' S) t8 z5 x{- w. l  C* h5 a* q0 O
        platform_device_unregister(&da850_evm_tl_leds_device);  L) O0 O/ ]- v; q3 [0 J

; V; L3 Q9 F- d+ j' o5 V, u        printk(KERN_INFO "LED unregister!\n");* z( [* h4 L4 X; f# ?0 m! X) d
}
7 ^( p6 ~: l; Z. D1 u, R% \: n4 s$ a! X; v, q! K
module_init(led_platform_init);
' s( {. E( R6 |* F) b" _& fmodule_exit(led_platform_exit);5 o. d0 M3 R9 }0 J) D! h
* x9 G, Y: ~8 n
MODULE_DESCRIPTION("Led platform driver");
4 R0 ?: B& `( x- |5 uMODULE_AUTHOR("Tronlong");
4 b6 {! ]& g! `+ O* mMODULE_LICENSE("GPL");4 q* J1 s1 ?9 R& w& H

8 m" ^* r% F* q) E. X9 K7 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 02:19 , Processed in 0.037992 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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