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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。, c! V- H; m' i% N& T' {: Z) I
#include <linux/init.h>
2 n8 l) K" B2 H5 @6 D7 N  @#include <linux/module.h>
. S9 h/ D1 u" h& q: L* L0 G8 o#include <linux/kernel.h>5 p  n. b( u# W) _8 J9 g
#include <linux/types.h>
& `' V- l5 ~8 z3 B#include <linux/gpio.h>
0 V6 l! p9 b3 ^5 B0 u& e#include <linux/leds.h>
0 y% H0 c1 F# U$ U2 x#include <linux/platform_device.h>
1 X# o. G! p2 c. W) p; {5 r) c) E9 P1 s3 F0 J/ }+ ^
#include <asm/mach-types.h>
8 p. [0 u( J( h& ]3 g2 b3 b. q#include <asm/mach/arch.h>
. N1 K; V- n3 j0 a9 N9 g#include <mach/da8xx.h>
( c$ |1 t& {! M& m4 p0 J#include <mach/mux.h>
! `9 N0 L: q# C: t0 M# V% W1 l* m$ W& E% c) J1 I/ o; e
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
+ ^7 R/ [, b7 L  b#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
. _) G( H( b3 t) M#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)0 q' B/ @' a0 [, }7 y* N
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)- O4 {5 j3 _3 `- B' P- J

2 v5 c! L4 m* _" B! e4 j/* assign the tl som board LED-GPIOs*/& J1 J! q, ~9 u) V* t" O/ A2 s
static const short da850_evm_tl_user_led_pins[] = {
) r: P7 j7 y$ D2 ?* M% V6 x& r        /* These pins are definition at <mach/mux.h> file */
( K8 `: t1 L' r        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,$ c  r" {' q/ `1 w
        -1
$ e  U9 v) ?( w$ k( }7 A! l};; J' L' l) _' j

+ D5 P; ~# b/ m: ^# Pstatic struct gpio_led da850_evm_tl_leds[] = {
; G% b! _' a* R9 S/ W        {
9 s4 h: n5 g9 T/ g% D5 W% f! N                .active_low = 0,
& r$ J/ L8 L3 {( k1 V' m$ u                .gpio = DA850_USER_LED0,
% K3 H- y+ ?2 t* a# K  N5 U                .name = "user_led0",
: O2 U6 ?/ O+ Z/ m3 m                .default_trigger = "default-on",, X6 T1 t! w5 O( T2 m: Y# N/ c
        },
5 m- C6 a+ ~7 Y7 E/ ]3 P        {% A8 D$ y" q" ^9 q
                .active_low = 0,
- b% K! E" y/ f. F                .gpio = DA850_USER_LED1,
& t1 p% k7 T, P8 ^                .name = "user_led1",
0 ]2 X, L0 J# Y9 d; @. G( ]. S                .default_trigger = "default-on",
+ i  N& ^: b' F6 c% `! F5 y        },7 T8 d% i" l9 _% x
        {
+ P: w( W' o% x# \/ F6 Q& ]* Z* [7 D                .active_low = 0,
) U" S5 L4 D: F5 C; C                .gpio = DA850_USER_LED2,$ `2 t# L! h' t; A  t, R2 L
                .name = "user_led2",$ A; _+ ?$ x* s; {
                .default_trigger = "default-on",
+ z# f$ O5 z/ f; i/ z/ I4 u: I  _        },
$ C, r& D9 |8 t& X& ?        {3 `8 s4 [: _: k5 o! Q
                .active_low = 0,
5 J, p1 E+ q  Z2 E" \                .gpio = DA850_USER_LED3,
, w* r2 |; _& l$ J* F7 P' J! |                .name = "user_led3",6 `$ p/ A) n# [  B' v, G
                .default_trigger = "default-on",
, y3 r3 S$ |2 q4 i5 B7 C) |        },& V) n" Z' `3 t0 A
};+ ?0 C7 ~% h0 O, E, e, B& `- H

/ K& K/ p: d; w% r4 k$ ]+ S& ~. Nstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
2 w3 t' z  W7 R1 K, n6 |* }- T        .leds = da850_evm_tl_leds,
/ b9 [8 y' G' u) ?+ y        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),9 L1 h4 C" l. x8 f* y! k5 R! t$ z
};& X, O! i3 B& i+ C0 v; [) L% @

) p9 |1 X/ Q) `0 e! \2 jstatic void led_dev_release(struct device *dev)& V  p1 u6 }4 H: _( z5 @
{+ b; s: K) V6 b7 V! T
};
2 }+ ]! Z- s+ m. w5 q1 t+ t
" ~* d7 s" Y( f' e5 C# estatic struct platform_device da850_evm_tl_leds_device = {
  I  U7 L- U/ F, q! n+ m        .name                = "leds-gpio",  y: ]+ y8 J1 R% Q7 {* ?
        .id                = 1,3 i/ {3 B  p0 T( E4 Z
        .dev = {4 e. L* L) f- O) ~  G8 p. a5 r
                .platform_data = &da850_evm_tl_leds_pdata,7 F% y4 b/ N" k
                .release = led_dev_release,
4 j! Q( v; V* Y7 ~3 r0 C; H        }
) u% F: }4 H3 r- @% T};
* p8 @4 G$ t# e
( Q& z) J6 B4 R* f$ l! mstatic int __init led_platform_init(void)
* I' [$ E. B0 ~{
2 B' d5 }2 j* d* c8 v8 y( `        int ret;
/ ]0 e, o* H. ]#if 07 D7 |% z! _' w2 Z2 E
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
  c. B( u& k9 b; l; i, u        if (ret)1 [+ k3 J9 p- B& R7 l# }" K. L/ s
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
+ s) q4 Q' S5 {: k5 ]4 f) `) C                                "%d\n", ret);
; X* c6 g7 L$ l) }$ O#endif) V6 O! b! ]7 V) m5 \* F
        ret = platform_device_register(&da850_evm_tl_leds_device);
) H  F; ^) g2 f( T        if (ret)! B) C2 O; O8 a2 C# v6 T
                pr_warning("Could not register som GPIO expander LEDS");
$ B( q) y4 X9 F. e( ?/ Q        else+ c, D( k! u/ n' ?& ~/ }
                printk(KERN_INFO "LED register sucessful!\n");
3 r3 U' c5 V3 g
- f  v: D  ~% D        return ret;  }" }% r( e# O; N
}) |/ M- l6 J7 G1 ]: \' q& M

4 y2 a7 ]' L1 l( G2 Ystatic void __exit led_platform_exit(void)* t) f0 v* j( Z  S8 `/ E
{
" c$ y3 ]$ y! A, ?7 ~. Q  T        platform_device_unregister(&da850_evm_tl_leds_device);
' |) \) j$ ?# i- }- \+ G% o) @1 B6 `  p8 Q
        printk(KERN_INFO "LED unregister!\n");) W: ~$ y. B: V$ h1 ]$ P
}, D. |3 W  T3 b1 `* S
+ r$ _! e* W3 X
module_init(led_platform_init);4 y3 e. n1 E6 A) P
module_exit(led_platform_exit);
7 u& h# t, }( {; g, V8 M2 b1 v4 i( t; f! A
MODULE_DESCRIPTION("Led platform driver");
0 q' k' o' {) z# m+ zMODULE_AUTHOR("Tronlong");; e+ E' Z  R$ y  I7 W0 G1 x
MODULE_LICENSE("GPL");
" T6 R- r& k* {& W) g: d0 {) @# ^1 t- [; y+ v6 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 18:08 , Processed in 0.039468 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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