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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
+ D! o: ?3 \& l* ^#include <linux/init.h>, d3 A2 s& z- m) n
#include <linux/module.h>3 g6 R. Z4 P1 V" p! @
#include <linux/kernel.h># s' K$ B! `  U3 z
#include <linux/types.h>  C& N% s9 W6 u& q+ x
#include <linux/gpio.h>) O2 x" G/ d; n
#include <linux/leds.h>
) n4 n- j9 I4 S7 ~+ z#include <linux/platform_device.h>1 H% x: E% h. s' Q! ~

$ N' N7 @- u6 v2 r2 c9 e#include <asm/mach-types.h># k0 W2 D4 n2 [9 ]9 L3 |
#include <asm/mach/arch.h># A4 Y! M: H5 K* D* }
#include <mach/da8xx.h>
$ m8 p# i0 l, J#include <mach/mux.h>) M3 P* E1 r- b/ N5 _
- f6 Y( A  @+ I/ T9 j. \# p
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)1 S; \" V8 i0 j
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
) J6 l: N; k1 P+ S  }! z( p#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
8 n; B# L2 j. b1 x. E; C#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)& O6 T& G$ y, A# N9 e

5 J- B+ S& m  n& d% }4 [/* assign the tl som board LED-GPIOs*/. ?) \4 {: l0 E4 B2 v1 p' {
static const short da850_evm_tl_user_led_pins[] = {* x6 }8 Q5 q% [5 v% V2 i4 B
        /* These pins are definition at <mach/mux.h> file */+ Q& [" g8 U+ ?- O" E7 i
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
+ w& Z6 X4 Y6 g: H! C# G; X0 I        -1. g, w, f9 X; e* R8 ]0 m4 I. ?
};
$ T, e' G# m# t. {  q1 Z" ^
( ]. R# C7 n7 Mstatic struct gpio_led da850_evm_tl_leds[] = {
6 j5 {6 P! H* p        {9 R: p7 {+ y$ j. X) m4 k, F4 i3 _
                .active_low = 0,
- v1 ?( o0 {$ t9 g: {                .gpio = DA850_USER_LED0,6 L( h1 A6 b+ X
                .name = "user_led0",
* p7 u5 Z, F8 y+ l                .default_trigger = "default-on",/ b. s" }2 E4 J. S9 M3 q3 ~
        },* z8 O: f( L; I. K0 P7 G" N
        {* S. Q1 I% q# f/ C2 |
                .active_low = 0,
3 Z5 |4 M" h! B, K' k                .gpio = DA850_USER_LED1,- b. j7 K+ Q: ^2 W# D$ n; _
                .name = "user_led1",/ f; x$ r8 \0 s8 y9 Y* s3 w2 ~
                .default_trigger = "default-on",
6 d" N1 S. c% C+ Z& X6 ^        },
0 m+ Y6 A& g& j, o) }8 w        {
7 r. c, s2 e' D8 T* j4 v2 l                .active_low = 0,
; t7 T( o; @0 s1 @+ O; R7 Q+ r, S                .gpio = DA850_USER_LED2,
; e7 O4 B8 l, F3 r, p- m                .name = "user_led2",  [- ]& u/ V  s  A8 b
                .default_trigger = "default-on",; a% G3 l" |4 N/ @* g
        },4 b2 b: J6 L6 _& i0 y
        {4 I; s- w+ v. l9 c. K9 K+ b2 ]6 K
                .active_low = 0,  J7 T) h5 b0 }3 Q9 X( n
                .gpio = DA850_USER_LED3,
& y- x) b/ M$ M2 Q- l5 c7 n                .name = "user_led3",, ^$ L6 |( Q2 {. a6 V* G2 s
                .default_trigger = "default-on",* L' o6 w5 p7 d2 g8 Q
        },
/ W$ y0 _+ {8 `& J! F6 d9 D' U};
$ q% c" @0 M( f# c" z) a; B
7 `) X9 w4 B& S- I6 }7 a9 ?$ r& istatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {# Q+ \- F/ a: `9 ?) o* e  a
        .leds = da850_evm_tl_leds,
* }2 O: j1 i$ `% u) U        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
" W+ n/ M8 b" y7 c( `  `};6 S) k$ G4 R4 \. o0 O: ?
9 n5 v8 f6 b% G- N% d& b" X
static void led_dev_release(struct device *dev)  B) v2 `5 a! ~5 y/ X
{: e+ g8 C/ L- H7 k* f
};
& {" N4 [6 l3 @
; n1 \! F. M# E5 D3 p( n% [static struct platform_device da850_evm_tl_leds_device = {
" o, ]9 D  r- o/ P  ?        .name                = "leds-gpio",- b: p2 N8 w( E8 _3 c  j) Y8 E
        .id                = 1,) t7 o8 @  F2 l) x7 Y9 F
        .dev = {$ v9 I2 Z3 y0 Q  W  E
                .platform_data = &da850_evm_tl_leds_pdata,2 S9 g: ~# i5 y% x! k
                .release = led_dev_release,* a$ N! }% [% `7 C+ P9 C
        }9 ?# Z! @8 L6 O+ m7 H
};
3 r9 x) B6 }  P; ~
$ t& b" Q! i/ l7 r, astatic int __init led_platform_init(void)
  n( j4 {4 ~! R" v{: N9 {* A3 u4 O$ x4 d  K: _
        int ret;
  r) h( u: s$ k#if 0
. i' t3 L9 F  X8 p        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
( R& h. y9 a5 @9 f. X$ B  k* {0 [# M        if (ret)3 K8 S: X, Q" E9 S& y! |& N( v' ]
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"1 g4 @8 |: W8 v
                                "%d\n", ret);. X! o1 Q( S- l( {2 D" C, s
#endif
  w/ B2 W/ ]" ?2 k/ F        ret = platform_device_register(&da850_evm_tl_leds_device);
7 W9 j( m* q' H2 I- F7 E        if (ret): d( X$ i" M' _$ [1 ]9 m
                pr_warning("Could not register som GPIO expander LEDS");
5 r* X1 c* b# B5 F# z/ L9 Y& ?& {# I        else
0 d: _8 S2 O& G8 e                printk(KERN_INFO "LED register sucessful!\n");
( a. Y6 |: r9 O/ c2 }4 X
3 l  }+ @: o0 [        return ret;
6 ?* P6 o1 n; K8 I# Q/ H1 `! q}+ S  u+ a9 \3 @+ Y% V
9 w- A9 I* ?% D& ?" S
static void __exit led_platform_exit(void)3 B; l/ M$ ~' G9 }
{) Y1 c' r2 z7 b
        platform_device_unregister(&da850_evm_tl_leds_device);
3 K9 @, T1 y$ B- K, J* S% |" _7 l2 l
        printk(KERN_INFO "LED unregister!\n");$ }$ y" S, c: ]7 |$ X( n% Z& n
}
9 _% o4 B6 P# q+ h5 g! ?9 R9 ?2 Z6 g: V# T
module_init(led_platform_init);/ e9 V3 V* M* c" [3 C- Q0 Y/ M
module_exit(led_platform_exit);6 s! E8 f7 f* _

0 T9 v/ f2 ]5 M# x# g3 V8 {6 mMODULE_DESCRIPTION("Led platform driver");& n  ]- E2 l1 w' f
MODULE_AUTHOR("Tronlong");/ \+ I1 A4 L, T& _6 ~6 a
MODULE_LICENSE("GPL");
; l2 B, x0 |4 N- J" e. h# u9 H
8 u- C# z+ m: u0 Q+ S5 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 11:44 , Processed in 0.042401 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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