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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
+ |/ X9 r" Y' z" F+ u, ^& S#include <linux/init.h>
5 {1 P3 h+ P7 L) _& W: i, q: k: W6 b#include <linux/module.h>6 i7 a0 n+ G' k
#include <linux/kernel.h># @% n+ s! }; U. X
#include <linux/types.h>
, _$ H8 a1 z0 k& J& @( D$ ~#include <linux/gpio.h>- ~! J, R4 X. s+ C9 [7 k
#include <linux/leds.h>
' I" V/ b& P% {#include <linux/platform_device.h>: t4 b/ Y* o6 W8 [8 R3 b1 p8 a

4 G( t1 |( F& S) F#include <asm/mach-types.h>
  |: o3 i3 W5 V2 T$ P: W% i, d2 R#include <asm/mach/arch.h>7 J# g8 G; F7 }
#include <mach/da8xx.h>
5 o4 X% i; d  H. r8 X, u" ^. R#include <mach/mux.h>
3 i& c3 d) s; \' h* [% \4 K6 Q3 Z# a7 s6 p
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
4 u8 K& k2 a$ T#define DA850_USER_LED1        GPIO_TO_PIN(0, 5): A8 @8 z! B5 i0 ^3 P8 g1 J+ T3 T5 ?
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
; v% X% t. a8 _4 l- h& J/ Q#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)0 G# O! S7 \. g. {
+ i7 n7 m2 i8 u2 x9 J
/* assign the tl som board LED-GPIOs*/
: C) U8 b! A9 ?* Ustatic const short da850_evm_tl_user_led_pins[] = {! \' q3 a# S: n+ Z3 K0 u6 N, t
        /* These pins are definition at <mach/mux.h> file */. ?( ^' Y1 D: F8 y/ ^6 b' }
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
( w+ |0 {5 G/ F! K        -1
# J( @0 V# b2 |0 [};
- S+ z- n& f, A0 C) W+ _3 G2 i" u7 @  b$ m& g; q
static struct gpio_led da850_evm_tl_leds[] = {
2 c7 x4 y5 S' L2 b9 M        {& N* u; a& l; r/ Y, L) ^& Y* S) L
                .active_low = 0,
; W0 l4 T  @' c! K, P                .gpio = DA850_USER_LED0,
0 ^% G, n& N) a& x3 f5 a  u$ i$ y                .name = "user_led0",: W7 M( B5 ~  N6 Z. h- M# I3 n
                .default_trigger = "default-on",
, x! q2 a. V5 {        },: ?5 j2 \6 F( j) [/ M
        {
* Q$ ?/ k5 {. o2 Z  \' ~/ W6 Y                .active_low = 0,& L, J" G* ~9 P0 t3 G! N; o
                .gpio = DA850_USER_LED1,
8 l3 G& n: H! n                .name = "user_led1",
8 G/ `# j! `# ^                .default_trigger = "default-on",
$ y6 n3 k" p; u! b8 O/ }        },6 l$ z) E: K  u& S
        {
' N5 c' h& N% m$ F' r                .active_low = 0,+ y: m: C) s7 s& r2 Z' `
                .gpio = DA850_USER_LED2,  T- M3 u. X9 b0 t
                .name = "user_led2",8 `2 J: M8 l2 x/ |4 S7 J6 I$ d
                .default_trigger = "default-on",
! Z# V, \$ \0 g% Q8 V        },
# m3 b/ r/ Y4 Q        {9 O" X3 c# ]6 A0 m4 ~6 [, G8 @! F0 a
                .active_low = 0,
5 `& R6 {" k! {- k3 l                .gpio = DA850_USER_LED3,
4 b1 z- z6 E  Z, d. z- I. P5 u3 ~                .name = "user_led3",
7 O( C- R- J1 C$ S9 Y                .default_trigger = "default-on",4 ]& k! {! \' H& b3 L% D
        },
- @0 l4 z3 X: Y! l- Z. Y& _1 R};
& I& Y! e2 D& \8 ]4 b; B9 w8 K( `' c. k
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
6 g# P2 \% Y5 e9 T, `        .leds = da850_evm_tl_leds,
/ L2 T/ D% x8 b        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
$ B0 q3 ~9 r; v};3 Y$ H" M; Q: K) d

/ P2 H! l* z6 g  ~$ |5 Mstatic void led_dev_release(struct device *dev)
2 q$ S/ |5 r. F: }1 B7 g{
5 Z( f  y2 p' G};" ^& w0 ^' \3 i& [; b
4 N8 [: u  _& ]  c7 ]0 f. a, A
static struct platform_device da850_evm_tl_leds_device = {
0 k/ x: l- c0 L2 y- I        .name                = "leds-gpio",
6 [( c- ]  b2 h2 J! ?        .id                = 1,
' D, o; {* z3 X+ W3 l        .dev = {- N7 ]" @0 |$ y* t( V% B& O& a
                .platform_data = &da850_evm_tl_leds_pdata,
6 w' ^4 P( d" D/ A$ l. h                .release = led_dev_release,# Y7 N/ k7 h. k- |( B2 F4 ]# I
        }
1 A* }$ ]' C5 Z* s# {% j};; r/ k9 l8 }0 Q& R; y! D
" Q; `% h/ l) P/ \) l
static int __init led_platform_init(void)
$ N) x* y! f  W/ j- a* C7 I{
5 q; h" M5 t8 o! Q        int ret;
- l3 P1 |% S$ a$ l5 D#if 0: l2 r9 e5 w; s4 ?) q3 O
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
8 i0 M) f9 a% J. ^0 b3 H* r- q8 N        if (ret)
) e$ y6 p  _9 J2 [  a( U                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"5 z2 q- B  y, e- U! o
                                "%d\n", ret);
* r/ W6 Q6 A' ?9 U8 E7 @- h- B+ P#endif( C, G- _# X( k+ x' c9 h$ F1 X
        ret = platform_device_register(&da850_evm_tl_leds_device);
& G. m& D- W( k0 }        if (ret)
$ \8 A( Z# d, Y/ N                pr_warning("Could not register som GPIO expander LEDS");
4 v* I6 V; y) s        else) l0 K8 ~3 ?: `) m( L9 w
                printk(KERN_INFO "LED register sucessful!\n");: C# k8 g7 F1 B7 m2 i0 F
. \- @8 W6 y- W2 U6 O7 p
        return ret;
& l/ c2 M( F" u, y) O% z1 q}) x" J  n$ }7 r' t& u, S8 A
3 [4 x6 ~1 g- \& X' ?
static void __exit led_platform_exit(void)
1 L$ U, H  M/ X( Y{
$ z5 x! C7 g( k( Y. M; T& k" N4 ]        platform_device_unregister(&da850_evm_tl_leds_device);. {* e6 r& q9 `: n; Q' j8 W

* g' m$ V1 _- A$ C! S$ V( X        printk(KERN_INFO "LED unregister!\n");
( l8 o# \7 d. l}' M9 l  n8 N' O! Z' n8 b& f

7 S) ]. f( d$ \3 E4 Y1 Omodule_init(led_platform_init);
, L8 Z2 @. h6 U: {- Tmodule_exit(led_platform_exit);; Y- r2 F5 p3 n% z
4 S, m6 g0 e0 L& A
MODULE_DESCRIPTION("Led platform driver");
3 E9 m0 j6 K) ^/ K# @- [MODULE_AUTHOR("Tronlong");
3 E1 e0 y% W4 k4 l5 l6 xMODULE_LICENSE("GPL");7 `, }! `2 V+ o3 l! e

( c( h! j, J. a+ w+ ^. Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 06:05 , Processed in 0.040754 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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