程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
7 f3 \; z3 T* o6 o  y8 \* y* w- o#include <linux/init.h>8 H# o) X$ p+ N) x3 J
#include <linux/module.h>: W3 }$ d  P6 j0 S  N
#include <linux/kernel.h>
, t! e4 ?: D0 ^8 ?, j#include <linux/types.h>
; |% w/ F" }+ ?+ L# g+ ?% b#include <linux/gpio.h>) ]: Y! R' C0 j7 l, k7 n/ y
#include <linux/leds.h>
$ F1 V  J  ~  Q; [3 H; W+ [#include <linux/platform_device.h>
5 B; j; T8 n/ I6 B$ i+ e$ E) O* B. N0 U, R9 W8 C. ]
#include <asm/mach-types.h>
, C$ V& d' f/ i+ _#include <asm/mach/arch.h>
5 j% E! {7 Z! ^: v#include <mach/da8xx.h>
8 u$ \% g$ t. ^' g' S  p#include <mach/mux.h>: [/ a5 P) ]" t' y6 O

8 N8 h3 j# X" A- `' }- R#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
$ u% b. ]" \' e$ |4 T: B. r#define DA850_USER_LED1        GPIO_TO_PIN(0, 5): j0 [( F  s- `9 p
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
- w+ U% n8 g% K% o2 T. @3 o: c( L#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
4 a3 i( `* b5 H3 L2 R- Y. w0 ]. W* h5 R* g/ ?* w2 b! \9 I
/* assign the tl som board LED-GPIOs*/9 `9 C, S2 ^4 J4 r4 x% l# d
static const short da850_evm_tl_user_led_pins[] = {5 }( y7 M$ T, c) K0 D
        /* These pins are definition at <mach/mux.h> file */- Z8 o5 n  `; g
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,0 n/ }2 t+ \9 J) q' b' i7 Z
        -1. m  W* o" k# |/ g- W" `0 s
};
8 w$ r7 {0 {4 l3 o; G& Z# V2 r, k3 L9 z) G3 ^' w
static struct gpio_led da850_evm_tl_leds[] = {
) b" w# N/ I4 e8 Q  s        {
) n+ x$ f4 r6 X/ @                .active_low = 0,
# H# w1 h! A$ |* L7 D" M                .gpio = DA850_USER_LED0,) q* K- X' b6 @
                .name = "user_led0",
' e: R$ h. p( r& r9 k                .default_trigger = "default-on",
% h, k$ q" l' f- P; i' \2 p* w- \        },
; l3 Q: I* _) \8 f( E, v4 Y        {& `% r8 m! u. x7 D1 E# y
                .active_low = 0,( M: x, V2 W7 H9 D
                .gpio = DA850_USER_LED1,8 u4 K, }5 ^5 j, {% I+ _/ h; {
                .name = "user_led1",
5 w& ~+ {$ x$ T" P                .default_trigger = "default-on",
, y+ ?! m7 e3 x, n( j' z. q        },
4 U3 n8 Q$ E; N  O( W        {
+ @9 {" Y# P) q: r9 G+ m3 B$ }/ y; F: `                .active_low = 0,0 _- }& N: K, ]3 ]% J; H  i0 u, T
                .gpio = DA850_USER_LED2,. V" n, j2 O" f+ W0 z! ?5 C5 l
                .name = "user_led2",! U% J" |" g) k0 }  t
                .default_trigger = "default-on",; J- f8 v1 i  t+ [* d7 ^
        },$ U6 x" l& v5 F* x; j% ~/ n5 M  P8 Y
        {
4 J% D& ~6 g( m2 L3 i5 w4 Q% e" U                .active_low = 0,
$ E$ P/ P/ K" a                .gpio = DA850_USER_LED3,
7 p+ O2 Y4 B2 m% q# t                .name = "user_led3"," M7 I! Z$ A3 ^2 [
                .default_trigger = "default-on",3 D/ Y. h2 H, ]. X& A
        },. B) m4 z/ q( {7 x0 K
};$ x$ `- _4 f2 S

- N( [! ]" ~- c0 v; J& p- t% x' Mstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {3 _7 b! Z' p) o( B) V
        .leds = da850_evm_tl_leds,8 ?( l" p: t6 y  e& V% o
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
' c, ^1 t) D4 T# ?; h};! M( p5 _( k0 G  q2 \

; O0 b  Q" \/ Q. N* gstatic void led_dev_release(struct device *dev)8 Q- c7 F; G' J7 V
{
# j$ u# ^: E6 @- }" m};
4 ]5 g5 F0 u3 \4 e4 s
; P: p, X( H0 X7 Nstatic struct platform_device da850_evm_tl_leds_device = {  a- b' e; `' N- T: u: c/ S  X
        .name                = "leds-gpio",
4 _( V0 K  @1 V, x: k        .id                = 1,5 |7 d1 _1 _6 t& K" X3 [
        .dev = {
0 }) Z4 r7 e4 e. ~$ T- e+ y                .platform_data = &da850_evm_tl_leds_pdata,
4 X( y( s+ Q1 L3 ^, m                .release = led_dev_release,
* L) B4 G0 o! Q2 _/ q0 O4 Z        }, p( x3 {( |& I" ?- ~) ?, i
};' b- E" f& n( [2 e3 ~5 v
4 T4 h5 [% n  R9 B% ^
static int __init led_platform_init(void)
+ E; l( R( y# u6 h' A{  L  W: c# m% z6 o) D" v5 ]
        int ret;
9 z' U! \! e( g1 P#if 0
7 |9 @' V& d  V1 J& P3 u9 P2 x* J        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
3 y9 w3 X% v  D1 H        if (ret)9 Z$ Z8 h8 {5 A0 F+ h' F& T
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"3 S  Y, u6 f0 I2 v6 T" [2 o
                                "%d\n", ret);9 T& w" w9 P! U) ]& k' m( t4 \; n
#endif
4 u. P4 d( Q" F+ u- d# o5 D        ret = platform_device_register(&da850_evm_tl_leds_device);
- l, B- k" r' Y, x/ h, I        if (ret)% E* X. T& z, N: q( Z
                pr_warning("Could not register som GPIO expander LEDS");
5 W% f; k6 V/ N; {5 D) \        else/ u, m0 Y" g; C% i
                printk(KERN_INFO "LED register sucessful!\n");* Z$ T: P" @  K# W0 L: I" y: K7 X

+ q; q, P0 p8 F+ J" l        return ret;% B5 a% L6 b$ X* B  L
}
& d7 G% F1 X( x! w* \3 P; q) q9 F3 K! y0 b- Z6 B
static void __exit led_platform_exit(void)
! j: Z$ V7 Q3 S: L% O' n* Y{+ K: M( e; H7 q
        platform_device_unregister(&da850_evm_tl_leds_device);
+ l, d" |& T% f3 _6 p8 D5 S6 ]$ I4 C8 t
        printk(KERN_INFO "LED unregister!\n");
6 X& h" X( x4 s# n+ S}8 m5 P0 n5 `6 ^5 P( ~7 @9 a

5 b# C: O$ m' @, e! I/ d' O. P3 Lmodule_init(led_platform_init);" S2 k3 b% |; W2 \& X% |$ O
module_exit(led_platform_exit);& j5 X3 o% ?# E5 \+ @: A

7 E- Y6 I) T& {3 U! MMODULE_DESCRIPTION("Led platform driver");
( G% j# N2 I( f4 \  \/ G4 l0 e5 mMODULE_AUTHOR("Tronlong");) o9 \) M- n! G( H5 \/ D" v6 ^+ |
MODULE_LICENSE("GPL");, Y/ M: h$ a( S+ s8 O: d
% x0 z& P. d, A6 X2 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 02:31 , Processed in 0.039578 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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