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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。, |  R* I1 M6 e7 Q0 t1 M
#include <linux/init.h>
% D$ ]/ T6 O5 ?5 E* x6 M9 X. g0 T4 Z#include <linux/module.h>
4 |! B1 p  \9 Y0 X  }#include <linux/kernel.h>6 g8 v+ \! d3 K; t% S8 r; Q
#include <linux/types.h>
" M1 h9 l/ T3 {2 l#include <linux/gpio.h>$ k. p1 E) Q6 i& n1 o
#include <linux/leds.h>$ ]3 @$ e, q- b
#include <linux/platform_device.h>
" v4 E( c9 }& c0 O, _
9 z" {" p2 J3 e6 e2 e#include <asm/mach-types.h>/ C0 K7 k6 _( r' W" U
#include <asm/mach/arch.h>; R8 O; @( }# _7 {. @% o5 W4 z
#include <mach/da8xx.h>4 h+ ?- t1 p; H
#include <mach/mux.h>
8 |3 ^7 H9 K1 D9 V( j  \2 [. X3 p5 _
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0): n3 X4 b7 u0 K. i
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)9 {4 [! u. o/ y
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1); F8 p  O6 X4 Z! t
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
8 o) I- m$ [) T8 E" ]. _
  Q& y  E6 R" F' _* p/* assign the tl som board LED-GPIOs*/
1 O! s0 w% P9 i7 W7 g+ B7 Jstatic const short da850_evm_tl_user_led_pins[] = {
' N) t) `& A( b3 d        /* These pins are definition at <mach/mux.h> file */2 t: x3 j8 v6 q! \0 K
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
' e  _  o3 Q9 s) J        -1; R! W  Z# {2 e7 N: J; `; n: E
};9 C6 H' h  w6 I2 Q. `" ?

5 N1 n( n0 I/ Kstatic struct gpio_led da850_evm_tl_leds[] = {  Y4 x% M1 h& _: F- d: y0 r/ I
        {8 F+ Q% z- A8 z+ ^- s% H5 ]- T3 U4 N/ C' Q
                .active_low = 0,' W" H3 q2 G8 H! _4 c% l
                .gpio = DA850_USER_LED0,
7 W- R& e9 H3 ~2 K7 |/ X& ?                .name = "user_led0",
) Q7 N, e3 _: {5 n- C, {                .default_trigger = "default-on",1 _) L) r* D: Y. c4 v% @) J
        },
) y. Q! \! V( i: a1 ~        {( ^2 q" m& a( @8 V/ d" S3 I
                .active_low = 0,
4 t4 C2 P/ u  j# G2 l" h6 o                .gpio = DA850_USER_LED1,( q, A3 q- l* Q7 \. J
                .name = "user_led1",; l( W, o2 r5 Z" `5 y4 c, b% D2 I2 s
                .default_trigger = "default-on",* @1 C7 W. ^4 R: ~5 J4 G
        },
0 e/ J- [+ ^9 n) T. d, m$ r        {
3 P$ P: M- w7 Z' u% Q. R( q0 i# X) j                .active_low = 0,& R) k, `! X8 q4 A/ s. P# E
                .gpio = DA850_USER_LED2,
$ v3 W* Z! m0 P. V% {% g- d/ y                .name = "user_led2",
5 J% q9 z$ q; Q) O) l  E                .default_trigger = "default-on",
+ J4 {9 v. \3 G; h2 b& ?! q, {6 v& ?& T/ P        },2 u/ h  Q: e; u& H
        {
4 g% Y2 [( Q7 v& M4 e                .active_low = 0,
' s; Y  T5 T" }, M                .gpio = DA850_USER_LED3,
$ u& x% w& @# g, C( \                .name = "user_led3",: Y& x# Z" Z& ^9 @( r8 A% p
                .default_trigger = "default-on",
6 Q, N7 _5 [6 A" T  @7 [1 O, {        },. R  V* U# e  ^2 @
};
3 b5 t7 O/ A6 ?7 N% r. {. `( T2 s9 t5 l3 Q1 S: Q  Z
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {* P: ]) o" T8 R3 W4 ~
        .leds = da850_evm_tl_leds,
$ @; p# d, Y3 t4 q: I        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
6 F# M: _6 l! A$ A- {  a  g};
# F. Q. s0 N3 a) b( F: l# o  |( O. Q% R! r$ X) @
static void led_dev_release(struct device *dev)/ C4 O, t' D3 P$ e0 t# N
{! w$ s5 o9 |9 Z" X; m$ r
};5 R3 M" ^* R! b

1 N4 O& K. P  \9 ?. y1 H4 `: X4 Rstatic struct platform_device da850_evm_tl_leds_device = {4 ~8 n2 T. [. F* ]+ O
        .name                = "leds-gpio",) B- s* [( G! ^3 @; a  t& o
        .id                = 1,
% o/ R( l/ {1 H. G/ @        .dev = {3 U! a+ I* c: W$ D2 X
                .platform_data = &da850_evm_tl_leds_pdata,
' F3 ~" V' q+ M                .release = led_dev_release,/ e- M- z, ~# k7 B! k" R; l* d
        }( M2 e; ^) N' R3 b" K1 E
};
9 C- p7 L$ \3 D+ P/ Z
& U+ j* i1 \& ?* I* d) B! s. k  Rstatic int __init led_platform_init(void)
* n9 Y9 ~0 d0 [3 P% H{  L+ Q+ ?. x) c! ^
        int ret;
9 W: ?7 t" f! G: y#if 0
" p- w* S# C# O4 u5 y) [        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
7 Q  G) J9 W& g$ z7 Y        if (ret)
1 }: n. F$ ?# h0 @/ ^% B3 D                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
% B0 q" L. P6 F8 x3 g                                "%d\n", ret);# l' X/ _+ G7 I$ w: P( S
#endif
  b, z. k1 P7 [9 D/ z- {& k        ret = platform_device_register(&da850_evm_tl_leds_device);
/ B& `- Y/ k# w3 }3 ]6 l        if (ret)
' P" y9 \9 |9 @" J$ o4 ]7 m) d& p                pr_warning("Could not register som GPIO expander LEDS");
& O' `4 \, `: v4 o        else
" N% I  e( S6 }  E7 {' b                printk(KERN_INFO "LED register sucessful!\n");, H6 x  a5 Y8 x" k7 z( Y+ Y& R+ j

2 b" {) p6 S) \# D$ i4 M        return ret;
: u% q2 d% l6 J! Z/ D3 E' h}
! J9 u/ l/ \* U3 m
9 w) Q* j4 P0 {$ A1 g+ Istatic void __exit led_platform_exit(void)2 C: W2 u! K- W# D' [
{! D2 ^7 E, J+ v3 v' D
        platform_device_unregister(&da850_evm_tl_leds_device);
6 I5 }. C7 k4 ?4 B' _' x
6 r) [- A9 s* d        printk(KERN_INFO "LED unregister!\n");6 x+ I4 E2 b' _# n; ]
}3 M' V0 n! s5 ^+ S7 l* ^
4 [6 H* m8 F& f5 ]
module_init(led_platform_init);3 t7 W6 S$ C$ v' r& m% d& y6 l
module_exit(led_platform_exit);
. b' S, R. K0 l
7 _, o  N6 G% A' I# ?MODULE_DESCRIPTION("Led platform driver");5 A$ L( ^% ~% R9 B5 d  O5 t& A8 S
MODULE_AUTHOR("Tronlong");
8 c( t; \0 T& H. ^. K( M. cMODULE_LICENSE("GPL");5 f- i4 r5 |- y" n9 H$ Q% P8 g

0 f2 b' g! p5 b; ^  h2 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 08:35 , Processed in 0.042648 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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