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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。5 Y. _$ ]$ {  v
#include <linux/init.h>" D; \+ B, u5 F7 C) U9 l8 d
#include <linux/module.h>
) e: o( g/ ]; e- A#include <linux/kernel.h>
6 R3 u. a+ c$ A#include <linux/types.h>
8 X. _/ w) A+ f# `# d  P0 I) Y#include <linux/gpio.h>) o) i1 _: z# Z
#include <linux/leds.h>
; [  R4 G7 r+ F- [! w7 |0 A#include <linux/platform_device.h>
8 w. i+ d* o: ~% f1 f4 B# L% V8 `7 K' P( @4 J
#include <asm/mach-types.h>
7 f2 ]) |+ Z8 F4 S#include <asm/mach/arch.h>( M& \' t$ g) ^
#include <mach/da8xx.h>, C, Z7 o7 E; @9 f- P
#include <mach/mux.h>
1 l) F- M& z( @! ]
8 ~  q0 `" j0 E$ K#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
9 o* N$ K& ]: P, s. h#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)' P  K8 M$ ^4 Q2 {( z* q; e' o
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
5 n9 [+ k* Z1 W9 u#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
+ U1 g: \9 [! e4 @9 ~1 s; S- g' [% ^! \
/* assign the tl som board LED-GPIOs*/
5 P! V- t! w6 f& o7 B- Y9 J9 x- istatic const short da850_evm_tl_user_led_pins[] = {
2 |8 ?6 D- m2 o        /* These pins are definition at <mach/mux.h> file *// g7 z& _3 A* _2 Q0 o
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
0 S7 w; G0 R* f- a* [/ k4 g# [        -1! S$ [/ j% p1 J" [$ x% g4 X
};
8 W/ b. O3 r6 z: x: _# j* y8 M0 {) n
static struct gpio_led da850_evm_tl_leds[] = {  y3 N* Q  e' z; B" T% a
        {8 w% r% Z2 D3 [! k
                .active_low = 0,
! ^" o: Y+ L% s- {% z                .gpio = DA850_USER_LED0,
% X; I6 }, ]4 B8 e                .name = "user_led0",. i2 g  g+ X4 C
                .default_trigger = "default-on",' w& P- F; D$ ^# Y6 E+ s
        },0 m( K; _$ g8 @, @" M- V% l
        {/ Z& D  W% i9 h6 W2 U. a* S
                .active_low = 0,
8 i0 O9 Z5 I: M' l/ d* C                .gpio = DA850_USER_LED1,
* h! O0 T; O4 M                .name = "user_led1",$ }  ?" n0 x6 U0 e1 V9 t6 u
                .default_trigger = "default-on",3 H8 u2 h! a: v- X1 Y
        },
8 C/ ^) W5 @2 |& G8 T2 K$ v        {
) [# S4 V  i  y0 p) z  x7 G: I                .active_low = 0,# A; m3 S! A! A* F4 ]* h  }  Z$ G( B9 u
                .gpio = DA850_USER_LED2,/ M5 B0 r% g6 k- t( g4 P' s
                .name = "user_led2",! }( h" u2 x! B4 p
                .default_trigger = "default-on",* \' a( B9 H. ?8 s
        },+ v! l! v/ O' R6 l- f6 D
        {
5 l0 _" V. P8 A1 M                .active_low = 0,
9 v) _, q2 K+ o/ {- v  E0 t/ z4 G                .gpio = DA850_USER_LED3,6 F3 R* H8 D. I2 M/ W
                .name = "user_led3",, W) K! ]; Y  E8 I' z+ G7 H
                .default_trigger = "default-on",: [7 z( m& l4 ]3 ~% F4 t4 t6 Z; G
        },8 `2 }4 S- ~# C  f! f6 e! X
};
' t! b1 C* l* u- c1 I% Z+ R+ N5 @/ e0 F. P7 h5 k
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {( S& r+ q& H: m9 C, W
        .leds = da850_evm_tl_leds,& U+ `5 J+ r( {9 t5 y: r7 H9 ~1 K
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
. c3 j9 s  x- V* l2 ^3 J& z};
/ y* V! b# v/ \; L8 j- q
9 I0 L( f1 A6 S1 R' ~" tstatic void led_dev_release(struct device *dev)
2 E& ~5 l4 T. ]{
3 F  X- x8 u: E6 ~0 U# ^};1 l) S9 l3 j9 x/ n3 n# R. @) h1 s4 c

& J+ u. B  l5 P3 C" Z) u& g* [static struct platform_device da850_evm_tl_leds_device = {
  y- K( m3 R  _4 [: C' m) [        .name                = "leds-gpio",! \  w; ]2 s& W
        .id                = 1,' x( E$ r" [6 N! O1 K+ H+ |* D6 t4 x
        .dev = {
: \0 @' u. Q% h) l% o6 I                .platform_data = &da850_evm_tl_leds_pdata,
" `# V( |) r- g  F. j7 g                .release = led_dev_release,
2 ?  c  a$ O4 T! ?8 o        }
* D. W: y6 O4 ~# x};* P6 y) n4 f* t: I: s2 c- H/ O
4 \5 y* ^+ X# a4 V
static int __init led_platform_init(void)
7 P1 J- h1 N5 r{
7 [* ?; b: j+ V* K: _- n( z+ z        int ret;
/ ?, f+ n3 f4 M! _. h#if 0
- P. l9 r4 i9 R, X% L7 o: y; b' |        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);& Y* b$ T, \$ v5 d& f' ?- F4 H* S7 T
        if (ret)" w# B9 X8 {- z/ d- a" I
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"# r) ~; c9 x6 l; i3 ]7 P# _/ s$ G
                                "%d\n", ret);
, S+ p, i1 @6 V5 v" u- e#endif
7 x8 z, `( ]' m9 h9 y7 K  A        ret = platform_device_register(&da850_evm_tl_leds_device);
7 _. a  P6 m$ v1 p  t& U8 D        if (ret)7 A/ t5 X! L4 V6 @
                pr_warning("Could not register som GPIO expander LEDS");# L7 G6 t7 ?& }5 w2 F; J& Q
        else3 s' M$ ?2 o9 z6 E/ b
                printk(KERN_INFO "LED register sucessful!\n");9 e; F, j" l& O$ ^
& O& r$ ~' {6 O+ O
        return ret;) X# Q$ n7 P! Q4 G4 P% I
}
) p5 J" }( \0 y% j( r& g8 Y+ Z& d
# f2 r# m! O3 K( D: v" Q4 ~static void __exit led_platform_exit(void)
2 v( U6 a1 l" W7 B{7 M$ x1 d; i. c0 T1 G/ q& f, I
        platform_device_unregister(&da850_evm_tl_leds_device);) @2 Q1 ]& Q' q, V) s2 c

3 v; I2 s# |/ \/ r, [        printk(KERN_INFO "LED unregister!\n");+ k$ T4 Y! F# @4 h, ]
}6 x" H: y3 B% r& T1 l
# U: O9 l0 h* ^' d# V/ Y$ Q& o
module_init(led_platform_init);0 x! z$ Q9 A$ \9 u2 V; j
module_exit(led_platform_exit);  B' u* t1 Z9 B% i' X' e: d

# E9 r6 D7 T, _& k- S$ u+ ?MODULE_DESCRIPTION("Led platform driver");: B4 O1 E* c; F5 O9 W! M* x# e
MODULE_AUTHOR("Tronlong");
4 e& E$ a- I" t- N; \; _4 \7 sMODULE_LICENSE("GPL");3 X; n' |' k6 P

( R; h9 A& y0 ?: s' D  F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 09:37 , Processed in 0.037757 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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