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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。/ @4 x! U8 Q2 X! \# H  G" W
#include <linux/init.h>. ]# h) M& v$ r" a  A
#include <linux/module.h>4 W4 v- }+ M3 z1 Z
#include <linux/kernel.h># Q$ e, g) Q' B/ l: z7 i8 R: n  A
#include <linux/types.h>
4 G4 _) I4 e# Z4 O( E; A#include <linux/gpio.h>, O& s  f; y1 \: s) K2 g
#include <linux/leds.h>7 C  e- Z1 i: S, J& B
#include <linux/platform_device.h>: l& v# u0 t# j* l

/ d, r3 z$ ^1 W( T#include <asm/mach-types.h># r' A! c" s4 _0 M6 ?4 m3 a
#include <asm/mach/arch.h>( w7 }! k9 w& z; z
#include <mach/da8xx.h>
$ t7 O( z: o% g$ `#include <mach/mux.h>
: n" r( ~% i: ^! O5 [
2 X' f( u- S$ p; ~8 o#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)7 K) r7 E. ^+ n
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)) r. w' w$ J% C: D6 c/ p
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
% w& ~2 ~1 j! ^#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
! N. A% j8 f9 D+ H/ A+ `4 j2 F
2 R1 g' S' @& z) G/* assign the tl som board LED-GPIOs*/
6 I6 \6 n" y; d% q! K( b8 Jstatic const short da850_evm_tl_user_led_pins[] = {9 a0 b( G+ b6 O2 X$ \2 a( u
        /* These pins are definition at <mach/mux.h> file */
5 D4 {, g- e: X) @3 E0 X        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,; u0 m' |* h- r1 e7 E
        -18 ~$ y" h' L, b7 ?$ o
};$ D  R. ^4 q* t; [' c: Y( x1 H
2 v4 o+ f# D0 d, ?7 F
static struct gpio_led da850_evm_tl_leds[] = {
" D- Q- i7 H4 j        {3 X0 m6 H2 `8 y* `% a
                .active_low = 0,
/ B) x2 Y0 O& b+ G* j6 L0 w                .gpio = DA850_USER_LED0,+ R: X! u+ i6 D. d
                .name = "user_led0",
$ T/ j3 n/ b+ Q. R6 H                .default_trigger = "default-on",0 F+ Q, i& `( A/ }7 s0 Z- h) a
        },/ e; y; |* A, ~1 K2 a  q* X- T* t
        {
0 l" O; ?  |2 {, M2 \& B0 u                .active_low = 0,7 m7 i2 W  `! F, u
                .gpio = DA850_USER_LED1,
- V5 @, K0 o6 E- F                .name = "user_led1",
7 N: T) C' B8 c3 J% @                .default_trigger = "default-on",9 Y; W  d. A, I7 V6 I
        },
- P: H5 d1 ^. |  Y        {+ b* r$ E4 ~! B8 ^) _7 @6 H
                .active_low = 0,
* k/ z& `4 w0 d3 z$ A. Z- X                .gpio = DA850_USER_LED2,
' c' N  F+ i, ?+ l7 H  f                .name = "user_led2",
  ~: O4 X1 x, \5 k: T3 Y% N& U                .default_trigger = "default-on",
4 G! S( b1 X+ X: l1 m6 f6 ~        },
. ]! n/ |1 @/ P8 M        {
3 ~8 i. P/ z; E# H' x: B6 c  A                .active_low = 0,
. C+ c* c. S. B, Z$ z5 H; w                .gpio = DA850_USER_LED3,  X! l  i- m  R4 y; P. v
                .name = "user_led3",
. y  Z, x1 u. o/ a; B                .default_trigger = "default-on",
$ p- Y7 F$ H- t6 ]7 D        },! s3 M; [2 y4 K* M) r; F6 ]
};1 C) P( `2 ~, u, ?( G

8 r; g9 {0 |" r* p0 U2 Cstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {8 |' a3 t1 G. M( t; S
        .leds = da850_evm_tl_leds,
, K! ?" z  l# h        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
% t3 c; J+ O" p};' S- z' s- }' U4 \" @7 W

6 m% x2 y5 u# J* L% ^# u* g( |static void led_dev_release(struct device *dev)
; t! h# e: k* F* g{, \2 X3 M+ f4 F3 c/ I! c
};
' P% O) P2 b, I. J8 `# {
1 L/ M5 c: E! |, u6 B1 Xstatic struct platform_device da850_evm_tl_leds_device = {
- `  i: \/ n( c+ o        .name                = "leds-gpio",
1 Z) K8 x8 ~1 B* J& N        .id                = 1,( M7 I# [5 a  [
        .dev = {( |* W1 N% A6 W# y; W0 o
                .platform_data = &da850_evm_tl_leds_pdata,* B3 E5 A6 H5 R4 d$ ~1 W5 ]7 q- t
                .release = led_dev_release,, Z# I9 m, [8 N* v4 ~/ j
        }
+ a6 [2 E1 I) g+ V, j};- f- K, L, f0 s! g: N3 w, r
1 E4 R, A8 v2 h2 m6 l/ A; r
static int __init led_platform_init(void)7 N$ n/ Z1 G; d( h: N4 r, Q
{
9 J7 R+ k, R9 n+ t  ~5 T4 j" r; ]( r        int ret;3 [% S! z5 H' s* r9 C# j
#if 0" i% f) {1 [8 z
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
2 X/ c0 F! W- w0 N1 _0 v        if (ret)
) T) G+ V' _' \( [; J9 D! F                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"7 [1 G& X, Q. h* j4 C. R! x
                                "%d\n", ret);  y- _, g9 X1 A
#endif
, s5 T. c7 b; E( l: w1 A! H/ m        ret = platform_device_register(&da850_evm_tl_leds_device);" R/ a- d* Q7 d/ D: O+ c
        if (ret)& @; I* @* A, Z; l3 {
                pr_warning("Could not register som GPIO expander LEDS");
' w. g' a) s8 A, @        else- H" }' X. z* Y8 a5 ^) M- [
                printk(KERN_INFO "LED register sucessful!\n");
. l% L, X5 J  o$ F: ]. c. U+ C" C* d; @
        return ret;) H1 E  L7 ?7 w
}
* X- h/ ~. c6 i( q) n; `" L0 x: ^% j9 e" D& W2 R4 f& {& c5 S
static void __exit led_platform_exit(void)6 U! D' r+ D: i) C& r/ d* g
{
- I; C# w' |" r" f5 b% t        platform_device_unregister(&da850_evm_tl_leds_device);- w( `- z9 H  {# Z: `" }% n7 v

9 k% \% @4 M" q# {        printk(KERN_INFO "LED unregister!\n");& t9 b) K( H# L+ P" _+ }
}: j0 U* b4 ^# `
% {1 d, h! ~" n( A
module_init(led_platform_init);- S. W6 \/ W( F5 _  c
module_exit(led_platform_exit);
8 V  I% b3 B0 x; c# V3 z, J6 I
+ m& d9 @8 Z3 o7 ~7 i1 FMODULE_DESCRIPTION("Led platform driver");- ^8 }  D" \) F+ N0 C/ z/ e
MODULE_AUTHOR("Tronlong");/ P2 S2 R' W+ Q7 i, T. h
MODULE_LICENSE("GPL");5 Z, ], w/ b# X: h( K! S: S' B

  K+ ]3 a2 q4 N5 ?8 Z: W' e" w" h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 13:50 , Processed in 0.040048 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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