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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
- V/ E+ `& d% @9 ~1 C" r#include <linux/init.h>
$ W$ O7 O& \5 Q: e1 @#include <linux/module.h>  X8 T  a0 }" k0 O# h9 ]
#include <linux/kernel.h>
% c7 B9 p* O3 Y* m% ?1 `#include <linux/types.h>( A; u+ Z3 i" j/ B7 k3 T, c% g1 v! Y
#include <linux/gpio.h>
! w/ r1 {' H! `5 ?" A* n2 l& G#include <linux/leds.h>  A. x% o. ^2 b! U
#include <linux/platform_device.h>
8 k+ I7 ?  z5 J
9 c* h$ w1 m* x& ~#include <asm/mach-types.h>
* q9 |$ _4 _8 k/ q; \#include <asm/mach/arch.h>
, u! E: a, ~. Z9 @4 ?#include <mach/da8xx.h>
& G3 ^/ o! Y, }9 p; C#include <mach/mux.h>6 }1 F8 y2 d! A

* e. w/ V, L: S) N4 g( a! P6 Q) C#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
# B" r, j2 Z9 z, W  f#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)$ X1 i' ^1 d4 |/ x
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
1 b. P8 f6 ^2 t3 N- `4 Y#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)" O; Q. i; B0 D. G" A  a. a' C
1 n0 F$ M0 q3 q6 F
/* assign the tl som board LED-GPIOs*/
# x5 r2 c$ d7 F. Q0 Bstatic const short da850_evm_tl_user_led_pins[] = {, q* o0 `9 c" m8 M% K5 T
        /* These pins are definition at <mach/mux.h> file */
* ]! }; j0 K0 m1 Z' I4 _5 a8 B9 O        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
" o( I/ t9 j. }  O1 Y        -1! T4 K1 T! R9 D  z
};
2 ~; ]9 q4 K: f4 |. n
/ q5 |3 v: j0 ystatic struct gpio_led da850_evm_tl_leds[] = {
- ]/ Q. [) ]$ C) e        {! ?) U/ A: j# q6 Z8 r
                .active_low = 0,7 R7 X: X$ m' R7 s5 `/ I
                .gpio = DA850_USER_LED0,
' A/ t* W$ v1 n+ k                .name = "user_led0",8 b  l9 h2 E) X; O
                .default_trigger = "default-on",' G: [1 o8 z( o/ V
        },. D( ^7 ~" C6 A& a( |+ Y
        {) K" [# z1 i' w$ ]
                .active_low = 0,  q' A  Y( Q6 V& H9 J
                .gpio = DA850_USER_LED1,
; v0 H. i, }5 J  t                .name = "user_led1",
/ S& |, y5 H5 P5 s8 ~; Q: N, U3 t7 C                .default_trigger = "default-on",# d# y+ Z* u8 q5 o: X; G4 u
        },$ {7 `) Y# a, T6 e
        {
7 \% F2 x8 ~0 [9 {8 K                .active_low = 0,8 \1 z* W$ K/ o- W! m
                .gpio = DA850_USER_LED2,# [( m, H; W- W- |, s
                .name = "user_led2",
' _1 K4 ^, p0 I" e1 C                .default_trigger = "default-on",
+ h+ I& I5 n: ?) z/ f        },  y3 H" }& w& b8 T: m+ ?& E
        {
- }' w2 G4 {; m                .active_low = 0,
' S+ _; I: Y3 {( ^* g  ~                .gpio = DA850_USER_LED3,
# I( H& k7 d" Z; l9 T) K7 z1 n% A                .name = "user_led3",
* P$ V% Z+ \; G                .default_trigger = "default-on",
) {; ]6 h/ s" G5 ~  V        },- u: T2 O7 n+ ?  f0 u) b1 o# n0 e
};! }; ?! Y) ~- S" P1 ~6 I

" ~; u3 D1 Q! U+ \; Tstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
3 Z  z6 U1 X; m9 q  Z3 G6 V' O        .leds = da850_evm_tl_leds,
: q: l7 E2 c7 i" U9 ]+ v        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
: \" b. |1 t& Q/ d% J};
( D, F  A# n$ n* L7 ]- c
1 D. L4 G2 B( R% y9 p7 W1 Tstatic void led_dev_release(struct device *dev)
) F, b0 f, q" x  C{+ _/ }3 N1 a' V+ N$ x; J1 b0 A
};
* e' l- ]* Z3 `( t5 O( G" Y# @6 @9 \) O5 c% ]/ W$ q/ S
static struct platform_device da850_evm_tl_leds_device = {
# h/ P+ ?7 o# u* a6 D  O' I( a. A        .name                = "leds-gpio",$ @; D; E2 Q: n  E* f" V5 @
        .id                = 1,
% q; s7 A4 U1 }4 {) C2 n        .dev = {
8 n* k0 a" V$ }' _                .platform_data = &da850_evm_tl_leds_pdata,
( u+ _8 z3 R' s& P% j% ~; \                .release = led_dev_release,+ s+ R8 s) Q* ?# Q0 F
        }: l7 `- K$ S' ]! t  W+ S5 S
};
9 l" z1 ^% R/ x7 _6 S7 j5 X0 ]& T& T* S$ M$ Y, I
static int __init led_platform_init(void)4 Q" j$ y; a3 Z& M1 T  c
{
1 y# S# \1 N( K& u        int ret;$ r, X' l* @) I
#if 0
. j' [1 G  w6 y) z# r8 q; [4 K4 @2 T        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);  H& P; K" L4 c9 B# S" t
        if (ret)
, t+ z% V: z2 ?' m) K4 w                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
& {  E5 r/ O, E$ P; {/ j8 G                                "%d\n", ret);( `1 w2 v8 x' o% C8 U& m
#endif& k7 P% X  W! g7 a
        ret = platform_device_register(&da850_evm_tl_leds_device);" ^8 A& F& B1 x# d* B. ?. R
        if (ret)4 n4 m# `3 j: ]( a4 c; ?
                pr_warning("Could not register som GPIO expander LEDS");
% N% \- L3 \3 m* o/ f. G        else
, c! [) l* [5 [                printk(KERN_INFO "LED register sucessful!\n");
/ ~6 T: ~8 h5 G( Y# w/ U1 T9 p
2 E; m- T/ ]5 M! Z& A# u        return ret;* Z% `( |6 P" D1 j
}
/ k2 N. U6 q* g- m& M; f% g0 o6 l$ n7 T
static void __exit led_platform_exit(void)
8 q7 U, X& j) ^' c4 `- p{* A! o) {0 v# X; K- N5 b: r9 D
        platform_device_unregister(&da850_evm_tl_leds_device);
4 }& H; K3 ~8 e( K, W0 v6 @  i4 B  h; F' O) u% N( \3 S
        printk(KERN_INFO "LED unregister!\n");5 N% J0 d+ M! g+ y7 x, ]
}0 y3 Z7 N$ d' D: `9 }
3 y' I1 m7 }/ e7 H: r6 O1 A
module_init(led_platform_init);; h' @- Q$ j8 g/ c) j6 y
module_exit(led_platform_exit);) i( F2 T) }7 v& e. `

; `% u2 d7 B9 J5 X* I% y" mMODULE_DESCRIPTION("Led platform driver");- T: b' r# R8 l* ^
MODULE_AUTHOR("Tronlong");/ D# R, @6 v$ _1 L7 K/ |) K3 G
MODULE_LICENSE("GPL");
  a- k1 t/ [$ W1 z$ P  ?* l, A3 _; p9 ~1 f, F. X' T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 05:05 , Processed in 0.045612 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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