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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。/ i, J) L* K5 s6 f
#include <linux/init.h>3 `, S: o; r/ e3 X- w
#include <linux/module.h>; \: J8 T; [* H2 ~& D+ t" K4 G$ T3 I+ p
#include <linux/kernel.h>. {' h% E0 ?" D1 o' H
#include <linux/types.h>
+ r5 S5 A# M0 ~: U- A#include <linux/gpio.h>
8 `! u2 Q% }; `# c. W#include <linux/leds.h>
7 m" s/ Z- F& @# m: K% @- U: w: p#include <linux/platform_device.h>
$ m$ P& S; c3 l5 M7 G! E2 h- {
#include <asm/mach-types.h>) g5 d2 w# d3 N3 |
#include <asm/mach/arch.h>0 h& j/ n5 l' j" \5 U6 r! U
#include <mach/da8xx.h># x# V3 _& F: v6 s  J6 U/ ^- j
#include <mach/mux.h>5 p( J2 m& }& \5 Z* a# h, G

2 N6 z, S" A2 S; X% l* x; |#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
- N/ H2 m& z' y' i#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
' v, @' r. p3 u. e. O7 ]. K#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)0 C6 K. g: e6 g  T$ r$ C) s
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
" y4 Q9 e9 ]. d' M" D4 O3 e) A- f" A+ Q9 ~$ u3 z* i7 [
/* assign the tl som board LED-GPIOs*/
1 M+ }, e. Q7 `$ o+ astatic const short da850_evm_tl_user_led_pins[] = {9 w0 t& o( z/ D5 G/ \! K
        /* These pins are definition at <mach/mux.h> file */
5 G  H0 p  K2 o6 J9 n0 R& U        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
0 M5 F7 o9 Y8 U3 o        -1
( T8 e7 H7 D% Z( w};
+ U' v. s; p! h6 o# W( I# C: d
1 x% P0 P" a9 m. Kstatic struct gpio_led da850_evm_tl_leds[] = {
1 m, g  n$ t3 ?8 ?7 h1 M$ u8 U        {3 h4 J$ R! o8 l# s
                .active_low = 0,6 P, p9 Z/ @0 Z* f
                .gpio = DA850_USER_LED0,1 k4 m% a$ P" U7 P1 W
                .name = "user_led0",
/ O3 `& P3 i+ k                .default_trigger = "default-on",
6 d3 E  d# k7 ~+ F5 w/ A/ O: s+ g6 r        },
' d) u% a* Z; a% G        {
7 c! G' O' J* Q9 f* g/ v$ H% W                .active_low = 0,8 v) g, }7 x- r! H  W
                .gpio = DA850_USER_LED1,
4 }9 o2 ?# }4 x! [* f8 r                .name = "user_led1",
7 s4 L# O" L$ k8 x- N- V1 l2 j                .default_trigger = "default-on",7 K& S* @7 q6 U( j9 R& U+ D2 O
        },7 L0 J1 {) B, i! I0 }9 \
        {, H7 g8 C: V# Z/ f& c
                .active_low = 0,
; Y. o9 _+ z' ^! k' \! E! h                .gpio = DA850_USER_LED2,9 W% m! `- I+ p* p$ P: ^$ H
                .name = "user_led2",2 `# S% S. s) G. K( |8 d
                .default_trigger = "default-on",
9 e( }( ?" k5 b3 u) `6 L        },* p3 E3 A7 T! m8 e
        {& j3 \1 I2 A: F- I; a# V5 B" O
                .active_low = 0,
% f4 H. R: }9 N1 l/ e                .gpio = DA850_USER_LED3,% H' ^: n# ?6 c" Y8 j" A
                .name = "user_led3",
% r" ?4 U4 j' z) [3 D                .default_trigger = "default-on",5 {( Q  h5 o, i" j: ~9 w
        },# h4 G& q8 i0 u6 [. a
};
$ Q/ p- Z! V2 W9 K: I8 t6 z3 N7 Y1 ^, @6 z2 p$ X9 v$ Z% E, n; [% E
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
, {% {& s! J/ C, Q  x        .leds = da850_evm_tl_leds,( ]8 I. r& W8 `$ ^. W/ v
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),% c3 i. w  u6 |
};* h- b! i4 R; j3 L" e& t) {# h

& n* e) e6 j# q+ O1 Fstatic void led_dev_release(struct device *dev)* q* s& h$ F1 S9 I; [3 }+ A
{
  _1 g- D, l" N8 V) a. R/ ]};/ e6 l6 W# V1 W* y

9 P2 y/ k9 M  y2 fstatic struct platform_device da850_evm_tl_leds_device = {6 }* l. L- R) T" Y+ O( n
        .name                = "leds-gpio",
, b7 g; j3 [0 Z9 y8 i0 u        .id                = 1,
' k5 V6 q2 }1 ^- u7 d8 a        .dev = {9 U/ h. F( O5 }, |
                .platform_data = &da850_evm_tl_leds_pdata,& M& ^+ h2 i+ t1 T
                .release = led_dev_release,
2 m: v8 A: U0 C+ z( L        }; G- Z" [* ]2 K* C* F' ?/ I
};. {' J; n. C# {9 M
, ~+ z3 m1 Z  S* N, G# b+ z
static int __init led_platform_init(void)* }" }& R. O4 b( r
{; b- t) ?& f% a  [/ }+ r8 t
        int ret;
' s. ]' ~4 V: X#if 0  U2 R- }" p: G1 P
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);" O4 ]1 d% d1 ~) M3 u
        if (ret)
1 W- n: a; [  S& E8 Y1 T                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"  G4 Z+ v# _4 j! V
                                "%d\n", ret);
, c2 l" o! _; C+ G4 W" l#endif% ~' z* i0 F0 V; _# l
        ret = platform_device_register(&da850_evm_tl_leds_device);! Q# e3 s4 ~" j* K% D
        if (ret)
4 n0 `; [: ^' D1 W9 z0 p/ j! I                pr_warning("Could not register som GPIO expander LEDS");9 w) W1 T" ]0 x2 @
        else
& \$ p% Y2 _4 A                printk(KERN_INFO "LED register sucessful!\n");& k/ ]. E* K8 E5 u
- D; o$ P3 r* h4 O
        return ret;
& h5 Q6 Q& p+ H}
: c( b9 m$ y' q1 f5 A
, I  l- I7 w( q7 \% n3 |' I* B  {static void __exit led_platform_exit(void)( d: o) Q3 V: e8 }
{+ q. X1 M1 K! s1 r# y4 B
        platform_device_unregister(&da850_evm_tl_leds_device);% ~3 R7 ^/ k3 G

1 B3 V) B) l. B& W        printk(KERN_INFO "LED unregister!\n");8 B7 g: ?% q$ r6 |9 m2 ?& p. C
}
# f! x# A0 }$ U" D5 {; A: @
8 q3 |$ Z/ B. N/ d( o: \  u6 tmodule_init(led_platform_init);- }1 A, Y: {) O( d) r" x
module_exit(led_platform_exit);6 v# j0 B, N1 A4 ^* Y
- @1 |$ ?0 w. i' }( i( X- w( T( W
MODULE_DESCRIPTION("Led platform driver");
0 g* ]8 z, g8 v% E/ _- PMODULE_AUTHOR("Tronlong");5 d; X5 g4 U( H9 c0 M4 p; y
MODULE_LICENSE("GPL");
- b7 I" _. W4 n4 d; N  T3 `2 k
& k  _) p. W1 |8 r! O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 15:06 , Processed in 0.039328 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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