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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。8 Y* j% O! t9 o+ p2 p4 q
#include <linux/init.h>
/ j. e  T1 E9 T+ J. e' N#include <linux/module.h>
/ o: }, V5 I$ s' n" U: S#include <linux/kernel.h>
) F8 V+ T2 i" G9 ^  J: a" `#include <linux/types.h>
; z% v1 F* @0 \, ?6 o#include <linux/gpio.h>+ K' t$ x5 H4 _8 \( x
#include <linux/leds.h>
' a( u" ]1 R0 J) M3 q; M#include <linux/platform_device.h>" T( c) J( H& z% k; z

+ V( C2 N6 O& n$ a# L7 j#include <asm/mach-types.h>1 J( W( }% Q! }2 K1 D/ j( m
#include <asm/mach/arch.h>
6 A/ D8 F/ v+ I- m5 U#include <mach/da8xx.h>/ Z$ f  c( f& t; X. I
#include <mach/mux.h>
: i8 h/ C6 Q* T' `3 h4 }% ?6 D
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)& E- }, @0 n& t; n8 a) f  q
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)( T2 Z( M4 }0 T; J9 X1 K$ k
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
% L* P  H  r& f#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)5 e- Y; [% a6 v% m* Y9 |
( @- ^+ A3 t2 ]
/* assign the tl som board LED-GPIOs*/
' \8 z1 q+ y5 B: Vstatic const short da850_evm_tl_user_led_pins[] = {
' y1 r7 B7 M7 g% Y7 L  S: G        /* These pins are definition at <mach/mux.h> file */* s4 v7 Z/ ?; f, A+ E
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
) m4 j# s* f% M2 j& x$ r# v        -1
# X; l# _5 p" y% j! z};* ^4 E$ J2 C5 ]+ j$ ^
" h! y; g- h5 D- f+ @6 v: W
static struct gpio_led da850_evm_tl_leds[] = {0 m2 Q( h6 B! w! V
        {- I5 r3 ], R, C! w/ E* L
                .active_low = 0,
" t1 s7 K$ f! [, J                .gpio = DA850_USER_LED0,
0 Y4 ^- [( e/ F! N6 ^, q; ?/ k                .name = "user_led0",
  g: @. n9 k2 X% ^4 {                .default_trigger = "default-on",1 _+ K) _4 T8 k! O% t
        },
$ c) Z* d* n0 F4 a6 @2 C% G. S        {. s5 Q0 s+ _: M% b
                .active_low = 0,4 s- `# a/ P! u5 m+ a
                .gpio = DA850_USER_LED1,3 J0 C  v- {& l7 x
                .name = "user_led1",
/ v& q6 a( l1 ]* e                .default_trigger = "default-on",
/ q/ y6 a& ~% H  R        },; l  K( W1 c& U" v+ x- V
        {
* m) X9 [# q* [7 X( e5 C( D                .active_low = 0,. O- o8 a$ c$ G+ ^
                .gpio = DA850_USER_LED2,7 v" S2 I& N5 D+ M7 n7 V
                .name = "user_led2",
8 P& [5 U7 Y4 K0 ]                .default_trigger = "default-on",
& E' ]) ], P% V        },( N) z$ e$ p5 k, y
        {2 o  Y( p' T6 T8 H
                .active_low = 0,4 x' b7 q4 f" n5 U
                .gpio = DA850_USER_LED3,
: d2 }/ c, w" W4 H                .name = "user_led3",& E7 o# Y" m( R5 D- }4 W  D8 F
                .default_trigger = "default-on",  @5 j% y4 ^: X% K& t
        },
5 j. o$ _# ^" B9 q! Q& o2 C};+ |6 u  ]; p- }- h& [0 P6 [( M( v2 u

' q/ D4 O, z/ y/ P& Fstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
) E: }! q6 ?8 i# ?0 p        .leds = da850_evm_tl_leds,+ N3 |5 A/ G8 s; i6 [; z7 U
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
/ Z# y  K; [8 Y7 ~) E};. J- r2 Z* C" ]* {" d6 h/ x* k

2 l2 ^4 ~  y* V' G9 l/ bstatic void led_dev_release(struct device *dev); g$ b5 g0 a) e) m, r
{4 A1 Y+ |3 `$ J& m
};
* B6 i, b9 ~  Y5 M, g' y$ E
2 T* V% F! M5 j) xstatic struct platform_device da850_evm_tl_leds_device = {
$ G. Z& q$ d' P% d        .name                = "leds-gpio",
) G9 D* F8 F9 y5 Q- ~( I        .id                = 1,
/ ~% H2 ]* e) }0 {# H3 ~        .dev = {
  D) ]- |! Y+ F( P, g. c                .platform_data = &da850_evm_tl_leds_pdata,
9 b7 o( Z  H; ^( X: `) G7 J' i                .release = led_dev_release,
! s2 X9 M, i) c* b+ O# z: O        }( K' N0 i2 }' r' c( L  Z1 J' h: r* b
};$ S- _* B$ H9 l8 I/ ^3 z6 j

0 k: W, R) I6 U5 d$ v1 Bstatic int __init led_platform_init(void). a2 E, o. y3 P9 i+ M2 T
{- M- l/ }- K9 n9 s+ ?3 o
        int ret;
4 C. ]: p( M, t2 u  X' Y" N/ p3 [#if 0, m: A& C4 _; |; N, {9 M
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
% O2 P% H/ l& _4 W7 r$ |        if (ret)# j; V( P. R& ~. c* M% v
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"7 b9 a' o8 M' s6 n3 E) Y
                                "%d\n", ret);
, A* k4 k' y) M% H* v$ T; |#endif
: N: _, a% [3 }        ret = platform_device_register(&da850_evm_tl_leds_device);
$ t# U/ S) s! \        if (ret)0 M# ~. p/ f4 N# ^) Q, P
                pr_warning("Could not register som GPIO expander LEDS");
, c& a( R& Q6 B5 M, q8 h+ E        else
8 q2 `# w0 t) \& h: i/ i& _6 p; O& o                printk(KERN_INFO "LED register sucessful!\n");
0 w6 x; D, N- z+ O, ^+ i  C7 C1 v% K1 V1 G: {# }) \
        return ret;
& n; ~, e0 Y; m/ U: ~) i$ H5 n$ t}
; b/ Q* a! s/ P# W
  K$ P) X! H9 q% q3 V& }2 _  cstatic void __exit led_platform_exit(void)1 L+ _9 z+ x$ G" O4 a8 _' L  V
{! r' p6 p$ |# J0 \5 x
        platform_device_unregister(&da850_evm_tl_leds_device);* b  ]" V8 F$ E" M

: f6 ]9 H" r6 M* I. P0 ?        printk(KERN_INFO "LED unregister!\n");# d# m! y! \6 t! n" J
}
% C9 d$ v3 G" G6 e  q: @. s% Q# X8 A/ K1 a
module_init(led_platform_init);& X2 Y  n2 V. ?. {* @- D: _
module_exit(led_platform_exit);2 D' S! `9 U- |9 @" A* O# y

3 K& ^. h6 ], oMODULE_DESCRIPTION("Led platform driver");
9 u) L! A( c2 y3 ?; ~  nMODULE_AUTHOR("Tronlong");& t: }" k* `6 `" f; }
MODULE_LICENSE("GPL");2 x9 b5 i2 K- T
/ J% M0 \' ]7 C4 X* {& Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 21:09 , Processed in 0.038680 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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