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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
1 S( k$ u  |3 U1 K#include <linux/init.h>, J% y( i6 `% @) M0 v( c
#include <linux/module.h>; S' n2 N6 ~8 |% v; p
#include <linux/kernel.h>
& `& Z. {) H( ?#include <linux/types.h>
& g, A; I8 F, ?7 G#include <linux/gpio.h>+ @+ r' z% G9 P6 W2 o9 F# M
#include <linux/leds.h>8 K5 X; |, V. B7 f$ O5 B
#include <linux/platform_device.h>
) x5 E' H; z# C' w0 b& Q# Z
+ d2 a. J9 ]$ S9 D/ W3 n: U0 F#include <asm/mach-types.h>
2 d' O5 y# y4 Z3 C9 n#include <asm/mach/arch.h>
# E& B  i1 h" i" i, X0 w- D#include <mach/da8xx.h># ]1 }3 x0 [1 S5 L  m
#include <mach/mux.h>
$ l, @  T# G/ m2 F/ B6 O4 v
# A! Z" R" d9 K/ ~, A- Y, C#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)6 S  Q' _2 U( |3 Z2 y9 m
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
: J( U+ j" K6 k$ }#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)3 E% O" ~4 ?6 }) }
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
: D+ s1 ?) q" j. b8 o: Y" R% O
% e4 l$ j* x& x: B! f/* assign the tl som board LED-GPIOs*/
, J2 c( T: P3 O: G) ?0 [static const short da850_evm_tl_user_led_pins[] = {
( U" I$ `& \% R! I7 s+ Z        /* These pins are definition at <mach/mux.h> file */
1 S2 e' y; p' b8 W        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
. K/ W# f; L2 B+ `. b& k! _        -1
: Y! I: \# d; Q. e, o: A- ~  t; E};
. @$ G6 ?: v* S- X0 c, `% j# r) [; h+ A2 a) s+ V. G( R
static struct gpio_led da850_evm_tl_leds[] = {
$ I5 E6 Q) u  t        {
8 r, X% Y) ~3 d                .active_low = 0,
- ?. w; n9 U2 ~                .gpio = DA850_USER_LED0,
0 u+ ^6 k+ o7 u# i' d5 D$ N. P- Y                .name = "user_led0",7 l9 ~: H. E/ c  I' y2 M
                .default_trigger = "default-on",- N8 c2 A4 z5 @9 S
        },6 U5 d; U7 d' z# V0 ?
        {, i, r8 N( T4 X. B
                .active_low = 0,- I4 O3 ~$ ^1 w: h0 M
                .gpio = DA850_USER_LED1,5 {, W7 H+ s5 d  p4 x# G8 ]! r
                .name = "user_led1",9 }6 b, H) O' K6 v( W
                .default_trigger = "default-on",. [& Z3 m& i4 P* C
        },; D# C- b+ B& }* h& f
        {: U, m" l/ L6 k% m: K8 \
                .active_low = 0,8 i8 E) A1 t* m" o9 |
                .gpio = DA850_USER_LED2,
. n3 ]/ y. c3 M- Y, K- B$ D                .name = "user_led2",
# U4 g/ ]' _! e  W, e/ ]                .default_trigger = "default-on",  P3 ^% C% c4 C0 o' @
        },
2 Z+ m6 U% w+ a; W5 ?        {7 h% R  \+ }7 I  e% e. H/ W7 l* x
                .active_low = 0,
) n- {# N# i+ Q0 e9 H0 f* w                .gpio = DA850_USER_LED3,
) u$ ]/ `4 M% r2 B1 t5 e- K                .name = "user_led3",
8 P, ~+ K9 J. |1 [                .default_trigger = "default-on",
6 c6 ^2 a. h: v: B+ o$ _/ V; ]7 B        },
+ P4 ?  P/ b) u: J};. n; \+ C) R+ Q: X- C! Z

; R  S, Z; y/ c  S' j/ Q, t# {static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {9 O  g- D! Z! U5 ?- A
        .leds = da850_evm_tl_leds,- u$ n! ?9 [1 h1 V4 {$ }
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
, U9 D- V0 E4 J0 h8 m6 t8 x};/ O! C4 M. m$ C& P

4 y& p& [& d. Q- ?+ D; v; Nstatic void led_dev_release(struct device *dev)( M0 \; Z4 G. r3 S! V" s2 i
{8 x6 N1 j2 P7 i+ p1 s- F$ Q' H
};9 O' \" l0 H, J* S9 ]. k
$ O( V4 `% N  M- ]- c
static struct platform_device da850_evm_tl_leds_device = {4 {7 B. m8 g  z- w/ S- ?+ x( v3 E
        .name                = "leds-gpio",
, {0 a; L% M; Y! j4 A9 w) d        .id                = 1,2 ^* u. ~% E- m/ S6 D- ~4 P
        .dev = {% e0 y+ v/ D. ?( K
                .platform_data = &da850_evm_tl_leds_pdata,
# h# _; J& V1 i( A                .release = led_dev_release,
6 c5 [$ n) d% O1 {( u, F" z$ M        }
/ y& u, E2 a) L& M. D6 P3 q/ D2 T$ V};9 l, |% z  T4 M$ L% J

& o2 Z  p- D5 a, }/ x9 dstatic int __init led_platform_init(void)5 L+ l0 q0 n0 a
{
+ ^, s' _9 q/ e. M" b0 }2 {9 J        int ret;
( y& Z) P4 E+ @* A. E#if 0. Q! `' T# O, U3 L, @3 N) y" r3 I3 X
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);) E. h9 Y7 t# F8 G2 M
        if (ret)) c0 d0 q. R3 t5 g+ u
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
- C+ O+ O6 f; G" p                                "%d\n", ret);
' y+ y3 ~* X/ a* F0 R#endif0 \7 c) {: w. U
        ret = platform_device_register(&da850_evm_tl_leds_device);% Q( ]! V% ?) e4 ^0 v; `4 `$ U( m
        if (ret)
( K; X& |# {- l& D( Z- v                pr_warning("Could not register som GPIO expander LEDS");" r3 Z; h0 S- }- w
        else( O% y9 `) q6 U  \& b9 w6 {/ v% n! M
                printk(KERN_INFO "LED register sucessful!\n");
+ O. L' B/ K. D2 n9 E. q: ~- C+ H9 B' I: M0 y
        return ret;, j* T$ J9 B$ q
}
4 V: i/ Z, r8 W4 V: b- S$ Z
5 q, b5 Z8 Z; W6 M& a' C2 Fstatic void __exit led_platform_exit(void)% z5 ~( Y) D- p0 S. X" F
{
5 T; A5 ]- i8 G4 ?( S        platform_device_unregister(&da850_evm_tl_leds_device);
& r) J* X$ ^$ }- [# u8 c/ ?( I# \" F. B1 q. c
        printk(KERN_INFO "LED unregister!\n");
' G# c8 V. t# i8 Z4 d4 l4 `7 l}+ d; ]2 K' m6 {. Q

1 E0 L. K6 T* d9 {- K+ V  hmodule_init(led_platform_init);  Z  I1 M5 ?+ h
module_exit(led_platform_exit);
( H( y, f+ ^/ s3 N$ w# C3 f
& x+ w- l7 F# N7 |9 c) _0 ?1 |9 tMODULE_DESCRIPTION("Led platform driver");9 S+ h1 W& E- }7 R! w4 M
MODULE_AUTHOR("Tronlong");
4 b5 J* Y0 }6 I2 X) Q: nMODULE_LICENSE("GPL");$ n2 U3 D. U- H0 d  B

* S$ a$ Y) g8 {7 M6 J: V  [1 x* x# z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 13:22 , Processed in 0.040229 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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