程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。6 t  p  ~1 `$ e
#include <linux/init.h>  z* T: _8 D& o- j% E$ m4 j
#include <linux/module.h>
: _- [- ?  \( k#include <linux/kernel.h>
* l( \- i9 Z6 O0 K6 u4 Q3 R( ~# g#include <linux/types.h>9 Y% S- X( o, V: p4 c4 r; o
#include <linux/gpio.h>* {  h/ g4 p* @& y/ C( _
#include <linux/leds.h>, D) o" ?- |, V; d; x' G
#include <linux/platform_device.h>
4 Y9 N8 |& o. r3 {" T; H' w& j5 B) ?0 M' N! s4 M
#include <asm/mach-types.h>: u; i0 j! F& @0 s0 ^
#include <asm/mach/arch.h>
) [/ o$ i* C2 a2 D8 c1 f#include <mach/da8xx.h>/ {0 g+ U1 a# Q5 f3 b
#include <mach/mux.h>
9 C2 b0 ?! l- F, I' E4 V0 f! x6 V2 @$ ~
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
, O4 Y6 {; e/ b0 u) q% v' t" }# D#define DA850_USER_LED1        GPIO_TO_PIN(0, 5), a$ ^' o: J2 B
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
' J9 ^1 d5 C& H#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)4 ~$ f1 \) W! R  g# |

  f8 G, v" h: M% Q/* assign the tl som board LED-GPIOs*/$ E7 D4 q3 j0 {3 W
static const short da850_evm_tl_user_led_pins[] = {
8 V# g6 x8 g" |) U        /* These pins are definition at <mach/mux.h> file */1 N* d5 y1 |# C4 _1 U8 v
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,# |8 G  `0 \' H! O$ S
        -14 S* E  ]3 ~/ e6 a! x% Q
};( \3 h3 ?2 p4 H1 e
) q+ d. J, P: U0 x( E& V
static struct gpio_led da850_evm_tl_leds[] = {( X4 x. T2 l9 E3 v9 \
        {% Q% W" r1 V/ a2 X! g
                .active_low = 0,+ ^0 i7 }, h3 j9 O4 j, i6 h
                .gpio = DA850_USER_LED0,
* G, I" ^4 a5 w                .name = "user_led0",1 j5 q% N! _% X0 _. Q0 K) |/ W* @/ R6 S; d
                .default_trigger = "default-on",
. D5 D2 h4 x* ~, }. }: v/ `; a        },
! D. s0 U; m( ]& c/ ^3 D        {
& W/ h3 N+ z1 y4 k+ p. i$ ~                .active_low = 0,8 m6 G3 H- a' T8 O) F; u. t
                .gpio = DA850_USER_LED1,
$ z( o1 C% F0 H) i                .name = "user_led1",4 t: o+ }3 l0 w
                .default_trigger = "default-on",7 i: X& D8 T& J, a( n' ^% P6 v
        },7 y! t6 \( Z% Q' J" f1 x9 ^
        {) F5 o: d- J* D/ ?# z& q! B8 x) o
                .active_low = 0,; Z' G# O- A8 r5 x  R4 k! B
                .gpio = DA850_USER_LED2,
" b! [, v' s6 o, _                .name = "user_led2",
; i, j6 {( I, y; h# W                .default_trigger = "default-on",
: |1 H: v* u( E$ H4 K) V/ t        },
8 r3 t6 P' s8 W# @: F* ~        {
, ]. s8 N' m/ q' e8 c" C7 N/ e                .active_low = 0,& g$ q0 b" _- E' D) Y; f4 m
                .gpio = DA850_USER_LED3,) `5 m) N( |0 K& Q+ ~! O( o
                .name = "user_led3",
3 L) Z2 |- W0 \6 f( u+ h                .default_trigger = "default-on"," _6 E( I( [0 Q* J6 Z
        },1 `9 W7 j- B3 q
};
5 U$ e! [2 P" h' n/ j2 ?1 @
- h6 O  k7 s- vstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {6 f1 t, T3 Q4 L  Y4 \
        .leds = da850_evm_tl_leds,
4 w0 j$ L. W% S        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
/ v. R' l' |3 v' Y! U};- V# c+ E! @% [7 V
7 S3 F! s1 A" J5 P8 M+ ]
static void led_dev_release(struct device *dev)0 i3 d, m! h* ]
{
6 l1 b  ^/ C# G+ X};
% W- Z6 q( |, W+ o7 p9 m1 K; G7 k3 e' q" Z& p  z% ~+ Z" r) E
static struct platform_device da850_evm_tl_leds_device = {, K- O- x4 l/ p6 |9 H
        .name                = "leds-gpio",3 d" X( H2 R0 p6 _  Z, H
        .id                = 1,
# e$ e9 l1 K$ J. g4 r5 {8 G: l        .dev = {
2 _  }$ A  W( ]! G5 ]  V4 D8 I                .platform_data = &da850_evm_tl_leds_pdata,
8 l# I0 Z3 V6 b. O8 @                .release = led_dev_release,
) v$ K& }4 i7 i: H  w, n3 \        }4 Y6 F2 @% h& \0 _$ T
};  j1 m6 g9 k' H& p+ ?& S
+ s$ `! J+ u8 Z1 z6 Z5 J8 S& ^4 r
static int __init led_platform_init(void)
* e& |- v$ Q9 W7 R7 w: s{" y# S. u" d' P" r
        int ret;
0 X6 u2 O# |7 Y1 W1 U3 B% s- ?1 E/ {#if 0
# ^+ y4 w8 s7 U& m0 f) O! x) h        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);+ }" y: H4 A6 C7 c% v( _
        if (ret)8 ?+ O  O1 w6 T2 x4 m/ ]
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
) @$ z4 n1 ]9 M9 \, e                                "%d\n", ret);- G) c( {4 g6 [6 D; W* Z
#endif5 B9 @: J+ E% y; c$ Z
        ret = platform_device_register(&da850_evm_tl_leds_device);
5 L6 c0 N' a7 M, ?. y3 D& g        if (ret)9 n% ?2 W) w& ^( i' Z
                pr_warning("Could not register som GPIO expander LEDS");
  A; N" O! o& T0 ?, ~        else
$ C3 W' M1 d( m! j( Z                printk(KERN_INFO "LED register sucessful!\n");
1 v9 t' T" b; p' z- J2 p- a- F1 g+ G8 w
        return ret;
7 q9 A$ x/ k" E: v; S}
: x0 ~* i0 n* O9 }& j1 b" ^( X8 A, U1 i4 |
6 y6 h- V* U! y" s2 [3 Pstatic void __exit led_platform_exit(void)
) m7 ^+ t7 y" {, m{7 s. ]( W2 g% q9 [; N/ W+ ]2 Q
        platform_device_unregister(&da850_evm_tl_leds_device);
. O( Y/ i6 w4 H) A. v' A, X) m
; X8 I( a0 T) q        printk(KERN_INFO "LED unregister!\n");
1 T2 g) y* V% y. o* d}
* s+ ^. W6 J( H7 t0 x
# y2 A% ~& n/ x7 P3 c6 Omodule_init(led_platform_init);
8 F6 ]  G4 o$ {4 }module_exit(led_platform_exit);
( A5 {& _4 Q. d4 }. S! ?+ J
) }9 t" [% N2 w- Q% }MODULE_DESCRIPTION("Led platform driver");
+ O  ^5 o  }4 q% \" i5 \( ^( w2 WMODULE_AUTHOR("Tronlong");
" Y7 p* o; n. O- N* QMODULE_LICENSE("GPL");
" A/ I' m: Q% H% q$ }2 V: K, x5 t2 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 02:19 , Processed in 0.041595 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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