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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
$ Q# {, v- @. I% n4 ]! w% D! }#include <linux/init.h>% O( c$ R* ?* k4 f, B
#include <linux/module.h>
* |5 }* J2 F0 n$ i#include <linux/kernel.h>5 J( v  w5 L: y& S, k$ S
#include <linux/types.h>
$ x) f' D3 T3 p4 o* @2 q#include <linux/gpio.h>, ]3 `  k" l9 h& f1 N
#include <linux/leds.h>  y: R' u3 f- [! R4 \
#include <linux/platform_device.h>. }3 y& P0 x3 }: V, g8 C3 m9 z( j
1 F" j& n+ Z& Z+ A
#include <asm/mach-types.h>
" [/ b1 _' F% G, G* U#include <asm/mach/arch.h>2 T( x2 f% g4 c7 X' ]2 `) P" {
#include <mach/da8xx.h>
, x- w$ {+ N3 `# b4 a#include <mach/mux.h>1 W1 m1 g7 J* w  d) L. ~! f( s5 w: H

% H4 r: s) X" k0 S#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
9 }; S7 w2 |- |# t5 R9 D+ Y$ y: U#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
% Z4 v# C" E7 ~3 M, }  ?+ @9 F- a#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
3 {# n1 |+ \' |8 y2 k- Z% b#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)) J+ z+ g" C; ]& w' X! s( k
; l% M) F2 Z" r
/* assign the tl som board LED-GPIOs*/
! }" Y1 Y4 V7 d! M& T6 R# ]7 U" Sstatic const short da850_evm_tl_user_led_pins[] = {; b. _* [3 r/ x- y
        /* These pins are definition at <mach/mux.h> file */% a- r2 `& F5 e  b0 h
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,* W7 y- Z. R2 E$ H+ O5 ?0 I8 @; _
        -1. y& g: J* k) |( N$ H% x% ~% |
};
2 [& n" N$ C8 l1 d2 s* v1 Z
3 }$ P+ T0 u9 Q& i- V3 Bstatic struct gpio_led da850_evm_tl_leds[] = {3 P  P; r% S6 [: i; @, t3 y; ]
        {' E0 w8 G7 E( Z6 ~! _* T' r
                .active_low = 0,. {8 T$ G  d- A- S% H$ A% ?- N# O
                .gpio = DA850_USER_LED0,6 n! D* s0 f& F/ r9 T6 I% g
                .name = "user_led0",8 j9 d3 k: X5 ?+ {3 {
                .default_trigger = "default-on",; Z; @# ~4 x* i2 L) H4 |
        },
6 v9 B- O# r5 i9 Y+ L, i        {
0 F# _! p5 c9 s& N                .active_low = 0,1 A+ K( i5 ?" a9 ?
                .gpio = DA850_USER_LED1,
/ q. o5 Y2 p5 D0 g& X                .name = "user_led1",
. |9 R3 b# i% t  J+ i$ L                .default_trigger = "default-on",
8 y7 z: B3 m: i' }( I        },
& t3 m7 K6 l3 s1 [8 _2 w! U# q        {4 Y( `" f4 Q3 w
                .active_low = 0,
4 z) s. \. i( T, l- m                .gpio = DA850_USER_LED2,2 R8 E/ U0 U& P1 A
                .name = "user_led2",
. W' K& o. A, N. u3 c7 v, c                .default_trigger = "default-on",
% e: s* x$ O, Q% `( o- l        },) i9 O" c; L+ n2 }7 N/ X) b
        {
4 h& a3 t( Q% g( q  X. ^                .active_low = 0,% @9 H+ m0 o0 a& J2 i, d: C
                .gpio = DA850_USER_LED3,) }/ L; `* o8 D0 R8 Z
                .name = "user_led3",
- V$ U9 r3 v$ E* Z0 t; L+ p/ w1 H                .default_trigger = "default-on",3 E3 g) J) \! d+ h
        },) W& v1 O' p- M0 @
};# U/ F( k, y' w6 A# d/ P) @: |

  Q, F8 Q, W; ^9 u6 f0 dstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
7 P- k9 ~: U. F- v! Y( N* N        .leds = da850_evm_tl_leds,
# _( `) h9 \: E0 T7 w! `        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),+ j7 Y9 n# x2 L" p3 C
};
8 `6 t( \& y; z; H+ I! \
9 Y% W. {4 z& U0 m  V0 ystatic void led_dev_release(struct device *dev)$ f' a$ Q1 T& U3 X5 k
{# {0 Z: g$ U+ J# ?) V7 C
};
  _: b; D( g. v/ G
1 M7 o0 l' R% F) ~$ C% d) A2 H3 Astatic struct platform_device da850_evm_tl_leds_device = {0 ^# R7 y1 ^9 J7 f2 k
        .name                = "leds-gpio",& U5 m8 y8 q/ c+ t$ I
        .id                = 1,
# Q. _3 @, l& y+ h7 M: `! ]        .dev = {
' q3 f5 U0 D; }% ^9 w                .platform_data = &da850_evm_tl_leds_pdata,2 B1 }$ n! A) Q
                .release = led_dev_release,8 [' A+ o' j! K; A
        }/ x$ R) C; C: Z) i+ j* }! C9 i) L
};
+ }2 R4 J6 T2 O9 T+ n2 y/ ?  X9 h; Q: ?* g; v' m
static int __init led_platform_init(void)+ x& z+ ]% [( T9 {; l3 I
{
3 u3 c* E. K/ U' n5 Z- g4 D        int ret;
/ w# T5 R% A* R) W0 v! [#if 01 W# b# o! T! X' g
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);1 |8 I( t$ u' _( o2 g
        if (ret)
6 B+ l  I/ N0 A: \% l                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"  m  V) l* t: ~! z; o' x
                                "%d\n", ret);. j% `- ~, x& G+ u2 v( }) A0 u1 ~
#endif
0 H/ f, h9 ^8 u/ v1 p        ret = platform_device_register(&da850_evm_tl_leds_device);& d4 T- A: I) y0 ^
        if (ret)
6 g6 ~: m: @: m                pr_warning("Could not register som GPIO expander LEDS");
! i1 q) i1 z9 Y' C. j        else
- Z. z2 a6 O8 Q" t) U                printk(KERN_INFO "LED register sucessful!\n");5 [2 P/ V: U  W0 b% [: h

$ Q( y% \; U6 i2 |4 t( b        return ret;1 j. O/ D5 ?( M2 ^* z& q* R; b  S
}
) f; b6 B+ @, F. U9 k2 s3 e
! ]3 _. |( s2 n% h  o9 t6 V- t$ f; wstatic void __exit led_platform_exit(void)
* t- j( m- W! N5 z{+ `2 k3 U( F! `* {, \" ?
        platform_device_unregister(&da850_evm_tl_leds_device);
  k& M7 P% y; Y' K3 {
) D5 k  C  L' ~  E. i        printk(KERN_INFO "LED unregister!\n");  m# X+ g3 k& ^8 ]' ^4 J4 g
}
. n/ I8 @6 D/ X1 a  _3 i+ H, k2 s& @% }- \6 j8 \5 w& o
module_init(led_platform_init);
# c% X1 k& m0 K! l1 Vmodule_exit(led_platform_exit);; ~$ r2 d. t' O/ H) `2 _: d+ {

- x/ \- z! ~! R/ f# `  m- PMODULE_DESCRIPTION("Led platform driver");% p5 ~0 l- z( R: \; x. Q
MODULE_AUTHOR("Tronlong");, H5 m8 Y% x% v, B& r
MODULE_LICENSE("GPL");
% |9 t+ y# ^: Y# L
6 r' h) ?( h  a1 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 01:27 , Processed in 0.037782 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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