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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。2 p. G. B$ P" s0 p: ^  A' h/ q8 N- T1 P
#include <linux/init.h>8 x& N  c; V7 |3 t* [" x9 d
#include <linux/module.h>9 i* ]" o, ]7 o3 p* E3 [
#include <linux/kernel.h># B1 E  a+ B7 T0 y) R5 t' S, P
#include <linux/types.h>
7 L4 m0 i6 u2 p9 Q#include <linux/gpio.h>2 G* y# ^5 D8 E+ h
#include <linux/leds.h>
: B" j, b5 a) }: D  ?#include <linux/platform_device.h>' v8 R/ `' w' v& [* _  w

3 ~2 ]9 l* I% `, O3 ?2 M$ h#include <asm/mach-types.h>
) R& B% \4 q  T0 D1 [7 O' e#include <asm/mach/arch.h>9 J  }6 O2 a& D. y
#include <mach/da8xx.h>0 y/ ^- _: \( X, t" h5 s7 v) ^
#include <mach/mux.h>
# i9 }! Q' T  e  e) D* `5 J
5 F+ a- U* p8 U: L) O+ t: n#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
" n* |  p7 |9 }9 g! L* k& q4 p#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)' e, C3 d/ R$ I! R3 e2 q$ @
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
5 V; G3 A# n8 X0 k$ f/ _- D#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)' G1 j: j% {) {8 ^5 T7 w: l

: c% W4 P' ^1 j) K* S/* assign the tl som board LED-GPIOs*/
3 w! O7 n& j* ]0 T# astatic const short da850_evm_tl_user_led_pins[] = {
" O5 Y5 \- E- W- M, D! R8 k, @1 h        /* These pins are definition at <mach/mux.h> file */
6 v0 r) ~3 E3 {" w. s! S1 c        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,* a7 |  T% ?$ T' Z4 ]
        -1# j" w4 g: g$ Z
};
9 ^5 C! O% d2 V) D
6 h; @0 K+ k# i8 C5 f% ^static struct gpio_led da850_evm_tl_leds[] = {! X$ f0 w7 O3 M6 c: M
        {
# {0 p+ W1 C2 J4 X. a  b0 r                .active_low = 0,
( {- U" L  I: H                .gpio = DA850_USER_LED0,/ X2 n. z  e+ s# b8 g  k2 P( v2 G
                .name = "user_led0",% K/ ?  w5 c. z2 m9 r
                .default_trigger = "default-on",* D+ G. P# v4 N/ L
        },  a0 h5 w2 a3 R: O
        {# p( ^: E1 J8 S) Z# r
                .active_low = 0,
8 T% e1 M0 w5 H0 m) _                .gpio = DA850_USER_LED1,
% a  S6 E; c$ E, m6 J8 O# n3 `                .name = "user_led1",
8 X5 c, T7 C. s* n1 g8 ~8 f                .default_trigger = "default-on"," F8 b3 O* A& b2 p- [$ j
        },
" s- G. t/ t! v: W        {
2 ?4 `0 l5 q% G. H- [) e                .active_low = 0,! i/ m( Y5 Q' Y) {) ]& _
                .gpio = DA850_USER_LED2,% u  ^  H; ^% m! W& H: Q
                .name = "user_led2",
5 Z+ t8 F# C0 l7 y$ F/ {                .default_trigger = "default-on",% a' H" b' A3 m
        },5 v. \  W8 U' O, Z4 r( \8 U
        {5 S* B8 y* b0 r8 ]% q! Z8 b
                .active_low = 0,
3 C7 Q$ Y& S7 v( }0 |" M2 U                .gpio = DA850_USER_LED3,0 `% B0 l% W$ D
                .name = "user_led3",
! `7 y3 n8 g1 i4 ]# K                .default_trigger = "default-on",
5 I$ ]0 H" @+ p5 h' t' O4 z        },
6 U+ t8 @# ~' }6 M. F};7 Y  {; o) j9 i. \9 V7 r

3 K% E" m' d$ d. q" B% E# L" n: Vstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {4 J; w* f1 ]. ~- p9 e1 p( D
        .leds = da850_evm_tl_leds,
, {5 d. c$ i7 ^9 G) \4 `        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),+ F9 Z& Z# V% P
};
: C) a! q; J0 w6 |, P, V: T! ]3 C7 ]
/ D& \, m' T3 N4 \; Y0 ustatic void led_dev_release(struct device *dev)
( c# l& ~  J% [1 E" [8 C3 Q{! u# J% e  ]) }6 D& _
};: p8 ~( r+ n) F) o: B# M
* F7 l; t7 p/ k4 m3 [6 K
static struct platform_device da850_evm_tl_leds_device = {! I2 U: ~$ M2 Z0 [, G
        .name                = "leds-gpio",
) z1 a, ~% {: q' ]9 t4 i6 m& B# r6 t$ L        .id                = 1,
7 j" o0 j( r8 g        .dev = {# u% p; T# Y/ E5 R. g
                .platform_data = &da850_evm_tl_leds_pdata,) F' ~  @5 a. s
                .release = led_dev_release,
; D# L7 |- i  q        }
$ y) m8 a$ @) J/ \$ u6 O};
' y# \  {! j4 Q; I0 w7 w
; Z" e0 O3 o) o% [& zstatic int __init led_platform_init(void)
. }% w) y" }) A6 K. L' O+ v{
& u+ e! _0 q  i: P        int ret;
. r! t" ]1 K% q! [#if 01 d2 @! w( c( \" X; j
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
0 {+ x. e5 ]1 _* g% U        if (ret)8 X# Q6 ~: Q% l' T
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"9 p- P' m0 E2 `6 Y$ T. k
                                "%d\n", ret);7 l3 r( {  G) s; H  y
#endif
% ^1 |: s# ]6 m) h/ _        ret = platform_device_register(&da850_evm_tl_leds_device);
; Z: X% X2 F% j: {2 T9 Y( i        if (ret)
9 n" H( [5 ~  ?- \% {3 K1 |                pr_warning("Could not register som GPIO expander LEDS");. V' s# l, T& p. Z8 E
        else
/ Z7 I% x' X! q/ X3 |1 z' s1 C0 P                printk(KERN_INFO "LED register sucessful!\n");
5 d8 O. D5 w' \  U1 s! ]0 J
' G$ |4 l0 c3 r        return ret;, j2 z' G. G" I& `! C* T+ ^3 L& K; b
}9 }0 a& ]! ~& P% a5 ]
& B2 x- R. {; _6 d: c3 V. \
static void __exit led_platform_exit(void)
# X+ d5 h8 m0 E$ H1 o! F/ i{
" k# W  m3 ]5 p- c& }- g- g' B6 G        platform_device_unregister(&da850_evm_tl_leds_device);
/ w4 D9 ?2 Q& b6 ?  \2 K
9 V8 I* Q/ K! @$ L, {        printk(KERN_INFO "LED unregister!\n");. b5 `  s. R, f3 s
}
, z( F* L" N$ |  x) l* G; F; n8 X. S/ J
module_init(led_platform_init);
6 o$ \. G+ D" }& \& m0 tmodule_exit(led_platform_exit);( L# k% ]7 [3 _8 a1 x

+ ^3 c6 d! O! I. e4 lMODULE_DESCRIPTION("Led platform driver");
: `0 }% M5 |5 x7 i2 S: T9 X, k, XMODULE_AUTHOR("Tronlong");
0 k* G3 A- `& p6 {  lMODULE_LICENSE("GPL");
- a: _3 r3 w* y3 |# X6 ]+ D2 f( X& K/ x& k2 q& U3 E1 g: C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-17 03:53 , Processed in 0.050167 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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