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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
# i3 ^1 w, m( `' T- p#include <linux/init.h>0 K; A3 m. L1 C/ b) f  Z
#include <linux/module.h>+ Y& j/ a* D* H$ \# B
#include <linux/kernel.h># U6 c8 g6 z8 ]* v2 x- w9 ]9 O
#include <linux/types.h>
! X" O3 {( t7 q) Y* D4 d#include <linux/gpio.h>2 W" `% ?* s: X
#include <linux/leds.h>2 C) R& y" C5 S! F" M/ n# c
#include <linux/platform_device.h>- r% M' v* g( d
& ]- B& K( ~: {! J: d+ Y/ E% x. |
#include <asm/mach-types.h>! h" R/ ~) l/ c1 G. `7 ~: E
#include <asm/mach/arch.h>2 Q; g6 t* o$ o2 Z6 X
#include <mach/da8xx.h>
* v8 |% r- `3 D0 t' O) s) K#include <mach/mux.h>3 ^& H$ _, f7 A) [5 w* {
) z" u, w! z4 j  A! R) K6 W- l8 c
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)* g) T& c9 |: q( I8 ]
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
( \! a- m% `; _$ A  V! ?#define DA850_USER_LED2        GPIO_TO_PIN(0, 1), [2 B8 \! R& N3 P% O
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2). o+ t4 s& W, Y

! n0 Y5 L' d2 Q6 @: i; X. a1 l/* assign the tl som board LED-GPIOs*/
4 Z) C4 ]5 x0 Y5 I" t) [0 `static const short da850_evm_tl_user_led_pins[] = {' E! B: H& i# T9 o9 Z1 z
        /* These pins are definition at <mach/mux.h> file */
9 k8 e, r$ X, a) n1 s7 k9 o. v7 D  w        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
, h4 W  \" |) c4 P, U8 \6 ^0 i7 X        -13 [0 Q* w5 K5 r4 y4 U, d8 }1 a+ Z
};7 M/ S2 q- `1 l
( z$ w) Z4 R8 q8 r
static struct gpio_led da850_evm_tl_leds[] = {
4 m" X( ?9 I/ S8 o9 s' a. V/ t        {
  H$ y9 C# W. t  B0 b/ ?  q0 A0 b                .active_low = 0,
9 o" F1 G) k2 h- t# s                .gpio = DA850_USER_LED0,
8 B/ q- |- q  l9 e: c- k6 [+ u                .name = "user_led0",5 v0 Q! T5 X* z6 Y
                .default_trigger = "default-on",+ z4 \6 }; S' g
        },' E; {. z( M/ |1 s* g, P1 L
        {
/ b5 w7 |- f0 N3 J+ m6 |' T                .active_low = 0,$ e" Y* g- X5 a7 X6 j
                .gpio = DA850_USER_LED1,
8 `- S  |2 A2 G                .name = "user_led1"," x# Y  G1 s6 C# q  ]
                .default_trigger = "default-on",
7 \$ A- X! v- K, d' C5 v! F" y        },# H; k& h' h- o; K; x2 U3 t" d3 j0 ?
        {
5 N" P1 X6 V; Y6 F7 y& `6 ~* @                .active_low = 0,
# @* d( \$ |& }$ d* ?; j                .gpio = DA850_USER_LED2,  G/ f0 M1 S$ A
                .name = "user_led2",
- E6 z, I5 L2 J" q- J$ q                .default_trigger = "default-on",
. y, |9 h5 M+ i3 ^        },
( @3 N1 ]8 @4 Z$ x% }4 l1 l        {
/ [- Y6 T) `5 J% |% t+ Y                .active_low = 0,
: W, T: z% W7 X& ?                .gpio = DA850_USER_LED3,) I  y2 T9 C+ g1 A( c+ ~0 m
                .name = "user_led3",
! F3 l9 \8 m, Z8 [2 R                .default_trigger = "default-on",
, [# `  r/ i) n. A# J; D8 |        },
9 ~0 k5 A* x1 W};
2 q' h( K5 K8 o: g) ^) J4 Y, F' U/ U1 V) Q8 M# n1 f
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
: f8 j( ]& ^( e) e4 j, n9 h3 N        .leds = da850_evm_tl_leds,
! t# O" |6 n! ^        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
' v$ }: ^  C' K- y2 q0 X};
# o/ G0 o, T, E; o
" X4 }0 {7 s" ~: b% T, Xstatic void led_dev_release(struct device *dev)2 v8 z/ `- I3 g1 `, ]1 Q
{
) h4 m" V. m5 i/ q) y2 {};
( S( R: x% o- {* i6 d) o9 }' Q2 w. F4 ^/ u0 W1 Y  `2 q2 s! q, L% z
static struct platform_device da850_evm_tl_leds_device = {
! W, V- A! x  M! O$ t) s        .name                = "leds-gpio",, O& P4 y. k. }6 p5 G) F$ B
        .id                = 1,
, H4 B. c  l: |/ e2 h        .dev = {
- e) z3 W- `; n# Q% I; H                .platform_data = &da850_evm_tl_leds_pdata,
% D$ f9 c; R. \                .release = led_dev_release,4 f2 c# u* H6 v/ O" L% |- X0 b
        }
; e1 l; D) e/ X! g7 z: C) D};
) P. n* {1 R! F, T  E. d8 v. }0 c+ y0 b
static int __init led_platform_init(void), \. P4 t; s5 H% a! k. c7 C
{7 z8 o" Y) I7 @
        int ret;
7 M' o( P0 }2 t. u5 l5 I* S#if 0
( V8 X; ?! t  ~) Y/ a# w1 Z        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);3 Q. V) j  P9 |* |
        if (ret)& D& r  h1 D* j8 @( M, h4 w
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"- |2 e/ R2 J' B8 F+ j* D! C0 I
                                "%d\n", ret);9 u  j* q! K+ N4 D$ Y' `, e$ V6 k4 i
#endif! \6 u8 w! w; W$ l" A0 e1 E6 b
        ret = platform_device_register(&da850_evm_tl_leds_device);( T0 q9 s# U; d% V% e* f8 ~
        if (ret)
; f# B, o& [% @5 C/ t$ r/ K' p9 f                pr_warning("Could not register som GPIO expander LEDS");0 `0 f2 ?) T; n0 t3 c
        else
0 C/ V9 _. H( G* h/ R3 `                printk(KERN_INFO "LED register sucessful!\n");# I1 _- d+ d1 `
2 F6 d0 {  d2 E) L0 z& a2 l
        return ret;& U& u5 b) s+ _: s
}
" _" e' Z& a1 D% q. P$ `% N( E7 X' z; T3 D3 a+ J3 R' m: V
static void __exit led_platform_exit(void)
5 r4 D% l; J  h% F( @+ r7 e{8 R5 `6 B8 l8 {$ j: ^5 K
        platform_device_unregister(&da850_evm_tl_leds_device);
& ~* `# e' [" G: v* F3 E1 C. R( ~! ^- T, X1 w; C6 D
        printk(KERN_INFO "LED unregister!\n");- q% d8 Y7 I' n* H* g
}
* l* t: b- t3 c' y; `; H( }3 S
: J% l) `* Y1 T  N! umodule_init(led_platform_init);2 W- r7 y4 x, A' }2 a$ `
module_exit(led_platform_exit);3 D3 u6 w# P$ `/ e0 Z2 g
5 W7 ?* j5 z/ S. ^
MODULE_DESCRIPTION("Led platform driver");* h1 [# k! u( G- ~# ^
MODULE_AUTHOR("Tronlong");. y: b% x6 z2 O0 r- t# D
MODULE_LICENSE("GPL");( V6 F9 b, `: z0 i

- Z6 F$ c1 G/ X' o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 01:17 , Processed in 0.039298 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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