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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。" [; O8 _+ E4 H2 y/ V, \9 j
#include <linux/init.h>
' T5 U/ [9 Q. D6 p#include <linux/module.h>' r$ `4 x: D$ c+ ?+ Q9 |+ d
#include <linux/kernel.h>" V, v' Z$ w/ O9 }+ [& |
#include <linux/types.h>8 N( A  [/ W! z* c1 R& H
#include <linux/gpio.h>
, _7 Q- }# Q" g& j9 x+ g0 X' B, v#include <linux/leds.h>
/ v% M! d0 M3 q#include <linux/platform_device.h>
) y% X4 V; G  `2 p, x/ r/ T+ P7 x- T% ~/ l1 w
#include <asm/mach-types.h>
3 q+ e4 g4 z4 P& I+ p- x- U#include <asm/mach/arch.h>/ N& d, t& J. [  ?# S# d$ ?; u
#include <mach/da8xx.h>( _, k: L" u9 \0 p5 J+ K) }% ]. @
#include <mach/mux.h>
) Y3 p0 E6 T8 F1 Z  H9 M* ]+ u( v
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
; c/ Z3 }  S# p2 i: {#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
$ U2 p$ j8 _/ u) }' t1 M& J#define DA850_USER_LED2        GPIO_TO_PIN(0, 1), K* P4 O8 a8 Z0 s% _
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
+ d. q1 T  y7 y9 z' R$ |9 D; v, r, }: C' J# D
/* assign the tl som board LED-GPIOs*/
! y6 G& Y5 |% [$ ?0 ]$ w9 Ostatic const short da850_evm_tl_user_led_pins[] = {" O+ f, R) l6 Q5 W1 n8 Y
        /* These pins are definition at <mach/mux.h> file */4 j# h1 M7 N$ E0 V+ e
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
; Y8 U* P/ t1 r8 N/ i# m        -1
# C+ \7 E- ~/ J8 j};& p5 C; a" H) T/ e! m, O
  j2 F4 [+ ]: j# u9 M
static struct gpio_led da850_evm_tl_leds[] = {
  D6 @) s* A) c1 j# G        {* c( K4 C# ]7 {6 w- i! W0 l# R+ X
                .active_low = 0,
# v$ L; b* o, Y. B$ N1 O! R                .gpio = DA850_USER_LED0,7 M6 s8 A( B/ U4 j2 h2 i
                .name = "user_led0",1 V; I. w6 y* y3 c5 o! Q, |
                .default_trigger = "default-on",
, e2 e7 o8 [$ a        },9 c- I/ Q  A$ s6 b8 N  k
        {
# i) r# n+ j. L; q                .active_low = 0,, }6 F2 p, n; R3 a9 y8 P
                .gpio = DA850_USER_LED1,  Y6 J8 q: w5 J8 \
                .name = "user_led1",1 M) r! V# c+ Y
                .default_trigger = "default-on",
5 L0 ^' o1 e" U6 _4 ~; ]  _        },
9 D: N% B& S0 S; Z! w/ j2 j        {$ w# X5 d' f% C) s' g( q
                .active_low = 0,
% _7 f8 m* I7 v+ m# J                .gpio = DA850_USER_LED2,$ |6 o4 p. `, e0 ~
                .name = "user_led2",9 T5 `# |; r2 P- n
                .default_trigger = "default-on",# y5 s5 u. ^" i( Z3 H
        },1 Q% c5 B: h9 }( l* U6 e( U% l
        {
; g/ `/ N8 _2 |4 Z                .active_low = 0,. L, }2 `2 h1 c  Q  w0 N) q
                .gpio = DA850_USER_LED3,3 a5 L& G4 Z5 E
                .name = "user_led3",  i" k+ d% l# _3 Z  H; S1 b
                .default_trigger = "default-on",
8 O# [$ m4 V! O% \3 s        },- B- X# i, Y' C# J% B& {% w
};7 E6 t# L! Z- B# [1 P0 @1 ^2 k

5 }2 v8 p" G# Z, p* Istatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {& f! O$ B* W' I' C% Q$ J
        .leds = da850_evm_tl_leds,' F3 ]0 @. _" e' L
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
1 J! k7 \' e$ t  g/ \1 M! l3 R};) B0 y2 x+ S2 p4 g" c# B

2 I. Q7 q$ c3 x9 ~6 Estatic void led_dev_release(struct device *dev)1 ?" T$ {0 t/ b+ c
{
9 T5 Y$ ~/ N9 [; d+ M};. k& s3 F# n! ~% H
9 A' }! a# k8 M& `! \6 ]2 d& A9 }
static struct platform_device da850_evm_tl_leds_device = {" [% v' w2 r$ v* k  b( k' S
        .name                = "leds-gpio",2 Y% w- b9 y& ]0 b7 w1 p' Y% E
        .id                = 1,! F' V' s/ r% [& p8 W
        .dev = {
. c/ S' @- ^9 n6 P- F- w                .platform_data = &da850_evm_tl_leds_pdata,) w& ^8 Q3 o- t0 {' `% j) q
                .release = led_dev_release,2 S; f* H% F# ^6 [" w. q) ]
        }, i' H' L4 Q  f8 u
};
: Q- T5 n* p) X# o; G0 [: V1 [3 `$ Z( n: A- Y4 s
static int __init led_platform_init(void): n# V- ~( x( q- L5 ]% G
{
8 x7 h# F% {- B" V' i- Y  R4 R/ ]; z3 q        int ret;( y6 M  `. }3 U& W# d
#if 07 |+ |4 D4 m, d8 U* b
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
2 O# o4 r  r; _, d+ S        if (ret), U3 ?* Y, {- V8 G
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
( ?0 V% J3 [& ]' |1 R* Y( s                                "%d\n", ret);
! C1 {/ ~( M( i( g#endif
8 t. @- B; I2 ~. a+ w        ret = platform_device_register(&da850_evm_tl_leds_device);
; K! U2 ]. U2 }4 |        if (ret)
0 W  ?& K7 W1 ]                pr_warning("Could not register som GPIO expander LEDS");$ R  p2 W6 u, a8 ?  x2 ^' y% \
        else
9 j3 R4 u6 V$ E) G2 D                printk(KERN_INFO "LED register sucessful!\n");
6 Q1 Z( `' m! \! l8 y, \; N6 ~
* ~" g' E: u4 w$ Q6 v+ `- g7 b        return ret;" {( x% F9 c2 i! K7 d! x
}8 p) z, q" T6 G) _7 n% y

! E( }: s; _4 h! O* ]9 [- Tstatic void __exit led_platform_exit(void)
/ U; U' C: C% x, H. u  u- b{
6 g' o# F1 `2 w. v4 N% ]        platform_device_unregister(&da850_evm_tl_leds_device);; G& [! M1 Z( B7 z6 D5 [

# R, p$ Y+ A) f- n% n' q        printk(KERN_INFO "LED unregister!\n");
# H$ R0 y" |. }. J1 j: ?}
8 ^! a- b! \$ q% e. L0 o" x
4 a% _( ?; n% J9 `. Bmodule_init(led_platform_init);
& W# t; x, }: f1 W6 D. L2 a9 N. Nmodule_exit(led_platform_exit);
2 g- y$ f0 q  k* ^
( v7 g0 R0 X2 a3 q. yMODULE_DESCRIPTION("Led platform driver");0 f( h8 s' w/ Y* V% Y( b; {  U: I) @
MODULE_AUTHOR("Tronlong");
( j! Y  x; T: l/ ^0 jMODULE_LICENSE("GPL");$ V4 y, P: J. c* D+ d8 w5 L
4 J: m. Z5 V( j+ F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 10:58 , Processed in 0.037441 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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