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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
8 d% ]8 K& g. F  ]- ^( s#include <linux/init.h>& r# v5 R) H5 L. f+ {% W% n6 ~
#include <linux/module.h>: V- Z# }# W+ h& X
#include <linux/kernel.h>
. f3 b1 h0 N- f8 S/ S" H) W8 _#include <linux/types.h>
. |, a7 l  K- {#include <linux/gpio.h>- @, Z! G9 ?, G
#include <linux/leds.h>
3 ~1 Q  E, [) a2 x9 f: r8 [#include <linux/platform_device.h>; I0 D, y! l! d0 B3 B
9 u# c0 P5 u- j+ x* {9 T3 p" G2 V
#include <asm/mach-types.h>* j4 c  e9 ~; j% T5 s8 S8 R
#include <asm/mach/arch.h>
% F* @+ g# b' _$ K. w1 K, W#include <mach/da8xx.h>
. O" t2 i/ t+ T! c7 i) g* Z#include <mach/mux.h>$ O6 X7 ]5 U. l8 I
' x: ?. w$ I! r3 \3 c$ a% M$ H- N- j
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)% r# t$ z9 e2 ]: k2 K
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5). K, }7 V. v- ~. t0 o" K
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)( e' S4 [' ]2 C
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)9 v9 v0 L2 B  \4 s+ q/ Q6 |8 I
+ p6 e7 p! |, M! L1 N" \
/* assign the tl som board LED-GPIOs*/
. H6 q- W3 r* l* [+ t; [( lstatic const short da850_evm_tl_user_led_pins[] = {1 C; z2 z. |! t
        /* These pins are definition at <mach/mux.h> file */: I& ^" r6 E+ X$ F7 P/ @% d) d
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,  ~. C. [2 _1 z" e& E2 }" f
        -1  g7 D: @- @8 S7 c$ I6 b) @
};
6 ^  A; ~; L* z: u7 n& p. F* M# ]/ ]! }0 x
static struct gpio_led da850_evm_tl_leds[] = {$ m. h8 ]$ q2 V1 M  Y" L
        {, t5 K( w( B% J. z1 S8 W; W
                .active_low = 0,* a: e6 Q9 P2 Z) [" p
                .gpio = DA850_USER_LED0,
$ b1 ~: L5 I* r0 g  Z* f, }2 O                .name = "user_led0",
4 _& |# r% S- W. n8 D# S! N3 L; u- c7 g                .default_trigger = "default-on",9 l; l6 l# L& o* f, k$ J. ?6 U
        },5 p8 S$ t9 e" O0 b* Z
        {; c7 y- t- G' K2 E5 o5 u
                .active_low = 0,' p/ J8 }* Y/ Y3 Z- `3 l
                .gpio = DA850_USER_LED1,) ^% P0 j+ {9 g' [8 u  A2 `
                .name = "user_led1",$ |& @$ I0 l$ s7 F* y( f
                .default_trigger = "default-on",+ O; d8 K; K2 @/ M& r
        },8 f8 |5 [' m' m, `  ?% E
        {6 p% O; A! b. q( F, ?
                .active_low = 0,6 Y( ?" e1 h0 M
                .gpio = DA850_USER_LED2,$ T' ?5 o! F, U8 y( @) F' d
                .name = "user_led2",5 O  d: a9 ^0 y
                .default_trigger = "default-on",: O) ^7 G, s* h2 T( o
        },
3 f* u5 N7 W- L        {
9 r2 `8 Z+ |9 N" c                .active_low = 0,& i1 j! e+ a/ S$ E8 s: b
                .gpio = DA850_USER_LED3,
( ?* J7 ?5 o7 t+ ?4 e6 n6 C                .name = "user_led3",
3 f0 _- y" g4 s2 h( X                .default_trigger = "default-on",) i0 [# M* ?1 [* {
        },2 k/ t- K4 q, A% j; e
};
- E) I% v; O1 n9 ^8 t
# n7 G/ p  I3 r+ Cstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {1 `( L. I; p# [" d& l
        .leds = da850_evm_tl_leds,1 f$ L+ s+ [: Y8 `; L; P
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),% k* H4 @/ Y. J. ^5 k% h
};
5 J3 N2 E0 t5 O/ K; g  f, O" g. g+ G8 @/ ?
static void led_dev_release(struct device *dev)
0 b# T0 Y. N% z: y4 M, v{$ Y, C' Y% O" h1 m7 f6 q
};
5 P7 ?8 a. P, n! P7 e; e, K( v, S. \/ S. z3 [/ t; C- ?
static struct platform_device da850_evm_tl_leds_device = {
" l7 |3 ~3 }1 r        .name                = "leds-gpio",: P5 e% q( q- Y7 K3 ]1 [+ h; k* G
        .id                = 1,0 o8 E/ T1 n6 L4 r# O3 C7 I
        .dev = {  e$ U( @: ?' W+ N
                .platform_data = &da850_evm_tl_leds_pdata,
6 W7 r& S- U0 U# S0 y$ x- {5 k                .release = led_dev_release,
1 I9 C; p4 s* K7 X* O        }
- x$ b. z1 Q. m& L* D4 I};
1 y0 v. Q9 ^5 M
  E0 w9 _" M( estatic int __init led_platform_init(void)
% M- o; s/ X. P$ a7 t- `/ r  o{/ I" P2 q' V! a9 X5 `! p: J
        int ret;
& K% D* Q6 s: K* G  |#if 0" T7 w7 @" R' O
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
& n! D: W5 x* U7 p+ G0 g: c        if (ret)$ e$ ~! o* Z9 z- j: ]3 l
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"! J. `$ N7 j) ^
                                "%d\n", ret);
$ q) T" S, m. r/ x8 X4 [#endif. p6 a3 t0 c7 m
        ret = platform_device_register(&da850_evm_tl_leds_device);. U3 }6 H& [7 }7 p
        if (ret)6 N5 ?2 h, l1 u4 O8 {+ E9 P
                pr_warning("Could not register som GPIO expander LEDS");
" a1 _. L& y9 ]        else
$ G. Q- S1 A9 S7 ?5 _# I) Z                printk(KERN_INFO "LED register sucessful!\n");/ ^8 P3 d; t! i. m' O/ ]# k

- P4 M4 v- N+ n/ C        return ret;' e7 M$ a' z3 c3 R* l
}/ u) ^  m- f2 k- G
5 o/ v" c0 t1 [! ~  H
static void __exit led_platform_exit(void)
1 R0 }$ ~8 x9 N2 [6 x4 v- `7 w$ O3 K{
: r9 s% a4 `( L1 ?$ o9 W2 T        platform_device_unregister(&da850_evm_tl_leds_device);
5 \7 g9 {$ C5 }
4 ]- @6 k2 `/ K$ H2 m) O$ d# e        printk(KERN_INFO "LED unregister!\n");$ b$ F% D3 F0 n* S* X+ H) c: u
}
9 `& Y& }2 l5 B/ q. ~- ]' q' ~9 h  A
module_init(led_platform_init);2 C- q& \  O0 B$ j7 U' ^
module_exit(led_platform_exit);! `& a( W3 X  ?8 m* W6 \8 S
7 b3 e) a+ g: {8 Q2 `1 D
MODULE_DESCRIPTION("Led platform driver");. g& r% x1 ?3 r) }) b) c0 ^* R1 k
MODULE_AUTHOR("Tronlong");/ R- V( C7 @9 T' \
MODULE_LICENSE("GPL");; N8 R0 b7 B' h' `' j& c8 l/ t, F
: d4 l/ U8 |- ~$ Q3 |8 c" M' {; d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 19:47 , Processed in 0.040646 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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