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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
! n7 i/ I8 p% M; P#include <linux/init.h>; ?8 C, ~, W2 M$ u0 x0 z
#include <linux/module.h>
+ F# F6 I1 S& v) G: ?  F#include <linux/kernel.h>
4 A$ H* x0 @# d# J#include <linux/types.h>
+ H$ V. b( u8 ]0 h" k/ m#include <linux/gpio.h>3 v6 S9 `6 F/ i" `2 g5 |
#include <linux/leds.h>
5 Z' j! q- |0 z+ c* d( c! S$ X#include <linux/platform_device.h>0 T1 P; J5 m% G+ f: K

8 [) F. ~7 V* c4 _, u#include <asm/mach-types.h>
. ^% @5 _3 |: |9 u5 J# R#include <asm/mach/arch.h>2 y( T/ [- n5 m
#include <mach/da8xx.h>
6 `4 T  C3 A) Q$ z4 r; H3 o4 y. W#include <mach/mux.h>9 y* T0 T6 H9 {; S4 P4 C3 l; c
. w8 F4 y4 d% ?$ X4 h
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)1 @$ v  j# g2 w6 a% D7 o, |
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)2 L) B; a4 x7 F! |: F$ R. j+ D
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1), A5 }3 H, H; ?9 U
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)' w3 w9 `, O0 F. E* J  ?
" ?' k6 L4 j+ |* S' {2 ~& J  |, d
/* assign the tl som board LED-GPIOs*/) a3 J  |4 f" W& Q8 O: ]) e" Q! e
static const short da850_evm_tl_user_led_pins[] = {+ @; z) [6 f0 f1 g+ u% H' c, y" b$ P
        /* These pins are definition at <mach/mux.h> file */- y* u- t0 ?$ b; x. C; A% C
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
2 T3 C3 B* e: i8 l) ?0 r6 U        -1. i8 S& T+ |! K5 {& z" L. N
};
* p: Z9 ~# K/ T6 |
( o3 ?, Y% E% N3 sstatic struct gpio_led da850_evm_tl_leds[] = {
! l3 X7 q8 c& ^& k+ b7 R! c; |/ F        {9 w; y5 a( Q: N  r
                .active_low = 0,- c3 V( x. g5 g4 k. ~
                .gpio = DA850_USER_LED0,5 x" D$ B' I, `( m9 P6 ~( ~) F
                .name = "user_led0",
/ |2 {: V, s: m8 S3 i( H* W                .default_trigger = "default-on",
# F' Q) D5 p. ~$ m        },3 c2 S4 Z9 o* y5 U+ b5 V  I1 Q
        {# G$ k( C3 `/ o. n5 S7 k5 v+ ]
                .active_low = 0,
& A! y! J/ T$ d9 H: D                .gpio = DA850_USER_LED1,
/ B' A0 P' h! B                .name = "user_led1",. R0 D9 \# g- Z) Q* d
                .default_trigger = "default-on",
+ H: _7 N2 R2 z( g  [& b. r        },
4 u: b: M; A0 F, D$ \9 |        {
. y1 y, z0 K' p9 ]                .active_low = 0,! W: |. q: h) _8 p
                .gpio = DA850_USER_LED2,
/ n/ ]: w1 m$ [0 q7 x" F. g4 N1 e1 Y4 [                .name = "user_led2",
# Z1 E  A: T# k5 [( r" H$ l                .default_trigger = "default-on",, C! P! @2 A7 @: r& }
        },4 s/ r5 ]% V4 u8 A# \
        {! G  g1 s6 O  J( I! U; [+ h( l
                .active_low = 0,
+ J  Q! p" |  C8 e                .gpio = DA850_USER_LED3,5 A. q, N6 b: m. I) }, O5 z2 z
                .name = "user_led3",  m1 b. m& @+ _0 C
                .default_trigger = "default-on",
; @( x, \; \+ S8 b        },
$ W# [2 H6 r7 t& k+ g) b  W; q};
  d3 L  p8 X. a1 k
! ^& c9 X+ t0 L. e& s4 jstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {7 d) B/ J2 n( h: I2 h+ D
        .leds = da850_evm_tl_leds,
8 R5 d% a0 t, }9 [  t( i3 h, W0 K! Q        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),, ^# }) V8 @  g: J& w2 d5 Q7 }  f, v& H
};
3 x" Q/ ~3 Y6 }
% a; n$ O/ T3 E2 ~- O  Ostatic void led_dev_release(struct device *dev)
3 `/ B( y  ]/ y. i" R3 q' M{3 x7 E" `- L$ i4 L1 `( H: X
};
5 F/ x" Y6 [. ^: }9 K( V" ?: a% ?# p% t8 ]+ z; D8 Q6 s
static struct platform_device da850_evm_tl_leds_device = {
8 q1 I; o( L) h; c1 p& M) W        .name                = "leds-gpio",3 L5 c) M, v" A1 [
        .id                = 1,; G2 g* ~3 ?2 x2 b7 R& {
        .dev = {
. L! @- S8 _+ |                .platform_data = &da850_evm_tl_leds_pdata,
  W. }" d* V) j1 Z+ ~) s; Y: c                .release = led_dev_release,
* U8 m: n5 T0 ]2 u  A# A: \' e        }
  ?7 @! m; N* I2 [};
+ ^) t5 R% Q3 z' g7 X8 }7 V' S- ?; {4 i: e
static int __init led_platform_init(void)
  b- `' x8 E7 L( T+ ~7 H! J{
% k, g1 s" d% a$ @$ ~9 h        int ret;
1 E& q9 Q+ V( N9 r2 z#if 0
* [. R/ v# g  _2 q5 a0 q        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
. k+ w0 Q/ z. ]! j7 E; x; s4 e        if (ret): h6 F2 a5 t. Z6 p0 x# |" U3 r
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"3 ~4 j% {" E' Y% m
                                "%d\n", ret);
) o+ ?+ g, a* Z: X#endif+ u6 C/ x+ D' P5 Z0 O2 ~0 Q
        ret = platform_device_register(&da850_evm_tl_leds_device);3 K) ^& y7 P( ?# O" {- \
        if (ret); O  z9 E  R1 [8 b* T% \
                pr_warning("Could not register som GPIO expander LEDS");
! y, \) G+ I- N8 U: h        else7 T* P6 u  C2 Z8 U% x
                printk(KERN_INFO "LED register sucessful!\n");
, N4 a1 e" s* P6 Y, V
, s* o4 O. u6 F5 w        return ret;
) B/ P, F0 ^  R# Y: P: W* g" ^1 V}, v8 v) f0 D8 x4 o- o% m. X1 f' i
4 C0 V- g  d. [) y
static void __exit led_platform_exit(void)* y4 O" Q3 Q1 P
{
# c5 R( _( R: R/ s        platform_device_unregister(&da850_evm_tl_leds_device);$ \( \" ^2 M% H+ T
' q# G$ b  V; d$ g; s
        printk(KERN_INFO "LED unregister!\n");& g4 ]- p% k6 W) e
}
) K1 _4 L7 m, ]3 Q
- k" J% l; m; v; k  U4 p# tmodule_init(led_platform_init);
3 ]# G! p8 r4 _( A5 ]! s) y( _module_exit(led_platform_exit);
. l  O( Y+ B1 z, ~
$ c% u: x) F% s9 m% ]MODULE_DESCRIPTION("Led platform driver");# ]+ Y0 |5 |/ u! A8 m% V, P
MODULE_AUTHOR("Tronlong");
# c" s# t2 z8 s+ \% b) pMODULE_LICENSE("GPL");
& L1 F/ k( A* u8 N" g$ A- Q
0 m; _" Q1 i- H# d6 m2 u' E# f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 00:38 , Processed in 0.037953 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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