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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。. x* y, B8 U5 C7 k1 t) d2 T
#include <linux/init.h>. o, P  L; E' q3 j3 o
#include <linux/module.h>3 S0 s3 ~8 m0 \) F/ q% J) E
#include <linux/kernel.h>
# D3 v6 c2 G4 t# @; r$ h, b8 V#include <linux/types.h>
" Y, M% `. s" }/ ~/ q4 }+ x#include <linux/gpio.h>3 S& C) z# e8 u3 U, l) u# A
#include <linux/leds.h>: \8 N: Q, D8 C0 ~
#include <linux/platform_device.h>
8 Q; o" [7 M' J, a, G! h5 t# w  Q3 [/ E; {5 `
#include <asm/mach-types.h>1 k3 `$ N$ Q, ?& Z; p; o
#include <asm/mach/arch.h>4 e& E: }  C4 _
#include <mach/da8xx.h>
8 Q8 Y) i/ Z2 @2 E#include <mach/mux.h>
6 R3 M4 v, Z. x3 j- _5 L9 `$ f% t
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
8 ~' N0 _9 M% L! N7 P, p0 Z% v6 E) S#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)& h! P  `- O: j) v5 t/ C1 V+ t4 H
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)' }: i3 ]7 @& r
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2); G0 [% S2 q# ~5 X

1 g9 ^" `0 x, S- S/* assign the tl som board LED-GPIOs*/7 E" M+ h! l1 I
static const short da850_evm_tl_user_led_pins[] = {" x; a8 m4 ]7 `& a8 h8 p3 T( z
        /* These pins are definition at <mach/mux.h> file */
6 S% d. H+ E, i$ J4 v        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
! d5 z& d2 V* j+ @% |6 U$ V        -1
/ j/ p2 ~* ]4 k/ z# [};8 Z$ ]; e* h$ B: Z8 H$ }
5 F/ e  E3 q7 t  M9 w( T: }
static struct gpio_led da850_evm_tl_leds[] = {
, @0 U. L# B# `& l: i5 _% }. Y        {' A4 y& x" p" J! Z. ^
                .active_low = 0,
+ J% \% L- l8 g; z; B& ?                .gpio = DA850_USER_LED0,
5 g: z$ R- b3 t/ E" n( m% z) n                .name = "user_led0",# ~4 i& O. [( B% j
                .default_trigger = "default-on",
6 }* c3 @# V! L8 I! J        },+ a$ V5 |/ B& @3 k
        {3 R: q) G7 t* ~9 T
                .active_low = 0,
& u8 S" M! k! ?+ v$ s. m5 Q2 l                .gpio = DA850_USER_LED1,
5 O5 q7 N/ w1 p                .name = "user_led1",
4 S2 }  m$ a4 b6 X4 s2 O7 L# ~* }                .default_trigger = "default-on"," @+ f1 o9 Y4 r5 E7 ~
        },+ v6 ~6 H" q/ E: H7 Z
        {
' ^  B2 u- f; d. d3 k2 `                .active_low = 0,
9 r9 p% [, _, G* M( C                .gpio = DA850_USER_LED2,
/ |7 G! ^' d. n" m                .name = "user_led2",
" l) `1 s; A) J+ I1 K% K8 [                .default_trigger = "default-on",
- c6 {4 J: ]# k4 ^/ u/ b        },
0 Y- h( H# i; z$ ^7 ~  Z        {
, r" S9 h( g7 P                .active_low = 0," N8 s0 }( J$ n/ A) Y4 D4 O5 N6 _
                .gpio = DA850_USER_LED3,: N# Y3 @, _  |# Z- [: j" x% k
                .name = "user_led3",/ ]. V% G2 q+ q& e1 j
                .default_trigger = "default-on",
, p  @+ i  K4 B/ w3 }$ b        },
) f3 K# O3 x' p* w" u. B};; Z9 E8 ^, u2 ]1 s3 s  R" R
1 X# W9 u. W/ r
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {8 P' C$ Y- C+ R# l6 ?- @
        .leds = da850_evm_tl_leds,0 L2 A8 ~0 @3 t; a
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),  N. V3 q9 a3 p2 ^
};
2 ~3 s3 \0 W5 ^& L8 q# G3 \9 u+ B3 o# _; B$ l
static void led_dev_release(struct device *dev)7 N# B2 d! L- m5 N, p: X2 F; F
{* P+ |5 t) }2 A$ I8 }
};
2 U- p. ]* I0 r" ~! u
! s8 Z" y/ Q+ M- rstatic struct platform_device da850_evm_tl_leds_device = {
$ z/ u3 n1 @' N% Z1 V+ {        .name                = "leds-gpio",
) f3 d& c4 u' Z9 O- H( x- s) _        .id                = 1,$ O7 r  g# F# w4 I% e: [
        .dev = {
0 p! n: r1 `( D4 @) o6 [                .platform_data = &da850_evm_tl_leds_pdata,
+ R6 C' w: q6 v; M' ^; h                .release = led_dev_release,
* \& s$ m) u, m) J5 R: \        }) B+ Q: t& ]( e. Q" b# N
};' z0 C/ e5 Z" b
& }; B8 T) z# F% Y) w
static int __init led_platform_init(void)5 w, f  R: E( s: k5 y
{1 y6 N% ?- L* S. |
        int ret;% T4 q. n: G2 r* D+ W0 v
#if 0
& c9 s: G8 U7 `. ^4 O        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);# g$ P  q" a* G8 [: N' e* `7 V
        if (ret)
, X  X4 h: o7 M7 J( ^' @                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
3 ]; g+ T$ Q& A" C- {                                "%d\n", ret);6 z( M9 Q' m) v  v8 ]" [  C3 G8 A
#endif
& D2 n/ d7 Y0 x9 }( F        ret = platform_device_register(&da850_evm_tl_leds_device);
8 h0 @* a* M2 k        if (ret)- p9 c! @, w& D
                pr_warning("Could not register som GPIO expander LEDS");$ ^% O$ M# j3 s
        else! [0 }( c6 ~0 O8 ]) f
                printk(KERN_INFO "LED register sucessful!\n");4 f  |, @' N( G
6 V! N8 K1 Y2 ?9 P
        return ret;
) S8 X2 a0 h8 S! }9 Y) f5 A3 w9 U. I4 i/ D}* ?+ u1 f) M0 M6 N- [8 r9 k

8 {8 ?. d( }8 \3 Q0 Ostatic void __exit led_platform_exit(void): v/ |' E/ n; W" o
{
& q/ \- k% A- w        platform_device_unregister(&da850_evm_tl_leds_device);9 z0 S1 A6 f  l2 d7 z/ _
& }% F* o( \" w/ z+ \  Q
        printk(KERN_INFO "LED unregister!\n");
/ l" _4 s. R( j+ `) f5 {3 d}
' Y$ R4 z* w9 a4 G. V: ^  f4 Q- T
# K6 C: }: O0 t, O* N8 u! A6 x' N- Kmodule_init(led_platform_init);0 O) P4 s# W+ e  {
module_exit(led_platform_exit);4 u4 v& Z8 U& a) Z% `$ z

+ g. V/ }8 t( Y" V" eMODULE_DESCRIPTION("Led platform driver");
; E1 Q7 r4 S8 G& VMODULE_AUTHOR("Tronlong");- F6 K) G) B. j5 q' t" a  D- n: b
MODULE_LICENSE("GPL");! w8 R. ^' \' Y1 A$ s' p
) g  a: S7 i, [) t! i) k6 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 09:57 , Processed in 0.052177 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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