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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
$ U* L* _+ d( i1 i#include <linux/init.h>9 w8 k' o. m% H+ n
#include <linux/module.h>
, B9 u2 x, m+ d1 X( L0 [5 t2 b#include <linux/kernel.h>- ~) D4 H' O: ]' r
#include <linux/types.h>
; k" t" H5 ^) O#include <linux/gpio.h>
& c+ J8 E% Q) |% V8 V#include <linux/leds.h>
, L& g5 O+ J% E8 |6 m/ F#include <linux/platform_device.h>
: r: s& V' a3 y& N( z: Z- }& y- m% }( B" e
#include <asm/mach-types.h>
6 k. Q  P# p- M! I" y#include <asm/mach/arch.h>
+ ?1 b- O, I& A2 \: y9 [/ X#include <mach/da8xx.h>
( m: F& g9 R4 H#include <mach/mux.h>
' i$ _: f6 J' {8 P% G/ a9 S% a# M' T7 t$ G1 F. K3 O1 |2 q- `, u; V5 J
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
- q& G7 m9 Q, X, ]% V. j4 X# U#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
5 _  B) t9 O" E7 M% E$ J7 S; u- Y#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
. ~7 k; D4 X) M# D' K#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
8 q) O! y. r, N7 m7 I6 C4 I! C0 e! P) Z! t7 B# Q
/* assign the tl som board LED-GPIOs*/
+ E; w6 N% ?( ~, g8 Kstatic const short da850_evm_tl_user_led_pins[] = {
- |4 g* S! a4 }- }3 r: p& ?% i        /* These pins are definition at <mach/mux.h> file */  ^6 y/ B- T' i) r+ z
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,( ^2 _. S3 V1 q- F4 t0 f9 |
        -1
3 ^, i* W4 C7 M* B$ D4 f- _5 x/ j9 h};
8 V# g  ?+ }: H1 F. C% }, v( p' a  b" q& q- g1 Q1 r. ^' u
static struct gpio_led da850_evm_tl_leds[] = {6 s6 e) Q) S+ {: e
        {( c, |3 Y" Z, S3 M+ N
                .active_low = 0,
% w1 k, P% M$ {, q                .gpio = DA850_USER_LED0,  H. X0 {4 P% V5 a* @' t
                .name = "user_led0",
) G% i' d, f  K! A                .default_trigger = "default-on",2 }+ q/ I" x2 y; Z% t+ K* E! d
        },3 T' J; w/ l: t
        {
: ~: O6 a. g3 Z) `- W                .active_low = 0,! r% B1 ?) R8 H! t) V
                .gpio = DA850_USER_LED1,2 B6 q8 q" F8 \; p2 b+ O5 l6 s9 J
                .name = "user_led1",
9 y6 \- U- F7 b; o8 A( h                .default_trigger = "default-on",
1 Y; J+ g5 v8 [        },
! r9 [7 n" W: I0 c        {% \* ^- a! E) J1 I
                .active_low = 0,
: D, n: U  _" ~1 }5 v" h! C3 k                .gpio = DA850_USER_LED2,# x' J) J. ?7 w& h6 G6 g$ y
                .name = "user_led2",
6 W5 E: P$ m, {: G% H; q                .default_trigger = "default-on",; ^) ]5 _9 q) k, Y9 I( R
        },
/ U% c4 {6 y3 `& ^) f3 b        {0 U1 D7 x, }2 ]4 R3 ^* S% R3 B
                .active_low = 0,* m6 a6 T% `' ~
                .gpio = DA850_USER_LED3,: ^" ]: c$ }/ ~; _% q
                .name = "user_led3",; t+ f5 V7 t- q- m
                .default_trigger = "default-on",- V: U3 g7 i; J) y3 w* ^9 G" j! [
        },
, j1 {* T7 X. ?5 b$ e- M% L. w};
; @# L. x2 Q. |! w) E, t+ ?1 }0 |; N! E2 @( ^" ^( V% \
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
4 K5 N3 v# g, R        .leds = da850_evm_tl_leds,5 Y1 A! ]3 s6 d) W6 Y$ T( C& k
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
9 F, `$ I, @) d) q9 x0 E1 |};( U! r- P" |3 V: t0 K8 N

' u/ R( {' a/ R4 T) Xstatic void led_dev_release(struct device *dev)2 t! y7 }  U2 Y% i( N7 X
{
) ^' i. [# x  q$ y' c& P};
/ z5 m+ B/ v% K1 r; z$ w1 f  Z6 ^) ?- m2 S, }6 d7 i9 S6 F3 P
static struct platform_device da850_evm_tl_leds_device = {; x2 H7 ~7 m9 e% t8 X
        .name                = "leds-gpio",
$ q; [9 i) X, q  r6 l        .id                = 1,
5 U- s$ r$ J- I& \& `7 O; R, F        .dev = {
/ G$ b4 P: P. |( B$ L, L                .platform_data = &da850_evm_tl_leds_pdata,4 m. W$ h# c: N
                .release = led_dev_release,6 D; w1 p7 i: @: _: V- K
        }$ y6 T" l, \2 p: Y
};
! g: z2 @8 K; |2 ~7 M; l8 k$ [8 \  Y
static int __init led_platform_init(void)( O+ ?: `/ ]& `% E# T& K
{
; k2 m+ }0 x4 b! E9 |        int ret;( ~+ w- U/ I6 o$ p; h
#if 0
' R) S+ F. A4 M; D. S. [        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
/ \8 }. B- E5 j7 L  Q        if (ret)
, w; N& R* @2 `; d                pr_warning("da850_evm_tl_leds_init : User LED mux failed :") G% U' H* o9 B5 W% |) k9 x
                                "%d\n", ret);0 W8 K: S/ ^5 u( d/ @3 c/ B& A: g
#endif
$ s! |; O8 p4 @9 f% d9 d        ret = platform_device_register(&da850_evm_tl_leds_device);. T3 ~' @$ K) c. W
        if (ret)
7 w! g4 p6 t/ K% w( _/ _6 x% y                pr_warning("Could not register som GPIO expander LEDS");
$ {7 o" Z) m; f' h% p        else( d' B0 S. V5 B/ y
                printk(KERN_INFO "LED register sucessful!\n");! C/ t: @/ B7 c) o' K" h3 E8 [

2 f% ~, b, A$ S7 b, ^$ D# L        return ret;7 b' E% v7 D% P, f/ y0 P% B
}1 i" x4 b" m+ w/ ?$ S% `$ W
4 [8 \1 D. Y# o. K
static void __exit led_platform_exit(void)) {% F) A- {2 t2 Z
{( E( D: N: @. I/ u# J$ |# n
        platform_device_unregister(&da850_evm_tl_leds_device);
* i) n9 V+ Z4 [3 D- y* O2 k" k. v, |6 v2 a5 x( o) L
        printk(KERN_INFO "LED unregister!\n");
9 M9 m$ V1 x6 x/ I. n6 j}
1 [; Y6 g, s( J0 h/ U
- a7 {3 Q. S" n! y2 Nmodule_init(led_platform_init);+ S; m, o& g* n- L7 C9 T
module_exit(led_platform_exit);
/ M. b8 O1 ?# D! v! N& n& [/ Y
* N  @# w* Z' H1 {/ [% v9 J3 TMODULE_DESCRIPTION("Led platform driver");/ l. ?  I3 F# I  r/ r3 R) K
MODULE_AUTHOR("Tronlong");
9 t# T3 b1 |  F# q6 i6 |MODULE_LICENSE("GPL");! g& Z4 u$ k/ p
/ C; t1 p  D7 d; D/ n% P( e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 11:35 , Processed in 0.039268 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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