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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
& a8 h- W1 |/ ]1 ~, t" |#include <linux/init.h>9 k( b# f; V# r) T3 _
#include <linux/module.h>1 F, D2 ^" n' T3 z6 V6 Z( \
#include <linux/kernel.h>' B) m( Q. g$ M/ @
#include <linux/types.h>
+ v) P6 t" o& l: u) n4 B7 W#include <linux/gpio.h>+ u' v6 @- H5 l2 z! H. l& r- i
#include <linux/leds.h>  z  \  E! Y1 Q! u! k1 S" U
#include <linux/platform_device.h>
. ?- `+ s) j( @' ]# t9 J1 @( W6 N' W+ |/ |4 _$ c
#include <asm/mach-types.h>2 w0 G  T" [! h+ U5 p
#include <asm/mach/arch.h># ?( W: `: r0 Q! q1 b
#include <mach/da8xx.h>0 ^% g5 [. f, `1 B4 Z
#include <mach/mux.h>
1 ]7 u/ B# q7 G) a7 ?  B* \) k6 K" I( d4 x  U
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)5 W! Z) j3 `7 f7 }+ C( s# a( M
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
* Q) z$ @/ q& O; n! s8 k#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
! f. z+ f& u% i% o( G#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)* [2 V. d8 u! P5 [0 s2 P
. z& Z/ W' O  l% B6 M0 g; W
/* assign the tl som board LED-GPIOs*/
- }* n0 d6 s/ J/ L4 [( e9 l7 r/ istatic const short da850_evm_tl_user_led_pins[] = {- J. M& v. v: z2 r! a. B4 i
        /* These pins are definition at <mach/mux.h> file */
) y  ]' F9 j& n7 o        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,* i# L- {# c( H9 g
        -1
' E1 m( U9 h* K$ x6 i};" w( n' @% _- I7 U9 ~3 G

; [8 x; s2 x* `6 S7 Y+ Ystatic struct gpio_led da850_evm_tl_leds[] = {4 r# |0 p$ h( K8 s
        {
0 u" {5 O  y3 @4 C+ L( A1 X' b                .active_low = 0,/ q0 D6 [& P: \+ j% |7 o
                .gpio = DA850_USER_LED0,
* S9 z+ L" q# L                .name = "user_led0",
) T5 e% p2 G9 F2 n                .default_trigger = "default-on",* K3 }1 E3 k5 p8 `- j4 I$ i! ]0 y
        },
! \% p( W+ x8 t/ q        {
$ |" c4 I8 `; n                .active_low = 0,
( ?0 r; H2 @: G' r" E+ N0 ~                .gpio = DA850_USER_LED1,
: G. x$ Y; `5 ]. g3 A# H& L- \                .name = "user_led1",3 t" J" O4 l+ L/ f" d0 C
                .default_trigger = "default-on",2 w4 j! A$ ?2 t' q2 \2 \
        },
6 n/ D2 e. _1 x1 V7 H% m( x        {+ {! e  Z7 C; \+ ~& z
                .active_low = 0,
7 O& B  q- P0 `9 d: S/ \& G                .gpio = DA850_USER_LED2," Z% I2 y7 R0 b% ^) L* z1 E
                .name = "user_led2",1 h5 @$ w$ f& {5 E! m/ X3 p8 K' U
                .default_trigger = "default-on",* D9 }7 q9 ]1 E2 z) A( N
        },
! z+ P7 C: B; E: [5 T, {3 }# _- o        {8 N4 s- {# c9 c/ y( T
                .active_low = 0,! q6 X4 n- _6 m; w+ `" s- O4 ]
                .gpio = DA850_USER_LED3,% f' D- k5 N# g2 f
                .name = "user_led3",/ t8 [/ p, L* ^* Q
                .default_trigger = "default-on",( d2 f( [! m" l/ E' a* K3 W
        },/ q$ x6 t7 T1 @5 t0 e
};
/ A  Z6 u3 S; a+ ~/ w2 M1 n# p- j0 R/ j- c/ m1 J/ R( U+ |
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
* }/ j6 D1 \. r        .leds = da850_evm_tl_leds,
- j" `3 c5 g4 }$ D        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),8 N! o9 h2 }$ Y8 e% v1 g0 v
};2 ~' K. t+ M5 a
7 {) X% |' v' b" |# W+ k
static void led_dev_release(struct device *dev)+ E4 j3 L$ L4 t, S
{
% k# E# F3 k7 r  D  d};# [6 ?5 _$ Z% m% U( _+ V( M

; K, b3 j3 h, `4 X0 Qstatic struct platform_device da850_evm_tl_leds_device = {
* ~+ H. }/ J% Y& f. y4 m        .name                = "leds-gpio",: Z8 D. y' P9 E7 A
        .id                = 1,
1 [- A8 P( y+ p3 f- C6 i' C, Y- R! S        .dev = {$ a1 n+ ^* @: o+ w7 M  Z& N! }5 ~, h
                .platform_data = &da850_evm_tl_leds_pdata,
' a& {; n3 F' _; E5 `# W                .release = led_dev_release,
/ n  C* x+ J8 |) x* m8 ]% |5 }        }: w1 Z: h* n2 R3 A6 J/ u; K5 }
};0 j6 Z4 S1 \- h. w* z4 k

+ s; h/ U  q" n# m  n3 Z) vstatic int __init led_platform_init(void)  P! c4 _6 R( F: ~6 i5 E' \7 u" Z/ {
{6 A. }0 C' c# V+ r7 B$ G
        int ret;: G! x3 o  _8 O* p
#if 0
: D6 v6 \) I1 _+ V- Z) j        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
  I9 Q8 E- H' L7 |7 ]        if (ret)6 a- P) o$ v- K# a, ^& J
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"$ k/ I. B$ w4 C7 D0 ^4 a- q4 z
                                "%d\n", ret);/ k1 G! i& i& m& Q- w
#endif1 P% o' z  v* J; W
        ret = platform_device_register(&da850_evm_tl_leds_device);9 @) r' A1 b; O4 o2 ~4 W( R! j- i
        if (ret)
0 m1 A, x& S4 G$ t( t; O                pr_warning("Could not register som GPIO expander LEDS");- N" L: Q9 U3 R& R) m& _
        else
5 G9 A6 K2 I3 }2 X# t* E. o                printk(KERN_INFO "LED register sucessful!\n");/ c( k  a7 @3 j0 x! l9 y0 W
% T1 N; A6 B8 X# ?/ E) D
        return ret;
7 W" Z- R* u* X1 b6 d$ D4 S" {/ N}; b# {. _. w! E; {* f$ ^
, Y" H2 r4 I( L% M
static void __exit led_platform_exit(void)
" Z, g- z9 s' O  [, w" W2 K{
  e, z- M9 |+ R7 |3 y7 i        platform_device_unregister(&da850_evm_tl_leds_device);7 K, U! P! U& _+ S

8 x' r0 ]" C" I( v6 ^" O/ `        printk(KERN_INFO "LED unregister!\n");
2 v8 X6 ^- k/ I8 p$ F7 N6 Z# h}0 J# ?; V6 o$ w  z9 G
' ]: V& Q9 O6 I
module_init(led_platform_init);0 V* S5 ?' c6 Z0 _& A' @
module_exit(led_platform_exit);
) s% y  j( Z8 s  P) H
! u2 H# b6 w5 [( e; M& s6 ^MODULE_DESCRIPTION("Led platform driver");( K0 V6 X# h1 @8 V. l" y
MODULE_AUTHOR("Tronlong");
! M' }! M1 H  o) t, d; d/ S7 [MODULE_LICENSE("GPL");
& U4 _, k2 `+ \! F2 @
1 n5 Q3 B, f4 o( D, {! t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 09:05 , Processed in 0.037786 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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