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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
% U' }0 K' t( _$ ~8 u1 F  F3 T0 \#include <linux/init.h>7 g2 Z8 C0 l4 R' q- ?. c2 ]7 o
#include <linux/module.h>
( ]6 G$ T5 ]+ A# u' D#include <linux/kernel.h>+ Y. H' n  J6 [& {" t. ]3 `
#include <linux/types.h>1 j5 E! S5 R/ g* f( {# X
#include <linux/gpio.h>5 s( H* D" y  m7 y, J. g" _& i
#include <linux/leds.h>& B8 X6 O. ?7 g- u
#include <linux/platform_device.h>" E* J6 q, X5 a7 m2 e

$ Y7 A2 m0 M4 i3 k6 X#include <asm/mach-types.h>" X/ @% m) h5 f( y
#include <asm/mach/arch.h>
$ ], U3 U7 Y6 I# p. R" P. r% J7 G& G#include <mach/da8xx.h>  Q" P0 f+ a0 f
#include <mach/mux.h>
8 N8 b+ a$ G* W( d/ u# F  T7 Z0 \* i; U
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)# q% v# h8 a" a/ R, h3 X& F7 C
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
, S  `' ^2 X+ K: v3 |#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
4 P; b+ A# b( |' k# j1 z# y" e, r#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)1 U/ C" @" Z) O# d

' Z; O5 S" S" X" ]/* assign the tl som board LED-GPIOs*/6 L! C/ J% j/ K) r) [' a1 v
static const short da850_evm_tl_user_led_pins[] = {
3 ^8 v7 ~* G- v6 y9 S        /* These pins are definition at <mach/mux.h> file */
, E" l# O/ [# ]3 K& ~        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5," U/ J$ _" Y4 l
        -1
) T$ e5 M9 \1 U: \};6 t& ~. ^6 `2 w  I8 L# w
. i2 c. n; m4 R4 p4 q% O
static struct gpio_led da850_evm_tl_leds[] = {# V( n1 u8 k7 T2 c8 T- \; m: b
        {
- R! \1 E+ s! @9 k" o, h5 Y6 L                .active_low = 0,
3 f6 v* }% t9 Q9 s3 k" v1 z                .gpio = DA850_USER_LED0,6 i) b: u3 B+ M  t4 }. v
                .name = "user_led0",
2 M  m" w  X# f1 B/ M! K                .default_trigger = "default-on",  G% c; P. ?) `' O: G9 G& s
        },
) C3 ?; v- \  Q  k' n3 O8 \& Q) P& b        {7 D, l6 I; I' j4 `  i) ?0 U
                .active_low = 0,
- F3 C% T2 A6 E                .gpio = DA850_USER_LED1,
0 X; G6 ?$ q8 R. c- c$ H                .name = "user_led1",% [" T8 n6 m( }5 ]
                .default_trigger = "default-on"," t$ K& d/ N2 z* B3 m- `* o4 t
        },. y5 g! d( @3 `9 E+ O
        {
& U! t0 `! g" r; C) N/ ~3 Y8 D                .active_low = 0,
( P+ w) Q& V  m' C0 l                .gpio = DA850_USER_LED2,5 g4 ~/ K6 Q+ H: |3 F' l
                .name = "user_led2",
6 r0 L) l+ F" S4 ]6 E                .default_trigger = "default-on",4 ^, j- V+ X! q9 Q( i$ q
        },) H4 b! d* h# s! E- F  N) F
        {$ g. \* J9 M# A& ^+ z: q1 D- }
                .active_low = 0,
, R9 o7 H" p  T' h7 J% o3 M                .gpio = DA850_USER_LED3,
3 F+ [" s3 [; I9 O7 v/ a7 }4 ~                .name = "user_led3",3 P8 g' x# C$ m3 M
                .default_trigger = "default-on",( b$ c- \& I5 S9 E" t; l
        },
+ y8 j4 E+ l* y# G  Z9 q* o' v};5 |6 o3 v, e1 w
# }2 u; w/ X+ p: z- {
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {: D% m: x) b% A9 r- G' C
        .leds = da850_evm_tl_leds,# k/ r* n1 O* a) o9 d) A2 Z
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
/ ^' E: w# n/ ~( W' }" I/ c8 p};2 [0 }+ k8 S' l8 O8 Q, ^! [

& S  U& \2 I* k5 a- T! pstatic void led_dev_release(struct device *dev)
* S1 W0 @5 i/ ^! [5 b* h6 H{
5 Y$ J/ R) d+ s" }( P, ]};
  T* i+ L2 z0 A1 [3 [: @; O9 c& V1 j
static struct platform_device da850_evm_tl_leds_device = {
7 b  X, u# P6 |' i1 }/ w        .name                = "leds-gpio",/ V) R# V! q3 n- Z
        .id                = 1,, W+ L8 d- O# G& M) g8 ]
        .dev = {
0 V2 [' Q! C+ U8 T3 ~                .platform_data = &da850_evm_tl_leds_pdata,
* [7 v, o) b2 R. E                .release = led_dev_release," N' [+ C+ A5 g' h7 O/ Q
        }9 i6 I" d/ b+ d' f
};
9 X4 ?6 ~, `, i
. U$ C0 I) `& C! N* p7 qstatic int __init led_platform_init(void): y& W4 f. F* ?
{& b+ o& j2 P- [* D2 s
        int ret;1 {1 x% i  a3 _# e% W$ F
#if 0; v, t% \$ ^0 e) S5 z1 @( V
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
9 \& G2 x- m: ~' o- n) r* n        if (ret)$ q6 Z) U0 E0 Y3 Y: a! Q
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
. t  m0 J9 P( A- z) ^  e# F2 l                                "%d\n", ret);. |. ^4 `5 ~% s2 D9 a( P6 g
#endif" u5 F' t, u. _$ V: f' v# z  [
        ret = platform_device_register(&da850_evm_tl_leds_device);. s6 R" w, b0 U9 @% j6 b
        if (ret)
$ m. s1 g4 K" f2 I6 b                pr_warning("Could not register som GPIO expander LEDS");
! _2 U' [) ^' ?* q# T- I        else$ }9 ^/ E* `6 _" o" E; T
                printk(KERN_INFO "LED register sucessful!\n");# T* \7 d( B' V) Y2 r
6 C+ L4 [( l8 F& T
        return ret;
. C7 T4 C7 J0 F/ _}* H; L+ z# C8 D& @

; r) i2 Y  ?( k8 n* s" g( C+ e- ystatic void __exit led_platform_exit(void)6 x& M. _: P' Y! T: m, v
{
: T* O! Z, v6 [6 L. W! j' R1 k# B6 R        platform_device_unregister(&da850_evm_tl_leds_device);+ [) Y1 j" R# J

7 H7 ~& k, }8 @, i        printk(KERN_INFO "LED unregister!\n");* g/ ^# k; e' Q5 N+ }
}% j& V: u' F; {7 y/ V4 }, D
7 C, U6 l, A7 H
module_init(led_platform_init);
5 ~5 c3 J( o  p. T* Gmodule_exit(led_platform_exit);' D  ^: w6 x+ O+ [# n0 \+ d3 `. b

( W6 y5 l, d8 c- FMODULE_DESCRIPTION("Led platform driver");; l; ?* D+ F7 m* `% v: m
MODULE_AUTHOR("Tronlong");+ X3 Z; E! R, i4 n
MODULE_LICENSE("GPL");
  o* W: C: F9 y( e5 i) ~+ B/ x( ^: x% ?1 b3 q+ u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 14:21 , Processed in 0.039264 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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