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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
, D  c! A% x* N6 j  F! [1 a#include <linux/init.h>% C, h+ i. s: j3 v" f3 z( M
#include <linux/module.h>
$ k' I: J& O  n+ W5 o, E$ Q. [#include <linux/kernel.h>: U, b( z7 `5 q# u; m
#include <linux/types.h>/ V& n/ V5 D6 `8 j4 z8 |! t
#include <linux/gpio.h>6 u9 t. C6 p% z' S
#include <linux/leds.h>' E( I, s$ Y' l
#include <linux/platform_device.h>
  G" \6 |" I" d" w2 B. C" ~$ T' x/ Y
8 A! Z; }' k/ a0 Z#include <asm/mach-types.h>
7 b! t& \6 S. U" n. V#include <asm/mach/arch.h>
9 x4 F' z' g. c7 c: B' l& d9 H& N#include <mach/da8xx.h>1 w! E- `8 [7 K9 X5 R( W( _/ a
#include <mach/mux.h>
; u% ^+ I/ J1 y1 s  p# l( `6 A  Z& a/ j$ ~6 ~& w
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)7 t$ M$ b/ R0 w3 {4 f, O* i0 X
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)# {- G; [5 T. M8 O7 e2 Y% m( c2 h
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)* q2 N& i: S; A2 {# n9 U8 C
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
9 T# |' ?4 I2 }, @/ Q# e& I; B: f2 W/ U1 H" M2 {
/* assign the tl som board LED-GPIOs*/
) [+ z$ q: u* i6 c5 q  K9 g* z, astatic const short da850_evm_tl_user_led_pins[] = {& _3 h6 ]( u) O2 s' w" Q) y
        /* These pins are definition at <mach/mux.h> file */. `9 l- i( d2 ], X+ l
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,* ~# N# y: _% A* U; S; s
        -1- j8 Y( F: s0 e" p
};; U8 |$ u6 n1 S: b3 S, n
+ i& l9 O4 q0 f/ h/ S. H
static struct gpio_led da850_evm_tl_leds[] = {# x) m2 P+ A6 v
        {
+ e, v0 D1 F) f/ G+ \$ E                .active_low = 0,
' [+ ?! ^/ [# f                .gpio = DA850_USER_LED0,
' E6 N& T# h  G- L                .name = "user_led0",) C2 E  K' z8 d6 y+ l7 H) p
                .default_trigger = "default-on",3 D; `6 {, o0 r# Q
        },
' ?: d, l1 c+ A4 `, E        {- ^/ x6 ^' U5 D% _- y+ w% `0 U$ H  q
                .active_low = 0,
8 }) p5 U/ r& m. u                .gpio = DA850_USER_LED1,* h2 A% w* O0 s7 n: o6 P2 B
                .name = "user_led1",
, ~9 ?1 H3 K1 |6 h/ p) u2 k+ J7 k                .default_trigger = "default-on",# Q2 u( r8 j+ }
        },6 N& N( C/ |: w! g& \4 I3 {3 S
        {
3 H! |$ e& K' [0 L                .active_low = 0,
0 e" f  Z  f3 y                .gpio = DA850_USER_LED2,
+ Y+ M) d7 S8 N* C# z0 u                .name = "user_led2",
8 Q8 `% T& Q- m" x( G  ], N- R& A                .default_trigger = "default-on",
! \7 R7 t+ o+ Q$ h% }; M0 h        },
; e+ Q. \' n$ M* [        {
' Z2 t+ z7 Q$ L6 M6 Y  s2 p7 r                .active_low = 0,
) B1 o) r7 c$ o8 ?' K; ^                .gpio = DA850_USER_LED3,
* |) Q0 B3 Z) v                .name = "user_led3",* T# s1 c; c/ k( b+ c" N3 O
                .default_trigger = "default-on",
! V  y8 e9 L8 m6 ^/ R        },$ A) p  ?7 O3 t9 s4 R
};
. q/ i9 a) E6 [- G0 ~/ `4 F) R' H  X) m4 ]: u) p% H( @
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {( s. m- U5 n; S" N% C
        .leds = da850_evm_tl_leds,
. z) f2 U: O$ w        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
8 B" q2 x  o: T' p0 Z9 ^+ Z};+ T8 [% |5 `, c* a; m

4 ^  R" e2 u, L% z' V1 jstatic void led_dev_release(struct device *dev)$ C  l4 `6 U! H
{7 \! R; q0 Z$ @3 d( t  Y
};
# k6 H9 q1 j& c1 U- \/ y( T# F
* c# g1 L' p+ n: F# l2 A2 H7 N6 cstatic struct platform_device da850_evm_tl_leds_device = {) _' ?2 H! |/ ^3 Q& D
        .name                = "leds-gpio",* {& ?! [2 T+ F8 I
        .id                = 1,
: }6 P. j% Z+ p  P        .dev = {
9 h; `# M2 @! F) K# }9 Z                .platform_data = &da850_evm_tl_leds_pdata,0 @7 d4 ]2 i" m5 m; o( J' S6 M
                .release = led_dev_release,
! R+ E5 o6 X* x' a  ^/ a  K1 r( |        }
8 q- g. T( J$ P" T4 T: C+ P};- ]/ F7 z2 U! `  ?/ p- \) p% @
. I& j$ T6 Y$ H/ X
static int __init led_platform_init(void)
9 ]2 p% i6 ?& G1 u! s) G) y: Y( G2 D{' S* \. K, N+ U$ o- P! N
        int ret;
  F- F% B; c5 P3 D8 B( f8 p#if 0
! Q! Q. \* B3 j        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);  X) c5 ^! V- K5 N: }
        if (ret)! W+ o7 k" g0 u
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"5 N* Z* Q: d$ M7 x8 X7 j- l
                                "%d\n", ret);
; h$ t# V* J* v5 C& \- ^3 u) E1 o#endif
, C/ w9 Q  H( W; x7 {: d. k        ret = platform_device_register(&da850_evm_tl_leds_device);. P6 |" G$ \3 k  H" H
        if (ret), o2 d" {* Y) }. d! ]
                pr_warning("Could not register som GPIO expander LEDS");
, Z4 {* ~  f1 D" o        else* D0 h% M* U  J8 `6 g
                printk(KERN_INFO "LED register sucessful!\n");8 ~5 v4 p( y. ^& V  k# y

" n, H6 g) g4 v4 n. j2 c+ V        return ret;
6 X7 A6 \3 L# G: }}& m9 E4 s5 X, m- g7 Z: o; s- n

" ?( Q/ h: I8 l/ y) K# {static void __exit led_platform_exit(void)
; J5 ^) A2 x. v6 r, m0 w8 n{5 J9 T" o+ C: k% h
        platform_device_unregister(&da850_evm_tl_leds_device);! G- c& u- m1 o+ [4 r# b3 ?8 l7 u

+ C0 O  K8 o$ w- P' \        printk(KERN_INFO "LED unregister!\n");' f7 M" t0 P# h/ ~; u
}* i' j( Q6 }( G. Q/ N( M( i
# f, y& x/ T" E. h( g" v
module_init(led_platform_init);! t$ C6 o& j) S; O) t
module_exit(led_platform_exit);& v5 ^+ {" Q- ^8 ]' d$ i2 V  b
' c3 U& j+ C) t0 F  U' S/ _
MODULE_DESCRIPTION("Led platform driver");
! p' X+ N( _; t% _% jMODULE_AUTHOR("Tronlong");
, {1 O6 P4 S" S6 y9 cMODULE_LICENSE("GPL");
: m& d' c( g# q. j; k8 E3 U5 n
7 F( T- c  i; Z! O5 L+ Z% c& O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 09:47 , Processed in 0.040817 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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