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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
& C( E, C$ G( Z#include <linux/init.h>
' i8 o7 L4 X0 \9 O+ B#include <linux/module.h>( z# E# p  A. L: s
#include <linux/kernel.h>$ E- f' |1 K; U6 \, U
#include <linux/types.h>
4 j! p  S3 A' Q; i#include <linux/gpio.h>, L4 d" I" \# r! T1 ]; `
#include <linux/leds.h>
, Y' P7 Q8 L; |/ h+ V; p4 [#include <linux/platform_device.h>
; l6 l- T( c7 \# `4 K
2 ^+ r1 z% B9 T! f#include <asm/mach-types.h>3 F0 |7 ~- C- h5 h! z2 }" l
#include <asm/mach/arch.h>2 M( {1 b7 A8 S: c) Q, h8 C
#include <mach/da8xx.h>* A' Z% w5 Q* Q" T  \
#include <mach/mux.h>
- D5 W6 G) {8 E" T. d& L6 q3 G. g* F! _/ v
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
; b+ |* M5 J% n# C. [8 `2 u2 R5 J# p#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
' h3 k9 j2 G: ~' s7 s#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)" ^, o' }! Z3 G: Y, Y! R$ n& R
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
% E* L: h% z  b  _- H) m  \$ M5 G- M$ O8 b" F9 u- y! Q- h3 p
/* assign the tl som board LED-GPIOs*/
# {, i/ h- C7 N. z; f% ]static const short da850_evm_tl_user_led_pins[] = {
$ Z3 o, Z. a1 j4 J( r9 u4 M        /* These pins are definition at <mach/mux.h> file */( b$ e8 [9 A( D! n
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,7 P/ Q; |) v# S) P" k" e
        -1
3 V5 a' L7 U. n4 h};2 F. j, v0 A7 Q

) ]) O4 a: B# s7 q, Y. s) l9 O% Jstatic struct gpio_led da850_evm_tl_leds[] = {
7 R: k- d9 c. L; K* U1 r        {) n& G, t' Z0 w$ H. w9 a6 x
                .active_low = 0,+ X4 v+ B/ V% N4 ?8 P! |: d( |
                .gpio = DA850_USER_LED0,8 @5 u& w3 F! T2 s' K7 ~5 v
                .name = "user_led0",
0 n( _0 ~7 E% \. n! n$ G# G  J                .default_trigger = "default-on",8 F* t) }7 h( t. G0 t( t2 G/ K$ J
        },
: g" u4 Z& ]" e        {4 ~0 {, w7 W4 D
                .active_low = 0,
! i& g, }9 _  l1 s. m/ [+ ^                .gpio = DA850_USER_LED1,
/ K& D7 \. H' h3 I& h5 J  b$ S                .name = "user_led1",7 ]+ a& j- g' f9 X
                .default_trigger = "default-on",
  j3 Q6 P1 ]  p5 v        },
5 c  m5 [' s* s. P        {; y; |  L/ Z; D! j* J- d2 D& j
                .active_low = 0,
/ t) m6 n) i. R* |: @# `                .gpio = DA850_USER_LED2,
$ q' T* Y1 O0 v/ I3 s                .name = "user_led2",
2 z0 p% d  j8 F% h                .default_trigger = "default-on",
3 c$ C, h) T) e( Z        },
% k$ Q( L& h! B0 k2 \2 G6 S& I+ H        {
9 {3 N! L7 `: G7 g8 H                .active_low = 0," t! t8 M) {% \
                .gpio = DA850_USER_LED3,
5 A6 E2 X; ]- _9 u1 F7 y/ A                .name = "user_led3",( ~- e9 F: b2 ~( i
                .default_trigger = "default-on",4 p6 m9 H! X2 J) c+ F
        },
$ |- e- ]- E/ H" a7 r, ?) l  C, b& L};
4 a3 l& t: r# C/ G8 N9 r3 P+ f& o( q0 s5 }( o
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {7 z5 h/ y  P2 @+ [* h% }. ^
        .leds = da850_evm_tl_leds,
1 d: a! f, r. S( @3 a% U        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
4 r7 F# g  _5 ?0 Q4 k& o};
6 n, d- l* o' b7 G" l$ ?
/ m8 R, |# ]- Y$ m9 q3 ustatic void led_dev_release(struct device *dev)
' v+ R! F# d! W1 [* D+ @3 V3 B{
* g$ ^5 W6 |+ B' v4 V};
/ M5 s, a) b/ K0 E# y+ D, ^- k( p, e9 V9 Q. G
static struct platform_device da850_evm_tl_leds_device = {/ f. n+ e$ a  c" M% E
        .name                = "leds-gpio",
; S0 D, c  N3 d% G5 G& o        .id                = 1,
# w. j1 |! a0 b3 Z! P        .dev = {
9 A) a0 V) }9 a                .platform_data = &da850_evm_tl_leds_pdata,! O. _0 ?" _# V, Y
                .release = led_dev_release,. @3 p. i. Y; V( |) ?
        }! j) @4 b% p) [7 i- \" I
};# R, h* v* y6 k) m: M' s; d: T
1 w7 O) N8 @$ g) l. t
static int __init led_platform_init(void)5 v; p! H/ L9 [, E7 O* w
{
( A" c8 K. O0 B8 k: T, h+ q+ E        int ret;
- x- {8 L! y( Y& f6 u#if 0
$ @( \+ a& F# H5 W2 J+ j. X' g9 s        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);9 F1 A8 M9 c* G* U% E
        if (ret)
7 A& z4 k3 i9 c) z$ \! V                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
5 z% O, c( w- F- Q& ]- U* y. `! D                                "%d\n", ret);& `) J) p. W6 c* P
#endif, d" j1 @- J3 E0 z" {0 ~
        ret = platform_device_register(&da850_evm_tl_leds_device);& i# @9 A& d# {  Z8 a0 B/ Z4 u
        if (ret)& J. f# U( @. c
                pr_warning("Could not register som GPIO expander LEDS");; b! t! ^- V$ G6 g+ P$ T! f
        else
9 \# D% m8 v) r/ }, t1 e                printk(KERN_INFO "LED register sucessful!\n");! R. p  N/ W) H' V

6 A: t" e) y  N; J8 [) Z/ U        return ret;3 f+ N0 Y4 S  t9 c
}! i8 c" K9 v1 Z2 N! g. a

  U7 X' t0 N4 b. o6 {static void __exit led_platform_exit(void)
# q4 d3 r7 W% C/ L9 ^% }{/ u6 |5 n) x4 w# R, D$ W4 E3 o3 ]  A& D) V4 g
        platform_device_unregister(&da850_evm_tl_leds_device);8 x' G1 ?( q! p  C  H1 f

* H: Z: ^0 m5 B) N) t        printk(KERN_INFO "LED unregister!\n");2 O2 q8 g. S0 y" |
}3 [% z* y, J; d  j
1 k5 W- u6 n& D$ }6 x
module_init(led_platform_init);: }  Y0 P7 [" m% R" U# R
module_exit(led_platform_exit);
# H$ r4 T  n: ~+ N& U6 H, ]# q4 ]7 ]$ a
MODULE_DESCRIPTION("Led platform driver");* P5 F8 b* p( P
MODULE_AUTHOR("Tronlong");
2 p6 ^& ~; ^6 ^0 P& q" L8 r' mMODULE_LICENSE("GPL");( n* \" Y) P" M: `, |

  a, t9 k9 n. G  z' ?% [* A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 01:31 , Processed in 0.040661 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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