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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
# y$ `# T4 J8 e9 Z' ^3 h& ?( D1 Y#include <linux/init.h>
0 N$ D8 d2 o0 i/ [! ]#include <linux/module.h>" ]9 H8 q5 L4 d7 `0 y3 _3 x
#include <linux/kernel.h>1 `, p2 M) d. Q" C: P" B& a
#include <linux/types.h>( t* H8 u8 K) f6 N+ y5 w
#include <linux/gpio.h>
- e. u% Q3 K! b$ F#include <linux/leds.h>9 U) n' m: B  A! T& i
#include <linux/platform_device.h>
  `. @% B* M: ]) G! q+ E9 Y. z7 }9 o7 ?1 r, q  M) J. E! |' X
#include <asm/mach-types.h>4 f+ T( i+ z; T- Z/ x% S
#include <asm/mach/arch.h>
! N5 h0 y8 |0 P: |#include <mach/da8xx.h>8 S- J- {  N3 b, a/ m4 `! l
#include <mach/mux.h>
, S2 H4 |/ q4 e; v* r
$ y, c! i2 Q# O% ]#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
  K& d+ C5 H3 n- W1 j( t6 b  T#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)2 J/ d9 h' T  |9 ^/ u
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)! k, [9 m- q' X' ?; ?1 M: i
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
, W. \6 R* J- {' G
3 W& m7 G, D* p; t/* assign the tl som board LED-GPIOs*/
/ O7 E. Z) g4 i0 T; ostatic const short da850_evm_tl_user_led_pins[] = {
+ }$ d( Z" @" i5 l6 z        /* These pins are definition at <mach/mux.h> file */8 z( c& D3 W* Z- G. `4 `
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,, A" Q' q! \  B
        -1, h: r$ |( d* k+ f9 n) b, M7 E( X
};
" \0 s) V2 @. n  _7 W& [/ P- Y7 z* I, ^* k
static struct gpio_led da850_evm_tl_leds[] = {
0 L) H  P+ o2 F8 k        {8 k6 t: c+ p% `2 x2 L$ p. s" Q9 Z
                .active_low = 0,5 R4 F, I# c( v
                .gpio = DA850_USER_LED0,9 f( h; A$ {# `  G
                .name = "user_led0",( l' w9 o( v& k+ Z
                .default_trigger = "default-on",4 e5 m, w% [3 N) j9 s; a
        },
8 S% `7 A* f8 D2 G6 r% |7 |        {
* C1 v7 N. w& B( P  M                .active_low = 0,
7 e, S) e% P6 G                .gpio = DA850_USER_LED1,
; A8 X) g, y( p" k4 K. E                .name = "user_led1",
, Z9 M8 T5 T$ z/ s  _                .default_trigger = "default-on",
# j- F  {# o" r) @8 E# h        },
) w% Q5 Q! X: D9 K1 Y8 |9 V        {
1 D- a6 v* e  d) |0 A5 G                .active_low = 0,; v! y; b+ q7 A' l, ~4 F) U
                .gpio = DA850_USER_LED2,
( y+ U5 O# \9 `1 C: O9 D9 |1 M                .name = "user_led2",
4 c7 _0 r( a6 G3 g7 L                .default_trigger = "default-on",8 C! i6 ~, Y3 T2 r, m6 K5 t5 S
        },3 y5 |  r( E* U+ R8 P, P2 l( e) N
        {
: A, S. Z' U$ R7 X, o                .active_low = 0,
* x9 T! B: T1 R; k                .gpio = DA850_USER_LED3,9 H$ `7 X. w$ a% f# C
                .name = "user_led3",# }$ x9 P9 I  c; |* b. K
                .default_trigger = "default-on",- U8 [! C- ?6 i; Y0 |
        },! P7 H" b3 t+ j1 S& G9 K7 Z: ?) A
};
# o$ ?4 J  Z' T! x
( p0 Q+ t$ h0 h# }& e0 k1 @static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
# E+ k' w. }4 S6 O  o' f        .leds = da850_evm_tl_leds," V, o7 M& t$ W9 ^4 c' {1 p
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),! i7 [) U1 Y8 J: ?: g" C# \
};) L3 o% l/ n( O5 v% E- u

, b- k3 j5 w7 x; R' k. G' Fstatic void led_dev_release(struct device *dev)
/ O+ w; a. C5 a  ]& c" p' j' K, z/ S{; t+ {; e+ O" V/ \. F
};3 e) f! _9 T$ c6 n

1 f9 r& h1 }/ }static struct platform_device da850_evm_tl_leds_device = {6 n" r, s# ~6 o3 |7 K
        .name                = "leds-gpio",
. b' z+ o( G$ \4 {! K        .id                = 1,
: E2 k- W3 G- c% d2 L        .dev = {
5 @, C$ m3 q. K8 H( l( Q* V8 X                .platform_data = &da850_evm_tl_leds_pdata,
7 D% A- @( m5 |- u" k) }8 X                .release = led_dev_release,
8 N6 g; y/ V8 d, o        }, I6 b) {+ s$ Q+ y
};
  a1 A% _8 u1 s/ b( S. z$ V- n. ]5 q- V
static int __init led_platform_init(void)8 O0 _4 }$ Z- o; s, m* P
{* \) z! f# ]3 m% T* B5 P
        int ret;& i# A5 u# w" O3 T4 ^# w
#if 0
  a) O% \4 Y! f+ f* ]        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);% o; {! Y) ]7 ~: Q2 d
        if (ret): H" \2 y: f) c
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"* c1 y, M2 t5 h9 G7 [) K4 e& m
                                "%d\n", ret);
6 n! @/ F8 a8 w#endif
; v  P3 I+ J8 q1 g9 D        ret = platform_device_register(&da850_evm_tl_leds_device);+ x- ~) V- }2 _/ d
        if (ret), a4 H5 J5 s/ }5 H9 a! n! X4 b
                pr_warning("Could not register som GPIO expander LEDS");
& Y* @3 e8 k6 L6 K$ S) i; p        else/ b2 W4 ^  s  P0 @- H2 I2 ]
                printk(KERN_INFO "LED register sucessful!\n");
+ B8 I, G# x/ \% M8 S  s8 E; F2 n# `" R% {' b- J) z: A
        return ret;
' [2 {9 R6 M$ Q* S% O}
- ]: j0 z" R5 O0 E3 b& m: j" e6 D# E* H9 W9 e4 G4 h9 \
static void __exit led_platform_exit(void)
, \7 X4 ^- J3 G( U4 K0 K{
! w; Y+ a1 Q  ^1 U, n* w        platform_device_unregister(&da850_evm_tl_leds_device);8 x6 B" K) J7 `6 }4 r

# a  A6 e# C9 u1 q2 ?        printk(KERN_INFO "LED unregister!\n");# N1 R  }/ J5 B, _9 l+ D- I6 c
}
9 T- b+ }$ r4 i/ k1 a
: o8 Z* \0 V2 u: ]* fmodule_init(led_platform_init);/ t  x) H. @) Y3 k* c
module_exit(led_platform_exit);5 o6 \- |7 U, i5 c
# a4 ~8 K1 S, V. Y
MODULE_DESCRIPTION("Led platform driver");3 G9 V5 ~. o$ F. W  N
MODULE_AUTHOR("Tronlong");
5 g  g. N. s3 i, CMODULE_LICENSE("GPL");% u  }5 Z/ `8 ~# u' }

! S/ q, @! w' @1 i# Z& M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-29 04:32 , Processed in 0.035161 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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