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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。+ T6 v1 E  a8 y6 c. K! o& O
#include <linux/init.h>  K- }2 [$ @* Y8 n
#include <linux/module.h>- f0 b+ f, s: n
#include <linux/kernel.h>; R  ~; q: G9 ^) t! O
#include <linux/types.h>
' j; }6 d1 W# U+ Q; Y0 B#include <linux/gpio.h>
4 ]1 [2 p4 v" X# ~( S( M- S7 H#include <linux/leds.h>
5 ]& L+ b; S4 W8 }" D; \7 a#include <linux/platform_device.h>
) U/ F5 k. ^6 ?. h) m" B& x; u8 t8 t: G( H
#include <asm/mach-types.h>$ ?+ U7 f& J/ y+ L0 v, P
#include <asm/mach/arch.h>, `1 ]3 j* I9 j, F, t' {
#include <mach/da8xx.h>
. S% [7 B$ T9 j5 W#include <mach/mux.h>: ]5 |) F" L  s/ r9 |
) c: E# U% Q9 U7 G2 l
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
0 s" a7 J  M# M#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)9 ~1 k- _$ v  N9 d9 E& H
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1); R/ o+ U4 `1 F0 H
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)6 m: y" |9 S, R  u, x9 ~+ D0 t% P+ j. i
. ?+ T2 z' T( u( @( X. C4 S9 M0 f! h
/* assign the tl som board LED-GPIOs*/& v, L: z4 ~/ h$ Z
static const short da850_evm_tl_user_led_pins[] = {* u$ s* Z* U. v: R& i4 S* c
        /* These pins are definition at <mach/mux.h> file */! f: H7 N9 c8 E' L; K
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,9 F' r2 X! u9 w9 b  H$ x
        -1
  d0 X4 G3 G9 O, T2 m/ m' |& R};
& u$ y6 T, C% e3 W
' I) a& Y: B' I% U( u$ P! w5 }static struct gpio_led da850_evm_tl_leds[] = {. J  f+ Y: L$ [
        {& V, j3 u1 ^9 {) J  E' d
                .active_low = 0,
; A7 T$ W) a3 o                .gpio = DA850_USER_LED0,& K0 q! D7 y  ?5 @+ S
                .name = "user_led0",; _0 v  R5 d1 G1 `
                .default_trigger = "default-on",
& _: c0 E- C# f" u        },
1 `/ k9 g/ H, S8 s0 I9 \  ~, n        {4 u! c  ?" a, L8 T
                .active_low = 0,1 S1 Q& _. z7 n9 m& P, H
                .gpio = DA850_USER_LED1,
; _0 Y" d. r+ e! [; m                .name = "user_led1",
8 P* g2 L# q5 S3 M3 `0 G5 v8 m                .default_trigger = "default-on",
2 S0 q9 @, d$ L8 J- g, H* W        },
9 A% D) E4 R) W8 a        {; e2 L: X3 x$ C# v( a% n# \
                .active_low = 0,
0 u1 V9 I- v! `8 P                .gpio = DA850_USER_LED2,
4 c: H- ~+ Y9 J* T+ ?                .name = "user_led2",
* R3 A2 i. \" a                .default_trigger = "default-on",2 N. P2 z6 h& R4 k+ Z" B6 \8 |
        }," w; c* z+ d6 U* M" t9 d
        {  C+ N) D6 ]! P5 ]
                .active_low = 0,
4 k: f( @( K4 O3 d, J, s                .gpio = DA850_USER_LED3,* R  f; W$ @; u  x, D8 X
                .name = "user_led3",6 q* W: _8 G/ u7 U
                .default_trigger = "default-on",
0 f# L4 Y3 U4 Y& e! @        },
9 D. w3 ?9 p+ R7 ?  H( G* u};
9 w2 `8 d* \$ v9 r, R
9 R4 V9 j9 r; F! c8 u- U7 nstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
3 ]4 y  c. S2 n& p# D' }. c        .leds = da850_evm_tl_leds,  x$ `6 w7 ?0 Q! |1 x
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
/ q9 q% J' \6 A0 E- S0 s};
0 j' n" t; C: x, J  R& d6 V9 H' m5 k  K  X/ t/ m0 L
static void led_dev_release(struct device *dev)2 s& @# B% ~& t/ ?6 ^6 U
{& k3 W1 u7 b- @' Z
};3 O: p* p. j8 i: Z: a3 O
+ G( p( o2 P7 s: p7 j! h
static struct platform_device da850_evm_tl_leds_device = {
8 n4 m: c4 r9 u' a' Z5 L        .name                = "leds-gpio",% J" z+ D. \/ x* U0 f
        .id                = 1,5 x% E- Y3 q! t
        .dev = {5 A6 R3 @: ]' Z2 ~/ i
                .platform_data = &da850_evm_tl_leds_pdata,
: y( I3 u1 {0 Y: L& V) S8 i0 O9 m$ y                .release = led_dev_release,
/ s+ ], C$ V; N$ U        }. V) ^  ?  V# D. r9 N
};
$ ]: C3 J+ B: a- `
. D5 p2 S2 r' w* W1 e1 I, A0 istatic int __init led_platform_init(void)
* t( b  z' S0 U4 ^4 e& ]{
2 ~( S: c* V/ `" l# m        int ret;& `* Q  m  F! T: D+ _( m, s
#if 0* v4 ?0 v8 A6 [! v. X5 F/ R
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
+ d5 g! A6 b( q# [        if (ret)
$ T4 P/ k% M! v2 q" w  \$ g0 p' D                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
( O$ \' y7 z& U  q                                "%d\n", ret);
/ w. f3 Q1 H) ~7 d* y3 \#endif) c* t& _2 H! [) u
        ret = platform_device_register(&da850_evm_tl_leds_device);, b* K7 |8 |. h2 ^
        if (ret)
/ w; i& Z6 T4 \& k                pr_warning("Could not register som GPIO expander LEDS");' p$ E* p4 }+ Q8 W3 P9 L
        else& n0 |2 `, t# g: U* A# t
                printk(KERN_INFO "LED register sucessful!\n");
& Q6 s! J7 T$ f( e, b, Q4 g2 q7 a; M. W4 w2 P3 {  z
        return ret;
7 _+ q7 M! L$ ?' X7 B, x}- W$ x$ x3 f. E! o% D" K
3 p! S* {) ]1 P3 \) |0 [
static void __exit led_platform_exit(void)
1 S) B- ]& ]3 r8 d' |{
( w+ F( L; U3 m        platform_device_unregister(&da850_evm_tl_leds_device);
* w% W5 l0 I) ]9 ^5 B7 ^  o1 g0 z. r2 B3 Q' _5 \
        printk(KERN_INFO "LED unregister!\n");
1 `# A, _6 u1 {( I) N8 F. Z}
6 `0 a6 Z1 [6 e5 G( N& b
/ R1 `5 T0 s  \9 n- o* i) Lmodule_init(led_platform_init);
; \6 l( ]' t' @( V' g  ?9 u' W2 R+ \3 r. omodule_exit(led_platform_exit);+ B1 K& P8 W. J# A( O

  U8 v: }8 h7 g% }MODULE_DESCRIPTION("Led platform driver");
$ m8 U0 }2 G+ uMODULE_AUTHOR("Tronlong");' r8 d1 g: ]. [' z+ o& H
MODULE_LICENSE("GPL");
% V6 Y6 n% p5 C* w4 {/ L% B5 C
* G# j  z* [5 h6 Y5 l9 L* A9 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-1 21:28 , Processed in 0.044351 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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