程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
! N' n" C+ Q& }- q" D#include <linux/init.h>+ v; q# Y7 ~2 S6 t* Y+ }! z
#include <linux/module.h>
. J8 _) B- j& C#include <linux/kernel.h>1 I3 D+ D0 `; g5 Q+ S* G
#include <linux/types.h>, z9 G, a. i5 q# h+ t* }2 X# c) X
#include <linux/gpio.h>( J) J4 i( ^8 {1 s$ r- M$ A2 x
#include <linux/leds.h>
  b. B% P. S+ }. o+ b+ c#include <linux/platform_device.h>
% E3 F2 D" [' ^' I
9 E; i- D% ~% H0 x* J. ]#include <asm/mach-types.h>" Y+ i' p- R; T9 K# J; S
#include <asm/mach/arch.h>3 ?0 w  o8 G2 O3 N
#include <mach/da8xx.h>
0 q9 x- m- |& G5 Z) [2 D" |% x2 t) S#include <mach/mux.h>
3 U' Q* d0 J6 D2 u# _
8 h* [* |# t" V# O#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
" G, ^0 G1 D5 v3 M6 v5 ], Z4 F#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)2 q, F5 U% W% Q
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
% a) a# K' o/ u9 o#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)# g8 r2 X% t) X  x# v$ q

# L6 I- x- Q( Y) w* C, M) w/* assign the tl som board LED-GPIOs*/& \6 X! ]4 c) Y' t' r0 O/ m' }
static const short da850_evm_tl_user_led_pins[] = {
3 Y& v: {6 [0 g* w9 T        /* These pins are definition at <mach/mux.h> file */
. V2 p+ f0 M  b1 i( r( m5 k: c5 a        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
# h. {9 F( D  X0 h; [        -1
4 O1 K/ ~  q% S. D};3 q: P* p+ x! V# A0 r
4 W4 }6 w4 S8 J
static struct gpio_led da850_evm_tl_leds[] = {/ s# X- k' G9 h
        {! U* }- n, ~6 x% A9 |
                .active_low = 0,* Z* B0 m. D& o/ j# S
                .gpio = DA850_USER_LED0,
, C1 k) M' ^6 _                .name = "user_led0",( V; ?* O/ I/ K3 r* ]
                .default_trigger = "default-on",  \1 t. e/ ~; n& I' N; z9 D
        },, g% a* j! _& O8 I+ z
        {
$ }' t6 n" r' Q2 B                .active_low = 0,
& ~+ p" E; `. B1 u& }1 v5 U                .gpio = DA850_USER_LED1,
5 G5 v; t2 Y" {- n7 p3 q                .name = "user_led1",5 d+ P# s* a& [
                .default_trigger = "default-on",
1 A+ Y3 n- N% ^5 b: {8 r        },; v* t6 |- w' e# v) Q$ |6 y+ q
        {
3 h" S$ |% [% J- ~) b: Q0 Z                .active_low = 0,
& k$ P, @- U6 L" ?3 x! ]) B                .gpio = DA850_USER_LED2,* y6 R1 a7 p- `/ a( n* Z
                .name = "user_led2",
: z- L) S' |3 f% T1 _/ B: F                .default_trigger = "default-on",
( P$ U7 c+ v" }, c9 j" T1 j  ~1 J; F+ g        },
+ `, G6 }4 J* \9 A' |0 U  \  W: s        {) c5 M5 s) G- {' J( H0 i, p' E; ]
                .active_low = 0,9 G! u  i7 F4 v
                .gpio = DA850_USER_LED3,' l1 |# T* `& N
                .name = "user_led3",2 S+ H' x$ K- v- b, d/ ]) B- F
                .default_trigger = "default-on",' B# C- t' a; n
        },
6 d6 u! w0 g$ M  y  ~! K; G8 k};; B( S) c, ~6 c  r% l9 p
4 b% x, @# v1 `8 M9 l
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {2 f1 |9 s/ x+ g" G4 l
        .leds = da850_evm_tl_leds,: A  A0 ]; ^' G% I
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
* B6 u7 t0 d" f, [$ r};/ R# ^& I' t8 \5 m
) E2 ^& I5 H# H2 @6 z8 ]7 X1 _
static void led_dev_release(struct device *dev)5 \7 [. G( ?! a& m2 e+ k
{/ x5 v/ z. J5 ], W
};
4 Y  n+ X$ @) e1 ~0 d- S* }( p
static struct platform_device da850_evm_tl_leds_device = {
7 w9 q, ~  o1 r3 l4 C4 e        .name                = "leds-gpio",9 c; u4 R7 p4 K* \( G3 {7 Y
        .id                = 1,# c6 M8 Q+ `& O8 |
        .dev = {, P) I( ]+ B& j6 L* }: [- v
                .platform_data = &da850_evm_tl_leds_pdata," o1 d# Z' W  M% q1 a6 c
                .release = led_dev_release,
# H, S! ?  p4 V/ e  t        }  f* g3 M9 H0 }& \, Z8 G
};% Q1 }3 @3 j( J; G4 e) Z. ]5 y

4 {6 z; W0 @- M9 R4 m. l. c( Astatic int __init led_platform_init(void)
  c5 b3 m* X7 s- i7 W7 {( q! B6 O{' w) `% t2 N: D' W+ u6 u
        int ret;
2 f5 [: I/ [) u/ K+ m#if 00 b0 f( Y0 k! W
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);, s3 |8 d! o! x( p, i' D
        if (ret)9 ?1 O) C9 e" K! p, Z
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
: X6 [  n8 \/ H  A6 L                                "%d\n", ret);
4 S. v  \5 F  J6 l# X) n& S* L8 `0 N#endif% t: c* i- z; t2 g( i6 h4 N4 R
        ret = platform_device_register(&da850_evm_tl_leds_device);; p$ O* h6 K9 ?2 F$ {1 W
        if (ret)
( T8 M! s( c' m$ ~& I                pr_warning("Could not register som GPIO expander LEDS");) V8 a! J- y1 \( S3 a. `4 w
        else
1 S- y- m+ l- q9 z                printk(KERN_INFO "LED register sucessful!\n");
( N  {1 D7 R5 G% U) B9 r% L" K" K9 }& Y* [1 K5 x# A1 z8 w# a3 z
        return ret;/ c; U- Y. d- T! T+ D. N
}% P! b1 \6 a. R; a* Q
5 f1 `# O' j0 x9 H6 j: q
static void __exit led_platform_exit(void)
$ m) _8 _! d+ C. R) ]( l4 }{
: {3 o! `3 Q7 `3 K0 q0 y7 {2 T' ]        platform_device_unregister(&da850_evm_tl_leds_device);
4 Y! P0 O$ y) P7 b9 w9 Z- K- H- e* Q9 e% ~6 w6 G
        printk(KERN_INFO "LED unregister!\n");
1 H: A) w/ y- n% T}
. {5 G4 F$ w. `" C; E3 A# s- w7 H5 J! q
module_init(led_platform_init);
! S0 I# B) U+ s# W; ], R1 {) Pmodule_exit(led_platform_exit);
9 v& }/ W0 p6 H# t) a4 {. F9 }, f, z$ B" y8 ~
MODULE_DESCRIPTION("Led platform driver");
- d+ ]' b! l! `9 T& L! X; EMODULE_AUTHOR("Tronlong");$ v: J/ X' `- R
MODULE_LICENSE("GPL");& x0 K) `9 v; e4 N$ A, O

7 C8 Y- q/ S; S! k$ c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 06:10 , Processed in 0.038229 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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