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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
# H1 R3 n( S+ q4 V  S1 _8 w( l) y+ T. r#include <linux/init.h>/ y9 n8 f+ y# d- s6 t2 A. @6 |
#include <linux/module.h>
6 I: h& L+ {1 K: o5 `# x: Z! }#include <linux/kernel.h>, b7 k" [/ Z" F" b/ k" ]) ~: T
#include <linux/types.h>. `: Q- Q; F8 r( ?# E
#include <linux/gpio.h>
6 M& l3 }! F$ o5 y' N" k4 v#include <linux/leds.h># k' |* J9 L: \
#include <linux/platform_device.h>
* J/ l# a% o: e6 `  a. c, S9 [* o1 M5 p  R) v" l: G! t
#include <asm/mach-types.h>! w7 |: X: a- J5 s& @, P$ P8 G
#include <asm/mach/arch.h>
; O, F/ N2 d. H# ^" T) O$ r#include <mach/da8xx.h>
; ?& @( v' w  O' ^) q#include <mach/mux.h>4 b2 Q% T' b& C) U. I0 }" ?, [8 O

& U. O1 {; n7 b: Q#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
# j9 \, i+ ^' v#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)3 A; S, q/ U& q. d8 m9 R9 u
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1); J# M# V# J2 V/ I1 Z
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
* m/ E4 i8 o9 t' a* H& m9 D/ l, L6 S* r- \
/* assign the tl som board LED-GPIOs*/% J! Z  q* W5 {# s
static const short da850_evm_tl_user_led_pins[] = {
5 ^3 K" b1 I: r, R( h4 h- x' ]0 @        /* These pins are definition at <mach/mux.h> file */
, d/ ?" g0 U/ p) j* v/ E, d' `: C        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
1 E  W! `2 e. L        -1: n% x5 w" F$ ]8 \
};
# r- C% L- B9 ?" s4 D7 a0 h5 s2 m  q) o3 T9 V4 r) e
static struct gpio_led da850_evm_tl_leds[] = {
2 ]5 g9 f1 n6 r( K  E6 z. Y        {5 x% [+ g# Z& ?" R5 @8 t
                .active_low = 0,2 ]' {5 }0 H$ G3 N2 ]
                .gpio = DA850_USER_LED0,% C' H* Q8 Q: j& I- E1 W: ~) g9 r" W  _
                .name = "user_led0",
3 n; R+ i. ~* d1 S                .default_trigger = "default-on",
+ Z! C! u. q+ y% X. _" t1 [  s        },( O1 w- p$ K3 \8 N
        {$ N1 s* \& r5 C3 e
                .active_low = 0,
" ]) f* w" T8 F, g$ H5 R                .gpio = DA850_USER_LED1,
$ e- S; }. [! m; v& h5 {                .name = "user_led1",
: [8 H3 E3 e( ^( y                .default_trigger = "default-on",; s: S' t, T8 T! _" h6 C  c
        },
) k: L& A3 u; z& Z( {$ w+ b( B        {5 V6 F$ H1 G- m
                .active_low = 0,* U$ Q) C8 e! Z/ V- {5 [
                .gpio = DA850_USER_LED2,
9 ^! }% P3 d0 Y  S; j- u* ~                .name = "user_led2",
' M" u+ z2 ~1 o6 R0 L                .default_trigger = "default-on",/ ]: d8 a1 X6 Y& ~' N- B. e" A
        },
. S/ c- _) K9 \0 E5 T. J        {& {9 x8 J. I/ M$ d3 Q8 s
                .active_low = 0,$ d7 |! Y7 B6 W2 O( g9 R& [
                .gpio = DA850_USER_LED3,: d; P) j# r4 H) F/ B- t
                .name = "user_led3",* q3 Z& c0 H% A1 l0 T
                .default_trigger = "default-on",2 l2 `" H8 {, b
        },
4 c2 T- a/ Q) Z};& y+ }8 x! t" h

! q1 N+ |& f6 O  Y* Rstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {2 D8 q2 @4 @8 r
        .leds = da850_evm_tl_leds,
( I# o: ^  N5 L        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),' K$ A" K8 x9 X) }) B# o
};
1 |, F5 E8 W* _: r
( r" `3 H3 i. m- a( e/ fstatic void led_dev_release(struct device *dev)
* |* |* i8 E1 v! q" q. w, w{3 R$ m7 `; u- q+ R6 p' E2 C1 Z
};
3 j/ U8 K8 \8 {) X% D  c/ \
1 @5 a9 P; _. w, l( }static struct platform_device da850_evm_tl_leds_device = {
* W- T4 v5 |4 E        .name                = "leds-gpio",
! q: C% R0 C* L4 W' b        .id                = 1,
* J- @# ?* W* G2 p3 Z& H        .dev = {
$ N6 [$ m7 P9 l$ ?$ ~% M4 x                .platform_data = &da850_evm_tl_leds_pdata,
0 A+ w8 i: ?4 T0 h                .release = led_dev_release,
/ z. P: B1 L" R! b- u+ d1 g. X! c/ Y* W        }
' {% [  Y6 l) N: X% g" Q9 M};/ x* B& U# E$ g3 `
/ H+ X! l. r, `. L" L. k0 V' G
static int __init led_platform_init(void)) |  I; E7 U! l% i; {! d0 e* b
{( d# n- v4 }% L$ D: @) x
        int ret;" f, @, ~* l4 s8 R4 U1 f
#if 08 Y6 q7 v( ?% h; l* Y% }
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);' |# c5 n! d" q: u5 k# b8 z0 E# K; `
        if (ret): X$ I  V( ]9 t* f; U
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
3 X- }9 n# E6 v* X5 i                                "%d\n", ret);& t  K, S: t5 k8 L2 Y
#endif* K, t/ H( t  Y% `: x7 M
        ret = platform_device_register(&da850_evm_tl_leds_device);- s) o# G4 C0 u1 h
        if (ret)6 X+ N: \5 j% n1 o
                pr_warning("Could not register som GPIO expander LEDS");# b. a* _* S2 x$ y9 M6 K  h* Y
        else7 @$ v5 z: w! h) K% e; i% S
                printk(KERN_INFO "LED register sucessful!\n");
, k2 ]: U5 n$ ]0 Z
8 [* d; N/ e! O( F1 h$ \        return ret;
& G9 P( o! c) n" |/ k}
+ _( _1 E1 n* b+ W/ g7 P8 f( W7 M
  s. C- u/ G! U, Xstatic void __exit led_platform_exit(void): H/ R* m& S+ X- n! M- I" w' g8 m8 ]
{5 f! _* l2 w! z$ P% o
        platform_device_unregister(&da850_evm_tl_leds_device);
8 F2 _" r; l' d! A1 J1 U9 z0 ]  {; _# ?# E
        printk(KERN_INFO "LED unregister!\n");6 ~- }: @. ]/ L; _3 n' g
}" P  K: C) ^) R  v# Z- F, \8 f( `: e
# R8 c' z: E/ _, w. A# ]* v% B
module_init(led_platform_init);
, w0 ]6 w/ z: b) S2 g0 Rmodule_exit(led_platform_exit);
9 i1 m& H3 V+ m2 J; h0 E
  g5 ~) E+ ^, ]- f2 B* GMODULE_DESCRIPTION("Led platform driver");
' R  H, V$ |( x, }5 t7 pMODULE_AUTHOR("Tronlong");& q! s- T, |5 F( O- U
MODULE_LICENSE("GPL");- ]$ l/ S3 D( S: N1 R; u
/ _8 B  S" A0 V  J" w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 02:48 , Processed in 0.040201 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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