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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
1 a2 _' k& s6 O& [* E2 {#include <linux/init.h>
8 a3 U0 Z- b; m* K#include <linux/module.h>( s) V* R0 M& q* X
#include <linux/kernel.h>+ R6 V' b- q+ l! u+ u4 s0 U& A+ @0 Z
#include <linux/types.h>
& t# U# ~7 Q% k+ D6 [- W6 n6 ^#include <linux/gpio.h>) U+ @2 k; q0 d
#include <linux/leds.h>; u" }1 K& a0 ^3 W
#include <linux/platform_device.h>6 Z3 j( s: g" U7 Q6 \1 y2 o  Y$ l$ D

1 y8 y+ d  R1 m  i. {#include <asm/mach-types.h>) V: M" y& K* h" l' x# Y9 R4 a/ R
#include <asm/mach/arch.h>
: S! G' F9 F# S  T$ x& ]% Q#include <mach/da8xx.h>
% t0 }# O" l1 s, p) j. Q8 w#include <mach/mux.h>
: ~" j% e1 }; o& _6 {; v3 f' U- n, |$ H6 ~* f6 j0 I- l
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)/ z5 T$ X$ x+ T% ?- a. v2 ]
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
6 T, k. J9 C+ C8 S7 |' b#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
$ j" O! u5 B8 T6 G& K7 Z: i8 P#define DA850_USER_LED3        GPIO_TO_PIN(0, 2); b% `/ d' w3 P* D. t0 I' x

" E# i# F9 g1 E9 f/* assign the tl som board LED-GPIOs*/8 k+ d2 M* i- v" Q1 v3 ?8 {/ P
static const short da850_evm_tl_user_led_pins[] = {- o# ~/ f- `, @* v1 v: \
        /* These pins are definition at <mach/mux.h> file */3 l# H! X5 m, G/ V7 ~
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
8 I, C/ y" W, h- c: R4 @        -1- U+ N% @5 B  r% h4 J7 |% E) {6 W1 F
};/ m( L! ^; P1 B) N2 ]' D
) x6 ^8 u# j$ d3 R0 ?! @
static struct gpio_led da850_evm_tl_leds[] = {* O" Z7 O$ |8 e3 {: t0 y
        {
, \. g9 s! e% U3 f                .active_low = 0,
: `7 H$ l6 x. p% a+ f% p) V                .gpio = DA850_USER_LED0,5 t0 [3 o* E2 x- b+ g( ]
                .name = "user_led0",% g$ D: j% h- c8 Z
                .default_trigger = "default-on",
, U) `+ V# y$ P$ b. ^% w        },
/ ?, g. h# ^. y9 u! Q4 T        {. k- i( v. _- R& g! z2 \0 S
                .active_low = 0,9 z2 \( V; B5 R- M. G4 K& T4 f
                .gpio = DA850_USER_LED1,* y  t/ z% w. h) Q4 R: r5 O; c8 [
                .name = "user_led1",6 V8 v' O% m* Q/ a. H8 D
                .default_trigger = "default-on",
1 n( u6 Q  i+ w/ N        },* s+ E$ |9 B! V0 p* V) s
        {
8 A1 o% F8 \) |3 V                .active_low = 0,
4 \3 d( C4 b& O; E. Z                .gpio = DA850_USER_LED2,
, y( N! f9 p' U- f2 m1 S                .name = "user_led2",
  Z& h$ [0 u4 P6 g' C                .default_trigger = "default-on",: o9 E3 J4 r8 g# `
        },
( M5 s8 g* v" f3 v        {
3 S% e/ _, Z* ~4 s8 m: w1 y/ x( Y                .active_low = 0,
8 p: q2 \# ]4 m! d  H( l                .gpio = DA850_USER_LED3,: p& G  f; o, G, L8 l% ]& ~1 Z  I' @
                .name = "user_led3",+ m' G2 z/ v! l/ [( }& I6 S0 d
                .default_trigger = "default-on",
0 U! Z( @( i' H        },8 L$ M; }/ W% W& ~8 ~/ m/ t
};
" D/ f$ X1 W" \
& S" ^1 {/ N5 l8 c; zstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
5 `0 L- ?) x, |9 A) I9 G# t6 X        .leds = da850_evm_tl_leds,
3 W5 r3 e/ {2 k1 U3 Z        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
: ?7 u! u$ m; r! |* V};
# Y/ ]) f0 I/ z0 ~% ^
$ C; t# Y$ b$ }& E, Kstatic void led_dev_release(struct device *dev)+ B6 G' {  s3 L/ i0 f, L: l! Y
{* w$ S9 Q4 A# H3 }* W
};. s: }9 p9 l, f& ?

  d3 \6 }1 w! F4 B6 I  \% Ystatic struct platform_device da850_evm_tl_leds_device = {$ j1 N/ @: F2 o
        .name                = "leds-gpio",$ B2 _, K" ~# {/ P* L
        .id                = 1,
% {2 k- R. j" z2 y9 q        .dev = {; \& S4 Z# T3 x( g+ T; Z
                .platform_data = &da850_evm_tl_leds_pdata,
: i* P; Y$ m% S: a# F2 z* |                .release = led_dev_release,5 @2 t) l/ k! x) P8 [2 \' L
        }
, q+ W* H8 ~3 K0 h};: D7 T, v$ [6 w' D7 {! a! ~
% ~- i/ f3 V  W6 i; l3 n* b% e7 U! Z
static int __init led_platform_init(void)" H' W5 s+ ]! _6 t9 u' K; h
{( V% S: F1 v& O. b! h
        int ret;
& F- n" j* T# R5 x7 z#if 0: F. b( A  R/ L8 w
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);! M- T; b# `' Y' X2 W
        if (ret)6 S7 L/ w* U& o: p# ~  i
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
) i0 d. T! O  v# m, d5 m( P                                "%d\n", ret);4 ?+ m( j6 A7 Y! ]  c; ]
#endif
2 D5 {7 v% M9 u% R        ret = platform_device_register(&da850_evm_tl_leds_device);' [4 F! \' A: u* j  x2 v
        if (ret): X! R/ S- h9 e- C9 M, ?& {
                pr_warning("Could not register som GPIO expander LEDS");
" |& W: ~* R1 h5 t) v        else
& ?, p% [) k8 {8 @' k                printk(KERN_INFO "LED register sucessful!\n");
. _4 x0 E8 ~. C  z$ ^( g  ?  G! S) {1 ]& b0 H# e
        return ret;) Y6 b  N- `) p4 s' y0 a1 f! ]
}1 G4 c4 ?; P& M7 M* h
0 h' F% c" F0 |7 S
static void __exit led_platform_exit(void), i: c' f2 e$ w0 \
{8 K& i! K" D$ [2 R' x
        platform_device_unregister(&da850_evm_tl_leds_device);
+ Y0 g9 g+ c# N: x7 o, L, O9 b4 G  N1 p  n
        printk(KERN_INFO "LED unregister!\n");5 h, t9 _+ a8 U) ^  T0 e0 i
}
/ n. J; \2 ^1 \4 x% j, Z% \0 Q* @- m2 m. V
module_init(led_platform_init);3 Z4 z: g% |8 D3 H
module_exit(led_platform_exit);
2 Q" _7 l+ _' T: H0 `4 f
: Q5 P' k; a: wMODULE_DESCRIPTION("Led platform driver");
/ Q0 s  Z' b1 N. FMODULE_AUTHOR("Tronlong");
5 o1 q9 J( W) V8 G* u4 KMODULE_LICENSE("GPL");6 S9 ^2 X( r' x4 P

, J/ A1 ?5 \. I: T/ t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 08:03 , Processed in 0.038248 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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