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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
/ A, o" T: B) K" v2 c2 J$ [#include <linux/init.h>4 w5 r: h3 H+ B0 K$ f5 N
#include <linux/module.h>3 B& a6 |- @, l- ^. Q/ J, d
#include <linux/kernel.h>$ r, t: r6 w0 U: j6 M9 |
#include <linux/types.h># |0 r: v( Y: ^) B
#include <linux/gpio.h>* {7 e' @% H- I  e* ^$ m
#include <linux/leds.h>
/ ]$ D6 D" L0 \; q& B7 q% Z" r#include <linux/platform_device.h>/ g, O% z1 ?  b  f; P0 e4 P
" T! H0 d& y' ?: e* y
#include <asm/mach-types.h>! |, `: _& o" y* S0 Z
#include <asm/mach/arch.h>
( D6 J+ h7 [& Y* s& Q2 m2 ^#include <mach/da8xx.h>; l( m( s; E( H; e# t2 ^  v; S1 F2 w
#include <mach/mux.h>
+ u' C; G5 n$ H1 ~# M9 f! ]4 T$ r1 a! N0 r7 Q
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0). q' d' U% D7 v- R7 c/ Z- G# }
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)( \6 C5 y( m+ z8 U9 |& b3 p
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1), s+ \- i7 I% J2 `# i
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)2 U+ P! F, h7 n$ n( J0 z4 H
! Z1 b9 h1 S( q7 O+ G. ~
/* assign the tl som board LED-GPIOs*/
9 ], h3 y6 a# H/ gstatic const short da850_evm_tl_user_led_pins[] = {
1 }2 A/ |2 V! u7 V/ H  z  [        /* These pins are definition at <mach/mux.h> file */
5 g+ a+ |& d6 ^4 I        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,6 h% o- x( Y$ R
        -1
1 ?7 j$ X1 `8 ]};
7 W* D9 `2 l4 a5 c  [% G4 k3 {- K  }$ W& n0 ?% q# z* k
static struct gpio_led da850_evm_tl_leds[] = {
' r0 z; F, X" `. [) z! N        {. \' b8 Y+ i0 V7 L" B4 W
                .active_low = 0,
  J5 l" g( t2 }  h$ e                .gpio = DA850_USER_LED0,, K4 _8 K9 [% r
                .name = "user_led0",$ x" p% s0 X5 F
                .default_trigger = "default-on",
' Q; C* ?1 `! r1 S3 ~        },0 a+ @0 S- N. W
        {
4 A8 E+ W4 e  I! f7 R/ O                .active_low = 0,
8 r% C' C* {$ T2 P                .gpio = DA850_USER_LED1,
* S) s  `) K. p0 x: n; o% t                .name = "user_led1",
# o7 Y/ w7 q( m/ d/ A5 R                .default_trigger = "default-on",
0 R, C( ?8 K# c" y& ]1 [        },
3 g+ A& y4 ~$ u& ]2 g: N8 X        {
4 J: ]* `* ?8 I8 x8 u9 y                .active_low = 0,
1 }# _1 ~  g( d! i) Z+ Z                .gpio = DA850_USER_LED2,% L, V# {1 x0 y' W: v- z2 x) d3 u6 z+ M
                .name = "user_led2",1 H9 u% g- G# P6 Q
                .default_trigger = "default-on",
" v% P; E6 a1 V4 s  [        },) u1 l9 b, j: M  w. }
        {: i3 ^6 P, d2 Q/ J7 W
                .active_low = 0,& S' n$ S- @2 N% I2 o
                .gpio = DA850_USER_LED3,) m3 `+ Y. B% ?( I3 A+ m
                .name = "user_led3",
% q$ }. M+ U+ [1 w% j% H                .default_trigger = "default-on",4 {5 e, x$ H6 r, P6 R- P/ U
        },
* m7 G/ P, Q( c6 X  m/ H};/ ?) o, ^' a2 D- |" ~

1 k. K1 z* }9 K; pstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
2 u0 t: @* W0 N4 A$ k' P/ m2 ~        .leds = da850_evm_tl_leds,
3 E; i/ B( u) J6 a& J        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),! q+ H6 Q. W2 d, \
};# f. V6 f1 Z+ ~- l! \) {3 U

8 Q$ I+ ~( J: I; c% i1 J. astatic void led_dev_release(struct device *dev)0 }" S8 Y) Z& V1 B/ v
{
4 a0 L' L4 M4 m. F6 ]+ [};
' D  t$ }, D4 c8 b7 p9 |) Y) k" H7 n, f( M6 ], Y
static struct platform_device da850_evm_tl_leds_device = {
* |# @: E: k, O- x: Q1 ?        .name                = "leds-gpio",! ?2 x* j  |( I6 G: `: x
        .id                = 1,4 b6 K: c* o# }* v4 E5 E7 y# b
        .dev = {
- f" s6 _" `; n; T) ]& p, a) t4 p                .platform_data = &da850_evm_tl_leds_pdata,/ g7 m3 G. o  k- R3 w: \! J. g
                .release = led_dev_release,
3 ?6 {! d/ s: v( x& Z% D3 m( W        }1 T6 U0 k/ n. ^' ^3 g( m% p$ |
};; I" V& d2 ?3 H8 t, N* |4 |( u% X  b
$ G' d9 e: B6 j! @7 G0 T3 d
static int __init led_platform_init(void)
5 k0 D. V! O4 ^. v5 j2 b1 R6 b2 e* L+ k{1 O3 }6 {8 V# V
        int ret;& i5 m, S5 D# C0 W' V
#if 0
8 q: G0 E# J' D% x; a        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
, B8 h7 D% Y2 u        if (ret)) l4 T3 {7 x# j4 y2 P
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
4 X. ]+ e3 H0 u3 f) ?9 C# o                                "%d\n", ret);4 P2 E* F5 G; g' D* `* N/ C# U
#endif
  [, n( I- c* R        ret = platform_device_register(&da850_evm_tl_leds_device);
! O6 O& _% p( |3 K2 K  S7 \        if (ret)
! R3 p7 z0 f  _) A5 ?$ m                pr_warning("Could not register som GPIO expander LEDS");8 N/ z6 O& f8 v) k+ M! @( \3 t
        else
. T/ {& q; F& Y7 L                printk(KERN_INFO "LED register sucessful!\n");
, i# w) @& N$ v, c! T+ E8 q1 J; e5 N8 J6 b& c8 e
        return ret;
) a* I3 j  A: X' C}
& w* S' m8 f2 q4 e# T0 U
0 ~- ]+ b8 `9 `) w- P1 [static void __exit led_platform_exit(void)0 C2 h1 }% i/ q  p0 a8 n
{
% t; y7 P- X9 l        platform_device_unregister(&da850_evm_tl_leds_device);
3 t* P; V, `* O  {. B
( d/ ~) Z3 \8 i6 g" Y- ]$ |        printk(KERN_INFO "LED unregister!\n");* p6 L1 E+ |5 F6 h5 Y# }2 z
}
% K- l2 N" _6 g: a! Y# h  D$ O" G* z. C' K; e" b, a
module_init(led_platform_init);
* m: y8 B  S4 Y3 M" V& b/ l/ ~module_exit(led_platform_exit);( r- \7 Y/ }, O6 H! z

# o$ H; ~% n  t7 ]; M* P0 [2 iMODULE_DESCRIPTION("Led platform driver");7 X' E6 o7 \( r) j3 O8 |
MODULE_AUTHOR("Tronlong");
& b0 i+ ^3 Y2 |; R( X, hMODULE_LICENSE("GPL");
8 b  H6 b1 u1 k% Q
0 s1 J: m7 S4 T" G" F+ `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 22:59 , Processed in 0.038657 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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