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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
: p2 s/ u9 f7 ]* r/ @- {4 U' _/ a2 T#include <linux/init.h>
9 F' n1 k6 O; Z  ^( y4 W+ P: J#include <linux/module.h>3 n5 G) r$ f( H, }# i! v
#include <linux/kernel.h>" ?+ L- |% ~$ H! [& Z. U& L, T
#include <linux/types.h>' ~) W; z* `2 t! b8 g1 S* l
#include <linux/gpio.h>" `7 N$ n4 V7 j- X( T4 v8 z7 T
#include <linux/leds.h>  z7 U8 ?) S$ Q3 d8 Q2 o
#include <linux/platform_device.h>
, p# X% |& @# ?/ L1 K. _( U6 P; x
#include <asm/mach-types.h>' P  X$ [- S, w
#include <asm/mach/arch.h>
* [/ n: c! W) C#include <mach/da8xx.h>1 t& i8 k- O; ^4 C8 J
#include <mach/mux.h>) l0 h' \, h% n. A( I, Q

2 R2 u! C" h/ C- p0 u  u; _#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
) ]4 \  l! Z) w! @9 e3 W#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
) Y: c: J1 E- w, N#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
$ l, X! _. \. @7 {/ r( s1 n# L#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)" u; ~' B3 B9 X5 ]' ~' ?" b) V

0 f. Q+ b, y* r: ]/ b/* assign the tl som board LED-GPIOs*/
/ o5 }3 U( b3 v7 P  q+ nstatic const short da850_evm_tl_user_led_pins[] = {
$ x* v3 k' L& z1 \1 ]        /* These pins are definition at <mach/mux.h> file */3 D  T2 U0 f+ q% {
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,( `  i! \  \8 b# N
        -1! G. D+ z9 G: _+ l# @
};
% Y8 D. L# t" v
5 h/ ]8 {5 b) W6 I( nstatic struct gpio_led da850_evm_tl_leds[] = {
. W! ]* e% Y$ R# p5 V6 ~        {( [" f3 D# t# d. V- p# K/ c
                .active_low = 0,
1 l; ]5 `1 S- a/ u  C  A  l2 |  ^/ i  t                .gpio = DA850_USER_LED0,
2 |/ t2 [+ V+ \, j) k                .name = "user_led0",
8 b- k$ k1 |, J8 c. y( Z                .default_trigger = "default-on",  f5 x/ d( R  d. ]
        },
# p5 a! Y. A/ o0 Y/ ]7 `# z" Y        {: F" {& E& s* j0 g* ^+ _% h
                .active_low = 0,$ D, c6 [4 P* t9 z. C5 b$ l
                .gpio = DA850_USER_LED1,8 k% a) A1 X1 F! J& q( [
                .name = "user_led1",
4 J9 c1 u& [5 S: Z6 m. |( z                .default_trigger = "default-on",6 z) H+ c7 |! y
        },* K8 \! G3 p$ y
        {, U5 I9 z1 D# F- O$ P5 L* w
                .active_low = 0,
, Y7 c; P' h* B2 B' m% }                .gpio = DA850_USER_LED2,
4 j1 s  s" r' d' M* d                .name = "user_led2",
# O0 `0 B& u! n7 F) R                .default_trigger = "default-on",
9 S2 q; U7 M1 E# Q7 H4 i, r        },& g5 j' |/ H7 Z& h8 `  ^
        {
& s9 _$ Z8 u4 x4 R3 J8 C                .active_low = 0,4 R. b) ?# L' z3 C% X. z) R; y
                .gpio = DA850_USER_LED3,
: j# y) ~; N7 Y5 S' B7 ~                .name = "user_led3",
* s0 e" H  A4 y; Z1 F) l. p                .default_trigger = "default-on",
: t9 E6 N1 j. J+ [; V7 U! B0 c* Z        },. u* H2 ]1 q3 E9 L  E" c. e
};
1 |) g, X/ s% x* Q0 i  _7 \* f4 B( _
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {' w7 q' }8 \  f4 Q; b+ n* @
        .leds = da850_evm_tl_leds,9 j) O& h7 _2 N! u/ h
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
' w8 w. O% ~  ^1 b# l};( T) ~% I' h- ^$ {

( C1 F8 Q! W, o  F3 V) hstatic void led_dev_release(struct device *dev); v9 z  G+ `- M  T& K: d5 |& c* X
{- m) \) q" L6 p& w" y9 i
};' q% J' D! ~& Y& b5 X2 Y! I
+ L0 C9 p. L3 y" R: K; Z
static struct platform_device da850_evm_tl_leds_device = {
$ b% m0 x. ]$ O# ^        .name                = "leds-gpio",
4 \0 x2 b" R/ K0 {        .id                = 1,6 ]3 J) b) A9 h
        .dev = {0 [0 k( R/ H8 ~! i% M$ n, |
                .platform_data = &da850_evm_tl_leds_pdata,5 x8 P& \; Q+ j
                .release = led_dev_release,9 s- h( j! X; x9 t- {3 X, F
        }
# J' A4 P) ]: N. E1 x" ]};0 }9 Z( z$ Z* S' D. `% r
: P% X) L  d) D, i' f
static int __init led_platform_init(void)
4 n. c7 n/ u1 r( d. A: J{9 `. W  @9 `) u& j9 n& c3 d
        int ret;, A9 `+ U% w" h+ {. d
#if 0
& H; k' @4 L$ U1 d1 c        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);1 b8 @5 l' `  A: [
        if (ret). I; \9 R! t) G  S
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"; V, F+ g" j, `. z3 ^
                                "%d\n", ret);
* B1 v5 S% x$ r# K; I7 R" a: A$ v#endif
2 x5 L/ v6 ^3 P        ret = platform_device_register(&da850_evm_tl_leds_device);
* L3 ^- B: A3 x3 r9 T* A$ m3 l4 P        if (ret)$ ?, D; b6 T5 Q  v/ \
                pr_warning("Could not register som GPIO expander LEDS");& V9 t9 s  t+ H8 T! i& y
        else7 l9 R7 G- C- a& A) U  A
                printk(KERN_INFO "LED register sucessful!\n");8 ^0 Q& D) K0 F
4 H9 f( ?, H8 V: {9 s6 @
        return ret;: @/ I* _& g: _$ L
}
& y; j# ^2 h; ]' M, C6 f- y9 J1 ^% M$ O, e$ `0 \
static void __exit led_platform_exit(void): R, W+ N2 g2 V& n% }) r
{
, k* l( }: F) l1 Z        platform_device_unregister(&da850_evm_tl_leds_device);
# L" N7 t6 T( U- t
- _' o# x  s% a( {) R        printk(KERN_INFO "LED unregister!\n");
1 C6 j" R- u1 f- @1 ], @( b}
$ G$ d+ \5 u# c1 v
& b; b3 H( H) ~module_init(led_platform_init);, T2 C- b, o% u$ _; u1 L
module_exit(led_platform_exit);
* A6 K* r8 g3 b. |( q3 O
9 {. t5 F/ U, s+ p; o( s8 }MODULE_DESCRIPTION("Led platform driver");1 F! d, X# ]8 C0 \( i: k
MODULE_AUTHOR("Tronlong");6 G* q6 n1 g  D5 P
MODULE_LICENSE("GPL");" Z7 @3 a0 p# x$ j0 s# M

: p" R9 B6 O% h5 v: n% {; T# c* D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 02:21 , Processed in 0.039782 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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