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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。! s) k! E3 y# L' M& k
#include <linux/init.h>
6 C" F( T) T  p& x; D+ N, C& {. k#include <linux/module.h>
7 U) j) i9 U- J7 s0 r#include <linux/kernel.h>" i2 e# }9 M! V; U: Q& B$ X
#include <linux/types.h>
4 J) e+ n" C5 h. @1 s! n* ]" a#include <linux/gpio.h>
$ x# ~1 G' Y3 W# @#include <linux/leds.h>& E) ?0 R, t9 B: t
#include <linux/platform_device.h>
  m5 [% y$ f# h  j2 ]8 {! M
& K- M( [  ^) }#include <asm/mach-types.h>
' P* d) }) H3 r  g; |5 b#include <asm/mach/arch.h>
" r0 g0 e9 ]  e0 c5 y* c. ]#include <mach/da8xx.h>1 g& T( K! a& X8 ]1 K
#include <mach/mux.h>2 ]1 C' b& L( J7 h5 I
& H" ~0 H6 f7 |. n' s. H. [  D
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)0 R3 Y( a5 n8 p) U2 c$ f
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
9 m* _4 g- P4 L  F#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)! I& S6 ^' E4 S4 A" y7 W/ {$ c
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)6 d7 D# g5 y, [8 M; j

* a  d/ s: G" ?) f/* assign the tl som board LED-GPIOs*/, V: k' P( Q. e1 k+ ]
static const short da850_evm_tl_user_led_pins[] = {1 g' {) r, U% f' u
        /* These pins are definition at <mach/mux.h> file */
& O& l9 {+ y  J) j        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
! J: x! B" \  {2 c3 l& Y        -1
! T, d5 S- H& _' g1 L};
4 ]1 R2 K: H& n' o& b5 r6 Y! V
+ Q: r' x/ d9 w; bstatic struct gpio_led da850_evm_tl_leds[] = {, s: j5 ?( n, K4 [  a% E
        {: T0 R2 ~5 H% Z
                .active_low = 0,! q8 A1 }3 h/ p
                .gpio = DA850_USER_LED0,
. H* C: x7 _3 e/ l                .name = "user_led0",  E8 s5 _/ r" y, {% {
                .default_trigger = "default-on",
) y0 V2 `, _6 ?0 ~% J" i$ u        },
3 I% k- }' ?& C' o        {- Q6 d% a. X' F7 y5 C
                .active_low = 0,$ W1 o; s% [7 t9 g0 W* e0 x
                .gpio = DA850_USER_LED1,
' b: F0 }+ t! I5 a1 l( \                .name = "user_led1",* s* M* G) w8 C' G$ u! A  L! L
                .default_trigger = "default-on",
  o- q3 L" ]2 ]% U  Q, Z! m7 f        },
9 k0 W4 `5 J$ T9 R/ y/ e        {6 g) ]: i, `/ q. T- x1 [
                .active_low = 0,' y( X4 p# a1 X3 F% g) @& @/ ?
                .gpio = DA850_USER_LED2,
6 S. `; m1 A9 p2 F                .name = "user_led2",1 w7 z. j: f2 C) l- ?- Y
                .default_trigger = "default-on",( s2 k$ G* X6 z6 o5 d' D& R* f/ u
        },! M0 ?/ S1 c5 F3 V! Z7 c3 Y
        {, A8 y, l8 o' i. M* S/ }( @
                .active_low = 0,- e% Y  `$ g# i5 N# S- E
                .gpio = DA850_USER_LED3,
5 C: c% p, W9 e                .name = "user_led3",
' U8 a, H+ F$ O1 ]) N                .default_trigger = "default-on",
: t; T+ c* f$ |6 u! O& R% L        },
) n4 f8 U! p7 Y/ x0 \};& i. i! B" q! x8 @0 Y% _: ~

1 U3 L9 ~9 v9 W) R. Jstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {" {7 Z5 d4 N* y% J
        .leds = da850_evm_tl_leds,6 n9 L; ^; Z) l" j. V
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),2 {, g9 o) C) D; K' D. v
};
4 o! ?1 r7 _0 P. I7 X% G6 g) W$ H5 H' u* A
static void led_dev_release(struct device *dev)
4 Q3 i: k0 m7 Z+ i) T6 q{, L. R$ H' B4 T: p9 U
};1 |7 s8 ]: K& k9 O. E/ ~# ]
% [, p% k0 l( @, B. y, z
static struct platform_device da850_evm_tl_leds_device = {# b2 ^/ @$ r  j% G; P! `" `) G
        .name                = "leds-gpio",
4 j. N# {) {& C. |. C& {. r        .id                = 1,
, `, P. i( L( d3 W; H: k        .dev = {9 b& j& {" n7 P* w8 J
                .platform_data = &da850_evm_tl_leds_pdata,
1 Q3 O! T. }4 k                .release = led_dev_release,( G4 y0 \2 {2 j7 M8 d
        }) P1 j' i" D/ r/ X1 m1 J( m: D  q
};4 o* ^& |. t' x9 E. z; X
  m2 w0 t/ s: h: b/ J0 P
static int __init led_platform_init(void)) j+ _9 o$ ?, Y( n
{0 M: g+ M0 q* L1 f9 }6 w3 K
        int ret;$ a( i. y' i  a& L
#if 0
+ ]4 ], O5 o3 U& S: c& l        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
9 s" |; k, V; N: _; {        if (ret). v* S3 l6 A7 ?' @5 V8 A# Y
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
  |$ D) {/ ]% f4 X* U                                "%d\n", ret);
1 b! Q9 r" Z" @1 c6 A! o- i#endif+ {! M/ C* z6 }. N/ |
        ret = platform_device_register(&da850_evm_tl_leds_device);
. L# f6 N4 l3 Z% f; \9 F' c        if (ret)
4 D- O1 L5 m4 j0 C$ l' ]                pr_warning("Could not register som GPIO expander LEDS");! l+ Y7 J; R, Q6 l- F
        else
9 `3 y) ^" F5 l, E" m* {                printk(KERN_INFO "LED register sucessful!\n");
5 `+ O- ^+ i3 S" k
- _- V0 ~5 R2 M  B# i8 Z        return ret;
) I; x; W/ M7 m3 o}
- \& k1 ?. B* `! J8 a- g
; g1 D, P* S& p: ?/ N9 Q7 G+ Cstatic void __exit led_platform_exit(void)1 o; f, H& E# `% Q! ]" _& g
{
7 c& }% Y! a5 t; G7 ~: u- W        platform_device_unregister(&da850_evm_tl_leds_device);
- D4 s3 n$ x" ]7 b( I- h
# j" }! ^! X. W1 B( k        printk(KERN_INFO "LED unregister!\n");7 n6 }. x1 L7 g% w0 |3 k
}* R5 o4 C( N% N* l+ m9 X

7 y: j' d1 P  ?. B. a, J0 ^module_init(led_platform_init);8 V2 k7 c* _& L& m. M; A
module_exit(led_platform_exit);
1 [1 D5 D: _+ ~6 x/ e) ^4 ]% p
( o- h; E4 W( WMODULE_DESCRIPTION("Led platform driver");- ], M3 I% G: }' Y. L& G4 y
MODULE_AUTHOR("Tronlong");, D6 h( M6 L" V) Y
MODULE_LICENSE("GPL");- W* O1 q+ x" @; K0 k. ]; E& B

3 s& U8 o" z+ \% J$ ^  _9 Y& @6 T) O; A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 14:57 , Processed in 0.039450 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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