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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
/ k2 M6 O6 ?1 [# S. N#include <linux/init.h>
4 T) g/ r+ Q! O+ w#include <linux/module.h>0 F. b/ p1 q1 f9 M- r4 }+ X
#include <linux/kernel.h>
$ i9 F* |) \! ~- w* d#include <linux/types.h>
! @8 S1 ?: [& _: O( k#include <linux/gpio.h>: W- {& K" X# Y: G: n: T, L! s7 Y
#include <linux/leds.h>
# d4 q; m( u9 [- n#include <linux/platform_device.h>* ^2 C9 k; I: e( q& `' Z
* s% r* L# t* n
#include <asm/mach-types.h>
+ v2 W) x! T9 I( ]% L! h#include <asm/mach/arch.h>
+ V2 A0 X- p# e) t' ^#include <mach/da8xx.h>& \: r+ B/ b0 x/ F* N7 E* q" T
#include <mach/mux.h>9 v! F7 r( D) f* f1 O
+ c$ y, I9 P/ L& k
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)7 N, E$ `  S# o* V
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
. n3 o+ J; [. O6 p4 k#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
8 I$ q8 q1 |# E' ^  G1 h#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)( I* [/ v+ L& Y7 ^

6 X3 t! Y$ o1 f6 v6 A. n; `/* assign the tl som board LED-GPIOs*/
/ _; g) Z8 c+ X& s1 Astatic const short da850_evm_tl_user_led_pins[] = {. z# S- S5 F) F! {* R* c; u
        /* These pins are definition at <mach/mux.h> file */, O& c8 @9 d" C
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,4 m6 v9 c! X- a. @; d
        -1$ o0 j) i  I6 M2 g: r
};% e: o9 p' @! r; {9 h

4 p( b  b' s6 h5 r- T$ |% N1 ?; nstatic struct gpio_led da850_evm_tl_leds[] = {
3 _" f. w5 C# j+ E4 R        {
8 M9 |) S1 q" |7 L! p' h% m- I                .active_low = 0,6 E  U! v) K# ?! E6 j/ H
                .gpio = DA850_USER_LED0,' e2 r* J# B" D7 p/ s7 c
                .name = "user_led0",3 {6 L6 ~" n" n' S) Y2 K& P" w
                .default_trigger = "default-on",9 i: E7 T4 F8 L1 O% d
        },: D, w1 l+ K! b4 |0 R: L
        {& E! T9 j) O+ v( H. y4 ~1 T
                .active_low = 0,
- ^2 `" z1 k: l0 d( C/ `( k                .gpio = DA850_USER_LED1,
! [1 I: x, x/ C                .name = "user_led1",
, D3 w, ]- W) X& P" j% ^                .default_trigger = "default-on",
7 [9 G5 H  j4 H1 T" F: f        },
. ^. z: M* I" e6 ]: H, u        {( a" e) ~# j8 m. Z
                .active_low = 0,
) L9 j* k1 A0 j3 V                .gpio = DA850_USER_LED2,0 Z% f7 e' ~( h" R) A
                .name = "user_led2",
# P; n; z; m0 ?                .default_trigger = "default-on",3 q' n! |& ], ?5 x: _
        },) u7 r  T! g  y! }5 A6 G* ]
        {
, _0 q$ W/ s" N; N0 K                .active_low = 0,
$ F- x9 U# K; i% U                .gpio = DA850_USER_LED3,
) k+ [- Q) }8 z& u" N) \" Y" P( P; j                .name = "user_led3",
+ z9 H% @- U/ t7 x, T! n3 q& O                .default_trigger = "default-on",! N' l7 t. a1 y( t8 E3 M* w" `* p7 ^
        },
; l9 d. I1 X4 B5 l};
+ D1 d$ E( X: ?, U; b! |: T* F
  \3 m5 V% m2 p7 p  E; ^( X4 F) istatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {( y$ r3 `; q4 ^6 W) t5 d
        .leds = da850_evm_tl_leds,
3 \" t' u0 N$ G        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
' ~& }: O' j, M/ f" Z};
/ P! L3 w) C- H0 n, t; r
- n' w0 T% j/ T0 Rstatic void led_dev_release(struct device *dev)2 l2 g+ j# L; w8 h
{( x& _( Q+ A# }* ~6 y- s
};
5 a8 g! ?/ g, f. l4 A, }' G. `) n; A! N' U1 N
static struct platform_device da850_evm_tl_leds_device = {* e) e9 C9 h2 v6 @6 z1 u5 ~
        .name                = "leds-gpio",
) g- L/ E' Z% g        .id                = 1,) a, N- }" r1 S
        .dev = {
' c( y, X# J* c                .platform_data = &da850_evm_tl_leds_pdata,9 H3 c% q, P7 f4 A  E
                .release = led_dev_release,
3 y( B5 a9 m% J: J' ~        }
5 j/ R. m4 L1 G* I};1 d4 [& @2 ]2 [) }

. _' ]* _: ?5 N* Y. f0 Q# j/ astatic int __init led_platform_init(void): ]. O3 V) e( Z$ F
{0 t( x$ c* W& V
        int ret;) [, T: g$ F! i: t) X
#if 0. ~4 a( G% x# ]) q8 y5 V
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
6 X( Z7 [3 e3 ~* ~/ M- Q        if (ret)
8 x) H, K; f0 D1 d8 U                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
% z/ {2 H0 x% k9 B" z. W1 \1 W                                "%d\n", ret);  V/ N! E% v, J. k; n7 `+ v. j
#endif
; O* B% T  P. z; c# H4 G5 p& l        ret = platform_device_register(&da850_evm_tl_leds_device);/ b) a) O1 D( m" X0 g9 g( y9 u
        if (ret)
6 V1 n( ^2 q3 O7 g% [  I- {                pr_warning("Could not register som GPIO expander LEDS");
+ u. S" F, W5 f2 }/ A- R        else
2 e# V. @. K# H& T                printk(KERN_INFO "LED register sucessful!\n");! ?7 Q! _# Z' d. x

  \* K, z* X! {6 i2 V2 b% R        return ret;
4 Q# m2 S" z& [* P! V1 I. v) O}  r6 @8 o6 q% R7 o7 I
. |9 p2 H, B& k6 G% d$ X
static void __exit led_platform_exit(void)
8 k) ~- T: m2 W" o{
7 W5 s2 d  H8 e        platform_device_unregister(&da850_evm_tl_leds_device);  T; g- z7 x& X% Y7 L" N% o' @7 A2 G+ `

) K+ H# c& H3 @2 A. a        printk(KERN_INFO "LED unregister!\n");& }6 F) Q. T- G& E3 G8 V
}0 U2 x, J) ]+ q

+ g" J9 q! `$ _0 y: N& P  Hmodule_init(led_platform_init);' z9 e, U( Y6 q5 h! N) q1 O* F2 h  r4 |$ l
module_exit(led_platform_exit);9 w+ r7 C% y4 }
/ W) i- Q* e, `
MODULE_DESCRIPTION("Led platform driver");8 U0 m/ a& n" D0 Z* s5 r8 T, B
MODULE_AUTHOR("Tronlong");: [4 ~' h- B( f2 U- l
MODULE_LICENSE("GPL");& m2 r9 U! N2 [8 G' @5 J' B

, d* H9 w3 z* p+ R) d! V: H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 03:40 , Processed in 0.038865 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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