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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。! O! E' D1 E3 \! I" `; N6 ]7 Q
#include <linux/init.h>3 k- [/ {- q8 l5 v7 A# N( _
#include <linux/module.h>9 d6 e% [) B) H" |1 ]0 d
#include <linux/kernel.h>: k* g6 t! P. y' b/ X
#include <linux/types.h>, |  g) J% \, j1 U" l
#include <linux/gpio.h>0 J6 t% i6 O" I
#include <linux/leds.h>
2 T# O& _9 r3 c* s* h/ M#include <linux/platform_device.h>
6 V9 }9 I+ d% I7 ~8 o7 X4 Q3 R0 ~! `2 v! Q- D7 X' t
#include <asm/mach-types.h>
+ D3 _/ e; F% \: y$ q2 o#include <asm/mach/arch.h>
$ m" p) ?0 _6 h( \#include <mach/da8xx.h>
( y5 t6 t; T- @6 m0 J5 h; I6 w#include <mach/mux.h>% K: Y. p, |1 k) F5 g0 q* b
5 |# }3 R' E9 d7 s+ i7 d, X
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)7 Z% a5 @) Z$ \/ U9 Z  [. `- H
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
1 T# V( K$ W4 ~3 S. ]1 q/ ]7 s#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
2 W$ q% b0 p1 }( Q#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
) u6 }2 V2 q$ ?$ ]9 f* s4 ?/ K1 f$ _' {( f) y! N/ P% s: w
/* assign the tl som board LED-GPIOs*/
. o1 k1 C0 @, A/ O8 Z! F" X5 cstatic const short da850_evm_tl_user_led_pins[] = {- y. L4 L4 C% Q$ ?0 K+ h! S* k
        /* These pins are definition at <mach/mux.h> file */
) ^7 U+ Z. l: u9 P        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,1 N) i; G% l. j5 b, \
        -1
9 {5 ?! {; W. g};
5 S5 f# E) |7 R) |& Y5 U. U1 s# ?2 J+ c
static struct gpio_led da850_evm_tl_leds[] = {
+ F8 o& Z# \1 N0 H" M+ _        {
) v) \' a6 D  ~" K" V  u4 ~# m                .active_low = 0,( ~/ v5 T) r9 l" B3 \* t3 a
                .gpio = DA850_USER_LED0,$ {+ b6 {3 g+ u, C/ `
                .name = "user_led0",
6 n; `2 C, `( W3 n" Z                .default_trigger = "default-on",
6 ^( O! ^$ b& E2 f1 t# q; I- Z        },; k8 L8 |- b/ \
        {
3 q( _3 w( Y! @, @- D1 c0 w+ @                .active_low = 0,7 `( {. g# q4 g3 O0 d8 n
                .gpio = DA850_USER_LED1,
- C* Q& b4 A# T1 F- T5 S, `3 J                .name = "user_led1",' {1 T. J) S! [
                .default_trigger = "default-on",
) J& d! ?8 L/ S2 R3 w! B        },
3 n& ?1 d3 R  H7 ~        {% |5 ]+ F' V2 D2 l' k; i
                .active_low = 0,
# [: R, x. [8 i                .gpio = DA850_USER_LED2,
4 p2 A- b7 Z9 F+ T9 S3 A                .name = "user_led2",( k9 e; n) e+ V  J/ T" k
                .default_trigger = "default-on",* f; Y5 R. x9 s% r
        },! ?* R6 i, M/ N# m$ i' |* p) ?, R% L
        {3 u5 J' n/ Z# v  x( t
                .active_low = 0,
7 i( o+ ]! s9 y: A7 P! a1 ~# ]                .gpio = DA850_USER_LED3,9 }* n; Z9 |! k, I8 c1 j1 i3 `
                .name = "user_led3",
* H( M( G" |, J" g: w# U) A6 m* j* @! K                .default_trigger = "default-on",
3 z& i. B, G$ {/ h1 O$ ^        },
* T0 X  B+ M$ L" Z};
2 g; G- i4 l; \4 k8 ]8 z3 D) r; W6 [6 c5 G& M
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {3 N7 B3 c, \) d' ]
        .leds = da850_evm_tl_leds,9 Q5 q5 ~  [: M3 I) |
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),4 P- J7 R6 A% X+ m, H3 @( A) c& J
};
& H( m6 z' k9 W7 Z7 t0 {) ?* j1 l( O$ {' M8 r; W/ p
static void led_dev_release(struct device *dev)
/ t: D( E+ p& l6 U{; \( U, C  B( M/ p* h" ]% n  @
};
5 ~5 e# _* B2 n+ H$ O& f3 V. }5 s! W0 i$ p* S
static struct platform_device da850_evm_tl_leds_device = {
8 q2 o' ]2 V6 o# r4 q7 z/ X        .name                = "leds-gpio",
* q* U1 K% u0 i' G( y/ Z; K        .id                = 1,2 L. T# Z0 J3 L0 W
        .dev = {
' W; l% b' ]( y! g% `+ n; h: C                .platform_data = &da850_evm_tl_leds_pdata,8 N, \" r" X7 p/ t' a
                .release = led_dev_release,
  o' \' j& t: c1 S, r        }
7 u. G, N) A0 @2 C% d6 h};; f8 }7 j1 s, x) f

! ?7 a3 s& T. A. K% T) b- H- ystatic int __init led_platform_init(void): d4 ~  ^* ?5 b) O! X' D
{) ^0 P! Q; {2 b$ O
        int ret;
7 C; {7 U; ?  X! T& s$ O  D. `#if 0
. l8 Z$ t8 i9 `1 P        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);0 B& V' N7 q; o* a' u
        if (ret)) @0 p8 `) M4 u5 @9 k! X
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"/ d. u! Z) P7 {2 {$ L% C2 E0 Q8 S
                                "%d\n", ret);
- E( E9 m5 H1 C3 `0 N* C$ w) H: C* w#endif
& ~* x. T* U2 X9 Q        ret = platform_device_register(&da850_evm_tl_leds_device);
) j+ K" N$ C' ]# u5 P0 O        if (ret)/ `5 D3 |2 Y9 j* ^" a% e% \4 a
                pr_warning("Could not register som GPIO expander LEDS");6 j. `+ y+ H. i5 Y7 K! ~
        else
: [, a( {) F# I# V; R                printk(KERN_INFO "LED register sucessful!\n");
+ U( P+ X! [0 ]
$ ^# \, I& x1 }7 N/ y: a        return ret;9 y; W/ A3 \- g; T& `7 C9 V$ \
}
; W& \9 G- }9 L5 ]/ Q  e
8 c/ h& x7 K" Q. V$ E/ H- |static void __exit led_platform_exit(void)
8 h8 p0 A5 c7 |0 M2 ?- }) S) Q" d{
. p* |3 U" m6 V+ S$ J        platform_device_unregister(&da850_evm_tl_leds_device);
) h+ Q6 p; x9 h. M) M
! e. k* S* v  v( N3 Y9 `        printk(KERN_INFO "LED unregister!\n");) |- |& e% {6 P& N0 y0 E
}% D% D) r8 A7 c. _8 Y; F/ N
4 u4 o& T2 p5 K" `5 t0 R4 e
module_init(led_platform_init);- f# g- ^* g5 A& g* Q) e
module_exit(led_platform_exit);. v; O: Q, C$ H0 G1 g

" q/ w- D0 V& P+ ~; `MODULE_DESCRIPTION("Led platform driver");
8 F% P% Q2 T9 d8 W$ lMODULE_AUTHOR("Tronlong");0 \! l  \# h' v7 h
MODULE_LICENSE("GPL");8 I4 H* A: f3 y
( ]& `( ~  A; f( i- j$ L! O% x6 p, M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 15:28 , Processed in 0.041005 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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