程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
3 u1 |& ~- T2 v" ?3 b#include <linux/init.h>  O3 \" b' H6 S; R2 j8 m9 V
#include <linux/module.h>
  e. q5 M: H/ N) G4 B0 S( f#include <linux/kernel.h>
! R2 J( [7 _. V2 C+ ~1 u3 k; J- G* A#include <linux/types.h>* M, h6 ?6 V0 v
#include <linux/gpio.h>
4 X3 Q) y. g0 o. e  M#include <linux/leds.h>6 t" r" d1 ^1 I' y
#include <linux/platform_device.h>) S! O  B" _4 k) F) e6 b0 h

& w* K4 b* |# G# L# l! |+ _! E#include <asm/mach-types.h>( N/ e2 x; a; b) O3 f
#include <asm/mach/arch.h>
$ o( {/ E2 i# v) c9 r- `#include <mach/da8xx.h>
" a& s6 V: d: N#include <mach/mux.h>
. D7 h8 x* C$ x2 F; P, ?/ h1 y: E9 P
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
: p1 Y8 e) p- @$ A3 z2 ]#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)7 @& o) j& v; f: K$ i% q; X/ V; ^
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1); N: D8 B3 V8 l" x' _8 ^1 G
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
6 z$ s; d( W2 X" R; z% n
* J7 e! q0 ^, _9 N) g3 l% q# N/* assign the tl som board LED-GPIOs*/
7 i1 I- S2 w/ g1 \1 f8 ]0 Xstatic const short da850_evm_tl_user_led_pins[] = {
" `% t% Y8 g+ k; s# ^7 ]3 t2 o% \        /* These pins are definition at <mach/mux.h> file */
/ ^6 g+ ~# D2 l0 ?; V. k* q        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
- l7 P3 }. Q) ~+ `        -1/ ]" G' a+ V0 ]
};" C% `; X6 C4 [

, u7 p4 [2 w* Y4 `! J9 q4 m: [8 \static struct gpio_led da850_evm_tl_leds[] = {
1 r0 k, Y6 k7 ^3 _( v        {, R. T2 s/ b, R( o7 u
                .active_low = 0,
! g/ R+ h$ U  b. _) V: x4 _5 s                .gpio = DA850_USER_LED0,& k  G* U9 @. i
                .name = "user_led0",
4 u/ [4 e7 b4 b$ ~                .default_trigger = "default-on",
- T( H) N- g9 }( W  M        },
. f5 i8 d6 a) @        {
2 ^& K; X% F  w$ a6 x) s                .active_low = 0,& A! f8 R# `2 t. R( h7 J3 v
                .gpio = DA850_USER_LED1,, [  \, u, ^1 {; M
                .name = "user_led1",
5 B& K; \$ j8 Y  }5 E0 P, f                .default_trigger = "default-on",
$ w8 V' i5 m5 q! u2 h        },# [# ^$ v/ l7 L/ \. T, Z- ]; ^
        {
4 q8 {0 A' g5 Q                .active_low = 0," W1 B# u" H; P1 }, \) t
                .gpio = DA850_USER_LED2,4 E. w1 I* S' e8 ^/ [
                .name = "user_led2",
: v! L* ?( ?' |/ q% l7 t2 N                .default_trigger = "default-on",2 s2 f1 _$ ?/ W$ q
        },, U* E& ?, U5 g1 X
        {$ ^  z* f/ O8 h5 ^# V: `* E
                .active_low = 0,; l1 z& m3 T. O  w! [% k
                .gpio = DA850_USER_LED3,' A  G) `5 k3 E
                .name = "user_led3",
9 O8 q. a* T' f' Q, @                .default_trigger = "default-on",5 C0 C6 W- x/ g1 t6 Q
        },5 A; m7 w' p! w3 D2 f
};
8 M' Y/ n2 X5 B" W$ r) c
2 D: E7 a' A, `! e, p& mstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
0 U1 S# a# [( Z; s) ]  u+ u        .leds = da850_evm_tl_leds,
2 g' V6 ^  V: S& i/ p# Q$ G7 f5 q9 s        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),' o. K# M$ M% [. y" q0 H3 E
};2 j+ O; i# h; S
# \  }# g: s; u& v. T
static void led_dev_release(struct device *dev)
: v/ k9 }4 w7 \! F0 J- O5 G{6 e% f. w- x' x5 k
};
  p3 G' M5 c' ?% ^; G
+ Y; W9 a& b) a$ b/ C# Nstatic struct platform_device da850_evm_tl_leds_device = {
0 s! R% |$ Q) x" x0 E        .name                = "leds-gpio",
! Z, _9 \( |  y0 }: a( _        .id                = 1,6 I8 p. C3 B. z/ C
        .dev = {/ L- e5 ^) T0 N
                .platform_data = &da850_evm_tl_leds_pdata,! N, ?: j4 _: D8 H
                .release = led_dev_release,
, ~  B) o/ o' X6 R# |        }* Z% F$ V6 n" L. q% ~% m0 _5 \
};
, d' J1 v2 i, v1 s9 h2 S$ f9 o8 f( {: K
static int __init led_platform_init(void)
% d5 ^+ m; w% W8 w# k{+ z! D" i5 t. [! B' c
        int ret;5 R5 K5 \' x4 W6 h! {% ?
#if 0% X/ T& l$ |: q# R2 B/ o
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);1 H2 p# q1 c2 v/ W$ R; a, k& d+ L- Q
        if (ret)
3 n0 b$ P: [" P% ]                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"( ?; s- t* w  e+ n2 ?6 v
                                "%d\n", ret);5 c( y& `0 c9 Q" B
#endif: h$ L% r/ C% _3 @, p+ m8 j( U& d
        ret = platform_device_register(&da850_evm_tl_leds_device);! r8 e; B5 ~' G2 X' u
        if (ret)
. ?8 Q: j+ Q' y                pr_warning("Could not register som GPIO expander LEDS");
2 Y' g0 X, k4 b9 y2 _, H        else! T& ]1 |$ C3 n; y
                printk(KERN_INFO "LED register sucessful!\n");0 W% k. t) F0 U: U1 {1 j  A

0 \  X" `% N4 `4 k7 W        return ret;
- a+ ~$ {1 k9 D4 i4 r/ N( ^}8 Y  \8 }+ L3 d

7 _( V8 Z' f+ K6 e3 sstatic void __exit led_platform_exit(void)
! W+ w+ }- U' z* L* a- `{
. g& k$ Q- q7 F3 Q        platform_device_unregister(&da850_evm_tl_leds_device);
# y2 `9 j4 A, [
" d& _! y) p. [5 s1 p" }( |        printk(KERN_INFO "LED unregister!\n");
: `$ G" G. y6 @  M6 X}
2 J6 }! O3 \( I- Z( j+ S5 g9 ]6 L$ r( @: {& s6 S2 p
module_init(led_platform_init);
' E2 ?: Y( R3 r' [8 L$ w+ emodule_exit(led_platform_exit);3 s- r% d. e  Q$ w- p
' D# L8 A( g& |; h( C9 W
MODULE_DESCRIPTION("Led platform driver");# h- f0 e) t6 N8 G5 {5 X6 N
MODULE_AUTHOR("Tronlong");
/ X7 O2 d* }$ O( g. s6 i( {7 n2 dMODULE_LICENSE("GPL");
6 y( o" d9 a7 O% J% w, ?7 `/ R/ s4 t! Z1 i$ u/ G$ v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 07:44 , Processed in 0.038559 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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