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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。: \7 E9 A* F% K2 }: L" u$ E- Z# |' e
#include <linux/init.h>, l) g" P/ w4 j! s: |
#include <linux/module.h>
* i  w) D" f, p6 x1 U% s6 x+ G#include <linux/kernel.h>
8 E# i( w. B; H7 [! n+ D* F#include <linux/types.h>
) Q% E5 y# n* @' _  `& H#include <linux/gpio.h>
5 ~& k( x  Z1 U( m0 |5 i. G5 k#include <linux/leds.h>
* m; o7 ?6 w0 Q6 r#include <linux/platform_device.h>" _8 }. h% N- J' v4 |& l# w. J
, e, H, o+ P/ V$ ^0 s
#include <asm/mach-types.h>. r; T, U% p' Z: d+ M  n" ~
#include <asm/mach/arch.h>, f' K. f; W, ]9 A, j. ]( n, o
#include <mach/da8xx.h>3 H  `0 m: e8 U8 {- l) u7 g5 U5 y( E
#include <mach/mux.h>
6 n7 _7 _  T  u; o( ?* ~% c6 Q8 j* e
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0); V; @8 m9 I, T. ~" A" o5 W* a6 h
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)6 o* i+ Z) U/ n8 E! ^
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
0 }9 v: C9 p+ i4 r#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)  @" T, x* X6 O0 `6 V
' v+ }" T+ u, w: i, U8 k
/* assign the tl som board LED-GPIOs*/
) t5 S5 ?5 }& T$ A% Zstatic const short da850_evm_tl_user_led_pins[] = {3 @; C- L3 |* ]$ r6 m, |
        /* These pins are definition at <mach/mux.h> file */
4 N6 P& R& p9 y# _* ~, P        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,6 c8 ]& j/ M  ~- c5 U3 W
        -1' ?% F, Q. t  c
};8 y/ J' d! ]8 A( t* A7 @
6 _/ V+ }7 M" Z0 r) h
static struct gpio_led da850_evm_tl_leds[] = {% c8 {' p1 @. A5 X6 t
        {
1 d) Z- ]& _, {                .active_low = 0,2 W* I! S) _; S: P8 a4 K* P# B# [
                .gpio = DA850_USER_LED0,8 K/ a% l4 ?2 R* ?
                .name = "user_led0",
7 A% X# l& l3 K                .default_trigger = "default-on",
* }# i: G" G, l: c4 s0 ?        },
; f. e5 h0 I' L3 w% }! n+ [  l        {7 Y2 K4 P* J+ E
                .active_low = 0,% P* W' V) z" q2 q, x; H2 X; B
                .gpio = DA850_USER_LED1,) P" E9 l( M) @6 j- V) c
                .name = "user_led1",
6 H' P# D4 R8 @  X8 S7 q. l                .default_trigger = "default-on",/ u. H6 F6 P$ U3 l, b  D( t* _, H
        },
5 f7 B$ X7 c3 f4 ~( X3 t% \        {- s6 m+ ]( N5 U1 m) p
                .active_low = 0,5 S( ^6 G( S% U) d" F+ H  f
                .gpio = DA850_USER_LED2,
/ i6 N5 u/ G4 m/ S% ?                .name = "user_led2",9 J# h& P7 j, F
                .default_trigger = "default-on",$ u) Y  b) |7 O" A/ T
        },
, |' I, U9 O( }/ y) Z" j# j        {
. u( V8 C1 `5 u; p2 E! V                .active_low = 0,/ R: X$ C; C4 Q# [9 ?. v8 j
                .gpio = DA850_USER_LED3,
0 t2 Q1 X+ o0 t# i                .name = "user_led3",
6 [7 D% ?) \( L- U: e5 x                .default_trigger = "default-on",
/ \3 h7 {: O) ]% I, ?3 ], f) _        },8 H. B' D' M# X7 O2 \
};' j0 v8 n+ A1 o. A( H
, M# ]8 [- l, R! J" t% e/ P
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {. z2 O+ h, m. J/ C% |/ C
        .leds = da850_evm_tl_leds,
# w+ Z7 L7 X6 |7 ~5 j7 b        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
' G- G7 P7 ~# Z2 K; }! k% o, z};1 k: i. G% V" {3 U; l

6 v  j' j, S- o1 r1 bstatic void led_dev_release(struct device *dev), C3 f) G( a. ~: y) u3 O( Y; e
{4 e: k- T, q: W; P& f. f
};
4 |2 x' L  o, X3 a/ j9 Q% f/ O# L4 Q) \* k
static struct platform_device da850_evm_tl_leds_device = {
3 M! Q3 W% B2 I% i        .name                = "leds-gpio",
5 L; i/ z9 [; ?$ a/ b: y; L0 t        .id                = 1,- n3 C. O  z; [3 _# R- _* s
        .dev = {
; R) F: M) v* W4 P  g                .platform_data = &da850_evm_tl_leds_pdata,) P0 C; @8 g+ b6 c4 @1 R3 m! _& ]
                .release = led_dev_release,: z+ \4 [4 t' l6 {) B3 B
        }
. z3 j: l" F& U& \: R8 {8 h5 J};7 _1 f4 s$ |, H/ y/ b( X' x+ d

7 q/ |% x, _6 ]9 Vstatic int __init led_platform_init(void)
. [$ z$ K, ~) [) F6 S0 r{$ p: a; q$ }- W. e6 i
        int ret;
" i7 b6 n7 ^2 B& \#if 0
. y$ _5 w6 |4 Z6 `! E        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
. F: z: R! i9 ]2 Q  G" J' y        if (ret)4 {( D7 K* r7 J( h. o
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"* L0 C% V5 `1 O7 \# H( a
                                "%d\n", ret);
3 |+ @5 w/ N- X: r! f+ E4 t2 ?7 S: w5 r#endif
$ d& J" b9 @* P. o+ d) q        ret = platform_device_register(&da850_evm_tl_leds_device);, d1 r$ c$ S0 u% a1 o
        if (ret)5 e5 R3 t9 p1 e; e  Z0 e
                pr_warning("Could not register som GPIO expander LEDS");: R9 U  d# X0 o: r
        else1 e! _4 Z8 w. t  q1 T' A
                printk(KERN_INFO "LED register sucessful!\n");$ _: [* C$ g+ T# `5 E

+ G5 K6 Q& |2 I/ L8 M- P        return ret;
# U# D0 D. h' R. O}: [' A5 C9 Q4 B6 _$ T# ^* U" O
) e$ }2 `8 f  [' V
static void __exit led_platform_exit(void)+ l: b% b( q/ |7 u
{! `. T' u8 ~0 e  B0 I' N
        platform_device_unregister(&da850_evm_tl_leds_device);; L3 Z- t8 B8 ?! C$ {

* C4 f+ Y) _1 X. e. R        printk(KERN_INFO "LED unregister!\n");# K9 f5 T: X2 M' `) v1 X* N* t
}! N  M; D: y: P# h* a7 h. s0 Q$ q

' Z( @, h8 _9 s5 N: c9 a; b# J( @  Hmodule_init(led_platform_init);% ~9 O, p0 p# X! i8 C$ c
module_exit(led_platform_exit);+ h) d& Q2 {) @; i! ~0 ~; z9 _8 o
) n8 ?: E5 ^# W# ^
MODULE_DESCRIPTION("Led platform driver");
0 K6 P. [' [! e, ?4 j& kMODULE_AUTHOR("Tronlong");
8 n7 f, G. W' _MODULE_LICENSE("GPL");, [9 Y! d9 ~' d' R5 g

0 V7 O2 R6 ~7 O. v' |& U' {  N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 16:17 , Processed in 0.039095 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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