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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。% S5 y* H" I9 C: s; E7 q% m, d
#include <linux/init.h>3 w1 j+ C: |6 P# }
#include <linux/module.h>
( F0 \! ^# ]( O: O, M8 v4 X#include <linux/kernel.h>
5 _# Z1 L# D9 `#include <linux/types.h>+ ?% [( j) N' f; a
#include <linux/gpio.h>3 E1 _5 i8 h1 `5 ]0 A
#include <linux/leds.h>4 A6 F/ H; G9 d$ K
#include <linux/platform_device.h>
& k" Q2 J' \. j. o
2 g; X7 P8 H/ T9 b) ^#include <asm/mach-types.h>1 o' D& u- h& E- |" j) d
#include <asm/mach/arch.h>. {0 c" d0 ^7 O' p0 B, C
#include <mach/da8xx.h>* S6 }7 N8 W& J) s
#include <mach/mux.h>: U+ ]+ p! y) G7 ?6 L) Z. H
( C* \9 C' U  y
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0); X6 u, r5 d( [4 h9 m7 t6 a
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)# n# ?9 h$ \5 ?; I/ `
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1). A! K, A1 s7 I. {
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)8 j, J8 \% r2 q9 T
. Q6 g0 R" z: s: [$ _! }
/* assign the tl som board LED-GPIOs*/
6 k' |- z. Q5 W- h; rstatic const short da850_evm_tl_user_led_pins[] = {
  r  B8 S4 }# i% x1 Z        /* These pins are definition at <mach/mux.h> file */7 }* f7 y& ?% O# g3 z" X0 n; r$ O
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
# n1 X! }: @* Y$ }4 P        -1! F4 k( b5 Y3 P. U* l' e+ Y# c
};4 G. K# v! r% _" l! f7 N$ z& g
- k1 A1 s" U( g4 R1 Y5 o
static struct gpio_led da850_evm_tl_leds[] = {
; f  S8 w4 x4 n* H        {
3 b/ g' S4 i9 B& j7 P) p" J. z                .active_low = 0,# y4 R" H# r& a8 `4 O9 R( O; P
                .gpio = DA850_USER_LED0,) J6 K/ `3 ?: W
                .name = "user_led0",) V$ W6 p0 l' j  R9 p
                .default_trigger = "default-on",
$ s* {, ]! s$ M  ?' h& [% K4 p        },
" K- y  s4 n% r3 P5 k        {
. ?9 u5 K6 I  `  z( B& d( _; N                .active_low = 0,5 n3 t) a" T+ o. u
                .gpio = DA850_USER_LED1,
% _  O5 K* c9 o1 w; J                .name = "user_led1"," p) K8 r; P! ?
                .default_trigger = "default-on",
; K. @+ r2 U6 f$ v' V5 Y9 |$ [        },
2 W+ ]" L# j% |( y        {+ n4 h( X! b. F5 ~; p; k% F
                .active_low = 0,
: }8 x) U9 \! B! p6 _' `, g                .gpio = DA850_USER_LED2,
9 O3 i( ?) M1 ~) E$ Q$ L" P                .name = "user_led2",
0 ?# }2 m$ U4 a  ], [# @                .default_trigger = "default-on",
" q; l, H2 S+ `8 F        },6 V% f4 I" ~4 e; f5 c2 ^' G
        {
" q3 j! n/ O, V- w7 e                .active_low = 0,) N! ]6 c/ {* g; x5 n
                .gpio = DA850_USER_LED3,
) T& I' s9 O, g! V6 c4 i: K" t                .name = "user_led3",
7 z/ C$ O* e0 [/ x' g6 z. z                .default_trigger = "default-on",
/ Q5 W9 d) T: r  z" j        },& Y! X6 {9 |0 {% S* p+ C
};' e% S' C5 V) @+ E$ U

7 y% ~+ t2 Q- F7 tstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
& ]6 k7 ~; [2 W6 @9 B) z$ a        .leds = da850_evm_tl_leds,
/ l# Q: g+ q5 b0 L9 h5 _        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
! N( Y% ?' L& v; D; O& d3 K5 i( t};
- Y" D& O- `6 K4 J, w
  N9 ?3 A# @% m7 Z' f+ O) Bstatic void led_dev_release(struct device *dev): r- R2 F  ^8 l( m7 M' A
{
: Y% }$ o, e1 W9 t* i2 l! W3 L! `};
9 n7 [/ a& p# Z% r2 S2 U0 U  R' K  R2 d: w9 j8 o8 q. _
static struct platform_device da850_evm_tl_leds_device = {" p9 E1 ^" |2 I& r: n
        .name                = "leds-gpio",
- b0 K" q# |9 q" y! E        .id                = 1,
% s; @# T  C6 F: L        .dev = {
1 f- i9 D; z) B5 x" [! }$ o                .platform_data = &da850_evm_tl_leds_pdata,
6 W" m$ K7 Z+ \/ b                .release = led_dev_release,' Z7 [: g2 j- ]  T  k1 v' l4 P
        }
  V% s* [. t; a8 a0 o! B};* U: i$ V& n! }+ T9 C2 e
' |: i- c$ |7 |! ^+ n
static int __init led_platform_init(void)- g! Z. l- d9 V5 G& Z$ z
{
: f0 @7 c' L) Z, T* i        int ret;, A; _& Y8 h, @4 w
#if 0. a2 {5 ?1 U# b" V% x$ T/ R$ ?5 x3 Y
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
' O, n; v6 f8 w0 Q( f        if (ret)! C; s4 h' \. e# E
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"  e) u0 I" O& M$ o: Z
                                "%d\n", ret);
; t# P7 r1 O" L( G0 K$ Q' e#endif# q6 @7 {- A! j7 }0 O9 S( {) x) @- W
        ret = platform_device_register(&da850_evm_tl_leds_device);
3 B5 p  R7 b3 H, u4 S& i! v: A" g9 m! H        if (ret)
( Y5 a! A- X# m3 e! z9 Y# A                pr_warning("Could not register som GPIO expander LEDS");8 e' x7 A- l+ ^% z
        else( l! U& J+ Y: E# k2 }
                printk(KERN_INFO "LED register sucessful!\n");
2 \( P0 a$ h4 @3 F3 I) w
% @: R0 C/ L3 O        return ret;
4 T3 m. p3 w& S. S; W4 L. ^' S}
; o5 U1 J6 Q  e/ A& B9 A) ^$ b# g6 Z  v  B" z% u5 K4 P) l& f
static void __exit led_platform_exit(void)
4 B. ?$ f9 ~  r) J/ Z{: Z5 e' v* K% m1 I
        platform_device_unregister(&da850_evm_tl_leds_device);$ f3 I4 D/ w/ b  |# M; s$ Y
$ N$ r; d. I, m$ C5 U1 v+ X
        printk(KERN_INFO "LED unregister!\n");
; b- N/ ]1 |3 T: J5 t/ `* w3 y}/ a% l! e1 `/ F8 f( \6 o  z
4 b" d& ^0 d& S8 N
module_init(led_platform_init);3 K. s, A1 J& k1 e2 C
module_exit(led_platform_exit);" H3 @# N2 E1 @3 D* O: E8 |! e2 N
/ Y' Q7 P6 S9 X7 W, M
MODULE_DESCRIPTION("Led platform driver");; u3 l& W" |7 i
MODULE_AUTHOR("Tronlong");
) L7 G" ]) [4 o% k2 W' {4 W# h: EMODULE_LICENSE("GPL");
6 y7 l( X, B, S1 g. r! ~0 [* a( b  F& J* o$ ~. N; A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 01:19 , Processed in 0.043030 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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