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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
2 b; }6 v+ i: h: Z1 q5 G$ r) K#include <linux/init.h>
! q& N! y' m* N& q#include <linux/module.h>
, C# E. D% y. M$ c7 |7 @8 d#include <linux/kernel.h>7 o$ `( n' y$ m7 n  _3 Q8 P0 t
#include <linux/types.h>
% H6 ]  Y/ u, r$ e' r: r5 o#include <linux/gpio.h>
2 H( d" p* V' N! w#include <linux/leds.h>
' T6 `: i' L# D! P6 t, o#include <linux/platform_device.h>8 W/ `! Z! P( X. m
: f( y" @6 o; V* x
#include <asm/mach-types.h>7 z! [5 o( `" q' Z/ ]& T4 V
#include <asm/mach/arch.h>
, P' u# K  s  {7 l6 @2 m9 B#include <mach/da8xx.h>
+ S- T4 r% T/ j- C: V#include <mach/mux.h>
. g% T) Q4 U4 [" t' V
. r8 X# O1 }8 q9 J#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)/ ]0 v; ]3 ]1 c, V! Z4 y
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
2 ^2 O1 f2 J- ~0 {  v" B+ i# \#define DA850_USER_LED2        GPIO_TO_PIN(0, 1). i0 F/ e) m- l+ m2 G' }% k7 p
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)- ^9 a3 b; i0 k% i' v* d' S

1 O% ?0 A1 ]% ]4 u$ P; q/* assign the tl som board LED-GPIOs*/
4 U5 [, [9 N/ w4 D9 P- W" x' b8 Bstatic const short da850_evm_tl_user_led_pins[] = {
# S0 B8 A" F$ @% ]4 x        /* These pins are definition at <mach/mux.h> file */
3 A3 h  O( D# r& N# h        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
7 P. r, [% r& m4 e        -1
7 _7 `& u, v- j  a$ t4 A* u. K};6 i) v$ w6 x1 |! M7 ~/ T

( g- ]+ ]! I7 e, y; vstatic struct gpio_led da850_evm_tl_leds[] = {3 R3 J; Y5 y% Z- }6 L% v
        {# m+ W( h2 m) t! k
                .active_low = 0,
8 ^$ L) F- v0 I- k                .gpio = DA850_USER_LED0,6 i9 t, g% B* R' `) R
                .name = "user_led0",
5 I' t$ I# w6 @5 k' b) j5 [* x                .default_trigger = "default-on",
  G; z0 Y$ L9 ^3 ~$ {+ [        },
3 A& j3 z6 F8 b. s: t# T8 h        {9 f$ ~/ ^0 F1 v
                .active_low = 0,8 U" d8 \5 p) f! q8 w7 ]" K
                .gpio = DA850_USER_LED1,1 V( B5 z, S5 q. O  p
                .name = "user_led1",
- N1 Q- i2 ^+ [7 ]                .default_trigger = "default-on",
3 y5 Y6 G* F( f        },1 `5 c' U) ?  |, O, ^
        {+ Y/ D* q: n: ^# q" W* _1 C3 I8 ~
                .active_low = 0,
' ~! R. L" i! j- U; k8 k, U                .gpio = DA850_USER_LED2,
4 N0 }& Q# c" S0 h3 U                .name = "user_led2",2 O! j: \9 V! g1 p; f" ]
                .default_trigger = "default-on",
9 J! c- p3 _5 d+ S& W1 Z, [        },) S$ M$ P2 [1 z; l; n3 }+ }
        {% C2 |6 K0 B, M" b2 }3 Y8 [
                .active_low = 0,2 \7 j; t9 L$ p! J% O# K  ^
                .gpio = DA850_USER_LED3,( g* d- ]( `- ^2 k$ `" H
                .name = "user_led3",$ Q3 S% k. H0 c
                .default_trigger = "default-on",  {. S$ `+ w; D0 H7 W  A2 x' w5 R& c
        },
2 |  T7 K) c9 b# H};* n& J4 t* b4 Z9 _0 S8 e

, {! Q2 K2 r, dstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {+ q& g4 K. d2 {5 U
        .leds = da850_evm_tl_leds,, M0 |6 C- e" b! {9 |0 M0 h( ^* u+ X
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),( p- z4 T8 r# V5 Z, \5 f1 [
};
* s% v$ v: s, R1 O
& ~$ I: d  q8 D7 E8 ?, istatic void led_dev_release(struct device *dev)
  r; e6 ~& u+ W{/ y6 z6 r, V( k- u  q
};
7 H/ c! f! F0 I9 c8 t+ m  M2 ]! D* p( t$ Q
static struct platform_device da850_evm_tl_leds_device = {
) u& M  F4 P: r9 \+ }        .name                = "leds-gpio",8 i1 g" }# g8 k( R
        .id                = 1,
* r$ L* @" J7 h4 L9 o! x% y        .dev = {
, z% m- K) F  }% X! K+ }9 [                .platform_data = &da850_evm_tl_leds_pdata," {. b% A) o( n, \, W- I' Y
                .release = led_dev_release,
) d. q  E2 R) W5 o3 A1 h        }
; ^8 L2 g3 q* M& ?};
# h' b/ b  y5 `. c3 Z0 A2 I' z' T! X* I8 t  e, V
static int __init led_platform_init(void)
. I5 B7 b# O. u! ~( u{$ z0 i1 x9 N/ E1 o' j3 x! u
        int ret;' @! n+ C' K1 @8 p& i
#if 0; o( E+ Y; y+ A9 a$ A* v5 S3 x# ^
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);' q2 ~* c1 @5 t" L/ M# R# a
        if (ret)
8 K) J' ~0 ~3 [) g: _' I                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"4 g; \8 Y+ |. a
                                "%d\n", ret);
; X8 e3 A. r( f1 H6 T#endif
) ~$ O  u6 w. x        ret = platform_device_register(&da850_evm_tl_leds_device);
0 s  m5 w" r3 {5 i% z        if (ret)
6 k# U! Q% I& _" O$ z+ a  E5 \                pr_warning("Could not register som GPIO expander LEDS");
* [) e  `; U% Z" N        else3 C& h/ z8 c/ v& }* p
                printk(KERN_INFO "LED register sucessful!\n");
1 [' T6 v4 t# L. E5 |
9 h1 v  ?- o) d        return ret;% C4 M6 p9 d! y$ U! P3 K7 n
}
* B  k4 `7 P" E+ |/ V% _+ ~( ]' Q0 n. F: z
static void __exit led_platform_exit(void)& s) o4 x5 `) g& l2 H) H
{
9 g5 H, K# @- ^$ O& ?3 Y$ G( g& z        platform_device_unregister(&da850_evm_tl_leds_device);
$ }. H0 o4 [- L2 [0 \- a' T
9 U- N6 L, e* X6 o! ?' T: A3 c        printk(KERN_INFO "LED unregister!\n");
9 ?. d8 h& K" l2 t3 B3 w}: M( p9 {2 ]0 p. J$ @
8 g& L' S: h; d; Y! i  t" `+ V6 `% }
module_init(led_platform_init);1 N. r2 E3 L% j
module_exit(led_platform_exit);0 A) z, d5 V7 p

3 q9 ]1 F  R: v) @4 M- }& TMODULE_DESCRIPTION("Led platform driver");; s+ U* L2 q7 `( m
MODULE_AUTHOR("Tronlong");
; @- i: b* |# L" `1 c5 vMODULE_LICENSE("GPL");) v* ?& s# y$ F" x6 O) {

$ O" ^& f0 h' |' L# n. `+ q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 12:19 , Processed in 0.038245 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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