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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
6 F  H" X2 {% [% v$ m; v#include <linux/init.h>
+ d- u( N; ]4 `/ B( F6 d! e5 f#include <linux/module.h>) ^0 H+ l& M! t1 F- n
#include <linux/kernel.h>0 h8 `3 b. B9 p4 M' I% a  c; u! ~
#include <linux/types.h>
2 p( w  t4 X1 U  U+ j+ i5 D( f5 o#include <linux/gpio.h>2 N! E7 Z! B  }2 _+ V
#include <linux/leds.h>
1 J4 p9 n& Q$ [# l. ?#include <linux/platform_device.h>
- }1 |$ S6 x$ k" S1 D; M1 I
$ Y: m: j+ W0 O) c- u4 F; H#include <asm/mach-types.h>$ k  T& U& y+ ]+ B1 _+ K
#include <asm/mach/arch.h>
9 E$ z$ Q3 p0 m6 z% o( P' S& \' s1 [#include <mach/da8xx.h>, ^0 m0 V) E" E, U
#include <mach/mux.h>
. \0 i& v- h6 b; L& ~
3 w3 h+ m3 [# U% X#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)' M, \& g; V0 Q9 L7 a' @2 x
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
( A7 ], B' M0 _+ [7 \# J( r3 f( T#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
! f, o; }0 x/ L% i4 g#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)5 A" ?" ?  ]$ i) [; P

4 {" @% L7 y! I8 R1 c, y, O- G- ]/* assign the tl som board LED-GPIOs*/
+ ]& k6 M; R: F4 |- [static const short da850_evm_tl_user_led_pins[] = {1 x" {$ ~- w+ W" ]5 z: ^
        /* These pins are definition at <mach/mux.h> file */
0 w, }$ A0 N' f9 g7 V  g& d8 f* U        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
) Q6 k+ R; \; u4 e! E7 h. f  g/ m        -1
/ F) N& \* G- V, f' A% s};8 T' R  I" q5 x8 c8 G- e/ D

+ H2 b+ m' y/ ~2 ?8 \7 c% Tstatic struct gpio_led da850_evm_tl_leds[] = {* i+ i. G  f5 M9 S' M2 a
        {+ o/ z  s3 S+ g/ |) c
                .active_low = 0,. c+ A, p5 S' R; s+ \- c
                .gpio = DA850_USER_LED0,
4 _" C8 o. ^; r) _6 ?                .name = "user_led0",
2 y" O6 C, V+ y! \6 W- f3 Y, w. e                .default_trigger = "default-on",
6 T8 E. }; G8 H! t' E        },% F) u. O& _0 O" B( E
        {
( j/ j2 E# ^5 x. @! L: n                .active_low = 0,, G* a- P) n' W
                .gpio = DA850_USER_LED1,6 I' C  U: d& ^% V1 Z
                .name = "user_led1",
. }( g. }1 D# V: {  `                .default_trigger = "default-on",  I3 s, a% t) P, Z- g* q, n2 z
        },; u9 b5 \% |) L9 }' t7 ^
        {7 v" c, n/ K& b0 D% F4 A& _
                .active_low = 0,
# O% n* L& E. a# m1 X" F3 H4 f                .gpio = DA850_USER_LED2,7 K: _% i4 D! s: I, v+ ~: p; ~% Q& }
                .name = "user_led2",( K) b5 d. n% t3 k2 b
                .default_trigger = "default-on",
* p1 _2 i2 [0 l: Z* M- i        },
( k4 v: k3 J. n/ [) c. t        {
, u/ d2 u0 b# k$ }; b                .active_low = 0,3 b$ I" D. @: {6 q! _- R+ B
                .gpio = DA850_USER_LED3,
1 m8 D" O0 m. N1 O* R# [. o, G                .name = "user_led3",0 i) u3 z6 ]+ Y
                .default_trigger = "default-on",
: U- P$ _4 i; O" d2 ]/ i; R0 N        },* @8 m# d) N( D& R3 w7 ^- a
};
: s/ e$ f9 n' z$ G, H# y8 \: y' e0 z# T
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
; u' s4 G" C5 m/ ^' v* ^8 z5 @        .leds = da850_evm_tl_leds,+ |# e- C9 U5 A
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
2 S" [1 @  n7 }- V};
  `# q# F' h, C* w
* g* C6 ^7 B  D/ ]$ J+ Ostatic void led_dev_release(struct device *dev)& U8 F/ ^  l6 y  X% v
{
: `0 o. A3 e7 G" L6 C  b};5 U, A8 v& E7 |$ E: |6 V6 p0 n9 v2 w
$ R) K' T; C' Y% K3 E4 |. c8 I1 _- t
static struct platform_device da850_evm_tl_leds_device = {' r) f- j, U% p  ]! P. P. P8 q$ `5 A
        .name                = "leds-gpio",+ \/ _$ J% }3 M/ ?  D& Y  x
        .id                = 1,
4 {7 m2 I5 L  A% n        .dev = {
- p4 @; X+ x, k7 C3 D& z                .platform_data = &da850_evm_tl_leds_pdata,
. g$ |( b& @4 J3 C6 \                .release = led_dev_release,
  {& w) J# L+ x4 _5 W        }& K: \8 L/ U6 j2 C
};
/ _1 g  u. {0 h7 r1 i- S
! W; t+ z5 N, a) |: ~. @: b# istatic int __init led_platform_init(void)
5 v' D7 [7 z3 c{
5 P- F9 H& S, F4 e, T        int ret;9 n" {! i+ w5 _; A
#if 0
6 }, `5 `7 D" T! A        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);0 e7 Y- p3 G8 |, G8 F2 x
        if (ret), B. N; T- X2 e3 w
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"8 Y/ _1 M1 c+ }8 W' H, C- s
                                "%d\n", ret);+ R8 X$ a  }8 [4 Q( K% n
#endif% _/ Y- u/ _# k% v
        ret = platform_device_register(&da850_evm_tl_leds_device);
) h# g6 v5 i* l1 \  a. t        if (ret): `' p+ v7 S0 @, p9 _1 x( w* d
                pr_warning("Could not register som GPIO expander LEDS");  t' h7 B+ S6 e* v! K$ l2 j: R3 G6 D
        else8 e- z# m: }! X& {8 _, T
                printk(KERN_INFO "LED register sucessful!\n");
; g2 u. @1 E4 g" Y, U, b- I4 \4 m  A
        return ret;- m0 R4 J% h( A/ I  w3 z: t
}6 [1 S/ A3 w1 ]  f0 P1 S

5 w4 ^1 {7 ^* }; xstatic void __exit led_platform_exit(void)5 m7 p% _( w8 a# J. E5 J
{
4 j8 O% N/ g" u        platform_device_unregister(&da850_evm_tl_leds_device);
. n! @6 b/ O" s. g6 a6 E. V  _: w' O
        printk(KERN_INFO "LED unregister!\n");
4 d# D. ~' ]( ~, H% `& A/ |) R9 e}- b) U# c9 N5 m( D- k7 O% r
9 X2 J1 p( {4 ^3 \! L. G
module_init(led_platform_init);
5 }( ^2 B3 @& @- Z$ ?6 v7 b& zmodule_exit(led_platform_exit);
, J  @6 q2 G0 w& E1 t) ~; K# B* F# v9 `8 M
MODULE_DESCRIPTION("Led platform driver");+ u6 ]) k2 B) p2 \% `  L
MODULE_AUTHOR("Tronlong");# O" Q+ ?* W1 U6 T
MODULE_LICENSE("GPL");3 B" K- y' l+ g5 D3 P
% j3 M" D3 a' R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 00:08 , Processed in 0.039663 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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