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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
. p0 Y) \* p7 M#include <linux/init.h>
! m" ^, B- Z0 t4 B2 v  @#include <linux/module.h>
- I$ S& P( I  L/ X8 \& H; j#include <linux/kernel.h>7 R8 `3 c& F3 O4 [& _9 p
#include <linux/types.h>8 ]- U8 H3 w% m. x2 x) C7 D& p. Y4 ^
#include <linux/gpio.h>
* i: v' l3 }, G6 E#include <linux/leds.h>. x+ Y; t2 k& k
#include <linux/platform_device.h>
2 S3 C& Z9 g2 O0 n; Y
; u# m! ?5 O* D$ ?' K2 a  b#include <asm/mach-types.h>* k& F" P7 J% S' w# \4 d1 X
#include <asm/mach/arch.h>
( L( ^3 b5 j7 {' G; Q#include <mach/da8xx.h>2 O9 f  T! y' ~: a; Y. ^
#include <mach/mux.h>& O5 t1 G3 w( y" x2 d
/ W; L0 |' f+ |% M4 h; L: W
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)0 B( v( v, P$ g
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)7 O! r- h# F0 X5 S% n/ p
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
, N0 U3 j4 ?3 L. l- G" ^#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
! Y7 d1 S3 ?3 M" x! Q/ E' v- K  P$ l1 L
/* assign the tl som board LED-GPIOs*/2 q$ @. e+ M9 o% U9 F1 E2 k6 D' Q! l
static const short da850_evm_tl_user_led_pins[] = {
0 o* c* \7 u' `% v) Y& x/ F8 W        /* These pins are definition at <mach/mux.h> file */' o9 j3 l0 N) F0 z: S
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
  u  Z6 |( k( w+ v" b' Q# q        -1
) j" j/ f6 _% a& h" I};3 M$ `; x0 D5 o* I' K9 w

- Q/ e. u8 L% T. zstatic struct gpio_led da850_evm_tl_leds[] = {, I& o' m1 @4 ]/ d2 ^" @
        {- \% t  J: N" z: Q
                .active_low = 0,' B4 ]! ]  R+ G1 \+ N) q
                .gpio = DA850_USER_LED0,( P) H; [! a7 {, u
                .name = "user_led0",& c: `9 c+ s1 ]
                .default_trigger = "default-on",2 j' Y; k9 S" \7 g/ |/ r  g
        }," F2 u+ n# X  o% G/ r& l. [$ w1 a2 b
        {
( D1 Z7 u9 Q2 }* T                .active_low = 0,
6 G$ X. d1 c/ [% c1 m  L                .gpio = DA850_USER_LED1,
% c2 h% M& B3 F* l# V& i& u9 D5 x5 W                .name = "user_led1",
3 I9 u+ E6 R/ O                .default_trigger = "default-on",1 r* J+ F; T+ x9 F5 D
        },/ L0 U7 w! z. b) w4 [
        {' ?" F' [- W# k' x; M
                .active_low = 0,# q, u% U* C: t9 n% s
                .gpio = DA850_USER_LED2,
8 r  q9 ]; l; B8 ?                .name = "user_led2",& r0 b+ g5 O6 O" b0 }
                .default_trigger = "default-on",
6 W( C* f, Q  `4 k+ v        },
2 w, b1 {) s- @4 ?+ W        {
; f8 ~8 Z$ U  z                .active_low = 0,
) s+ |+ @# M, x6 k                .gpio = DA850_USER_LED3,
0 s$ V5 ^/ t# S  V7 l4 z% I4 v, s                .name = "user_led3",, r. ]" M8 o5 V# P7 G
                .default_trigger = "default-on",
. l$ ?. A" j2 c8 V$ o. ]        },
5 c0 w0 _# n: f; Z; I  r, P};
/ \7 |& p! L# T9 Z/ Q/ Q6 \' u: n: _4 u8 m
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
; D& s3 D4 d, a1 z% c  w        .leds = da850_evm_tl_leds,
9 W5 M/ b* c* w) S        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),# x* C1 f0 l9 K  h
};
( t! O9 c' R! ?) ?5 |, V; K# B# X7 a. d% q
static void led_dev_release(struct device *dev)
! B. \" Z& l, E/ N0 Y% K{
6 M7 p8 k+ e% J! [' b};# q  m# @) a7 P! m, J; T8 O( b

. V3 c" d$ R- q* ^/ J( Astatic struct platform_device da850_evm_tl_leds_device = {
: x5 t/ i. X% G9 e. @        .name                = "leds-gpio",) Q5 ~# m$ K8 o
        .id                = 1,
4 w7 m2 J, _/ f9 R+ r6 u  n; E        .dev = {! i* E, P  z2 ^9 m0 J
                .platform_data = &da850_evm_tl_leds_pdata,- {2 ]1 ]5 K3 A& `
                .release = led_dev_release,5 Y/ b# z3 D  D" k+ l; o/ t9 J
        }0 m& L. t# n, E% D. A. \3 {! M! V
};' n8 u$ t. t- D: ^" k' d. X
' f$ O- h( H7 p1 o+ p
static int __init led_platform_init(void)
  ?' r0 `, a2 E2 z3 z/ T{7 ~5 @" \7 u# D  _
        int ret;# g# x! R! \; r/ S4 f$ Q
#if 0
/ S8 P  d+ D4 s- e; U1 Z- B        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);% e2 I( d/ U4 d( ~: V" A( o. h
        if (ret)
) Q) a0 T  g" }                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"! p$ S' T( E, d/ g
                                "%d\n", ret);( U- U9 s5 s3 R3 N4 G2 a9 K
#endif! Q. N) |8 C  P" f# k
        ret = platform_device_register(&da850_evm_tl_leds_device);; X3 x) O, P+ v# U0 q8 P- U
        if (ret)- v! }. U0 D4 C
                pr_warning("Could not register som GPIO expander LEDS");
! j* W- Q+ F  ^        else( Q( D; g) y. [/ [
                printk(KERN_INFO "LED register sucessful!\n");1 j  F1 n5 P" L8 z3 e0 G- S

5 ]; `% x& B  ]+ v        return ret;! V2 T0 N  Q; q3 M" E6 i2 ~8 {$ v
}
) U/ j% R. b2 {4 }3 n) `5 u6 }. j' l) d4 L& e
static void __exit led_platform_exit(void)
$ p2 `* r9 e% S2 j2 @{1 ^2 Y. J) k8 q/ i4 I. `
        platform_device_unregister(&da850_evm_tl_leds_device);
" F& @5 o$ z/ U
9 R5 W- o! f8 T! P+ X- l5 s) ?2 w9 w        printk(KERN_INFO "LED unregister!\n");# z2 `6 A) {7 d- S4 h1 h6 f
}
" x& N/ R/ X6 s+ j) S# t6 r7 u  w8 `
module_init(led_platform_init);3 a6 U( ~4 n1 c7 M6 j
module_exit(led_platform_exit);
; a& F, Y1 C( ^0 `+ X. m2 X& q8 d) U) D1 ]; o, V$ K# f
MODULE_DESCRIPTION("Led platform driver");
' c4 Y; }9 _$ ~, l  [MODULE_AUTHOR("Tronlong");
) P5 N6 w/ M  ?0 s% xMODULE_LICENSE("GPL");3 D5 Y- E% y. X9 y: T# T% Y

- i, e& Q! @" }- }' p9 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 17:35 , Processed in 0.040577 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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