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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
2 |5 V7 }4 N) H% t- A6 H" L#include <linux/init.h>& u, j/ w! s  v, ?: v' F
#include <linux/module.h># h& ^$ Y' }% g
#include <linux/kernel.h>" t$ b4 a' j% N0 B. H+ f
#include <linux/types.h>
1 O3 ^/ ]) t  A% X4 U0 F8 A#include <linux/gpio.h>
5 o; Y7 d* }+ z+ u+ K/ D4 _#include <linux/leds.h>
4 H' G8 s1 ?6 r& c" K' f#include <linux/platform_device.h>
; X/ r; L+ T; U: L7 M- `2 j  R9 P
9 F) G1 D: ~- r4 U#include <asm/mach-types.h>
* d3 Q6 @, j' D& ]#include <asm/mach/arch.h>) f. p8 {' N- ^$ t: F) E  B
#include <mach/da8xx.h>
. |- O3 y" T0 f#include <mach/mux.h>: u% L8 e$ A3 Y7 X6 B5 z
9 Q8 `: e' X3 ^2 |! c9 v1 n
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)% R8 M+ E+ n# j. g" @9 s
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)7 z( c- R; E( N) S+ B) ?
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
- J8 c$ I5 Z1 F* {#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)$ L9 I& Z+ k& T7 ~

1 L/ V7 O4 h3 ^3 Q! V/* assign the tl som board LED-GPIOs*/
- ~/ a# V, ~  vstatic const short da850_evm_tl_user_led_pins[] = {# j" w3 l9 n& z9 k/ H  }9 F
        /* These pins are definition at <mach/mux.h> file */, m( E5 q" k0 W4 G& ~9 w
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
* X; u% m% i  h4 ]0 s        -1( r4 x9 f8 `( Y! w+ L" H1 Z& ]* s
};
/ }2 H: J- W, C
* v) B9 {, r2 {4 @static struct gpio_led da850_evm_tl_leds[] = {
& D1 d' H- Z! X0 |% {        {. T6 d2 w/ p' W0 E6 v, W5 R
                .active_low = 0,
* F* W2 q3 f* s4 ]. h! \( K0 [& F7 t                .gpio = DA850_USER_LED0,( b- e, K, A+ H# ^" `8 S, ], [
                .name = "user_led0",% w$ h) N2 Q2 N4 L# o+ g
                .default_trigger = "default-on",) `/ m3 w& Q- S  h) S
        },
' U5 Z: ^8 A6 S  i" {        {  U9 D: a9 h5 K0 _1 `6 m. c; H
                .active_low = 0,- \: y, d! R: W3 k' |$ {
                .gpio = DA850_USER_LED1,
# D/ [9 ~4 j, h: c2 {& k                .name = "user_led1",
/ K( T3 ?, O( T. P. }( a# R                .default_trigger = "default-on",
% o( L. g: l$ {6 y0 ~: B) [        },. P* d0 P- u9 }2 I
        {
% B7 q# p* {/ h5 Z5 f, S/ v4 s                .active_low = 0,, Z/ }* U0 w; r' R' Q  w
                .gpio = DA850_USER_LED2,' s/ o0 M/ A+ C3 C/ U+ j- x& Q
                .name = "user_led2",
$ M, T' @% ?  B5 U$ B# r) R                .default_trigger = "default-on",$ g4 ?) d4 h: n+ _
        },: g( v  l. w: o! [0 z5 p
        {4 I1 x: c" |3 R5 P
                .active_low = 0,
; l  I8 D1 n% b! _/ m- E: |7 q                .gpio = DA850_USER_LED3,
+ F- p5 C# u2 }4 I! N6 T2 l9 T                .name = "user_led3",- D2 Q* r8 b' k) H4 B
                .default_trigger = "default-on",
4 y% Y$ z' P0 N' f* H, `. L3 o        },4 q- S8 }) s, |: K) Y+ R- h0 C
};
! K7 a. T# }7 r" ~& e/ m) O9 N/ Y" x0 J$ o, l
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {/ {0 [3 ?2 p% n: ~2 y
        .leds = da850_evm_tl_leds,8 N. g7 U, A. G0 J" s+ O9 M$ l
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),4 H! d6 C* O+ E" w
};) v4 q& [9 H: a
* f/ r, _$ @" F4 X! K. Z- j
static void led_dev_release(struct device *dev)
# U2 m% w; C2 e! h6 h/ f{  Q6 g: G) R3 t; M* ]" l
};
6 h% `( {0 b5 P- x9 x+ @; V1 }6 }: C( P
static struct platform_device da850_evm_tl_leds_device = {
& g1 |0 K  i$ q  c$ P% A# o( T        .name                = "leds-gpio",+ d; t+ J, \/ [, g: U6 D
        .id                = 1,
( d+ Z4 K) x1 m/ u" K2 p1 ]        .dev = {+ q4 q5 ~- w7 X/ Y  Q% ]0 P
                .platform_data = &da850_evm_tl_leds_pdata,% \& B, M! n1 f3 Q
                .release = led_dev_release,
6 r3 w* {1 H% B) U6 Z        }
# R( w! D8 q- h};
' g0 P0 ?5 l6 Z. v
1 @% d# J- x  J% [/ R( Istatic int __init led_platform_init(void)5 A' r' {) Q2 n+ M3 w& b* o
{
5 c; e! w3 N3 H  F# A        int ret;( [. ^! P& l2 f. K+ n
#if 0
8 i  f/ C& Z% I+ g  I  p        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);) y5 w- L8 q# T' I, L% y
        if (ret)
  Z9 x% |; L  m4 w: e                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
6 a3 J5 T$ ]9 p% d/ D1 B% U4 t2 X                                "%d\n", ret);  o: H- O% U. q3 W
#endif
: c6 p% x, D4 \% x0 q        ret = platform_device_register(&da850_evm_tl_leds_device);+ `9 Y' F) m/ R# Y! z: r
        if (ret)
! K* f( o) Y9 B6 e6 r& X8 F* D                pr_warning("Could not register som GPIO expander LEDS");
+ C! A2 y0 a+ Z5 W8 a. Z        else
% L$ [6 E& ?8 H* i                printk(KERN_INFO "LED register sucessful!\n");
9 r+ Q( x/ ]4 s9 V( I: f( r/ D# Z6 A' t
        return ret;
$ f9 [: W7 U. d* g- h6 r' o0 b}
: D1 Q7 c% |. A: u& H5 s$ a9 I) E6 @( c
static void __exit led_platform_exit(void)
) `: e( h7 I& T& ^( h{6 |, F8 ~; K5 W4 G  P
        platform_device_unregister(&da850_evm_tl_leds_device);
) x* N: {! Z# g( _2 D& r/ n$ r9 O' p4 d) v5 s0 A
        printk(KERN_INFO "LED unregister!\n");
3 K, ?* R) ?1 _  Z( C}
- q: _( P4 T0 `- N) P
4 m  x$ u9 o( Q) V/ |' g, }  ~module_init(led_platform_init);! [1 I7 D4 w- }& w  w4 O
module_exit(led_platform_exit);
  C0 @2 @1 `1 \0 ^+ \& X* z+ C& k  E: m8 ?6 T! p% y! x
MODULE_DESCRIPTION("Led platform driver");2 A- N$ q# J" [! S& ?* `7 D; _9 D$ A
MODULE_AUTHOR("Tronlong");
! }; H9 v- C/ mMODULE_LICENSE("GPL");
4 H# K! Z% z. ^# I
. Q9 V% h( X0 _1 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 12:07 , Processed in 0.039785 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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