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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。, J4 T) j* L0 n* w# D8 I0 x
#include <linux/init.h>
6 q/ ?$ L1 I! t. q5 n) T6 H1 k#include <linux/module.h>( q7 `) q' j/ _: A5 G+ k
#include <linux/kernel.h>
) y; m+ i% k2 o6 |2 i! @( @#include <linux/types.h>; Q1 Z( S+ ~1 q1 \0 T$ [
#include <linux/gpio.h>: D) A& d# [: D
#include <linux/leds.h>4 r8 L$ b! h' |: ]9 h/ \
#include <linux/platform_device.h>
5 R- @: f( M3 A( Y6 X8 r
; P, s$ l3 j5 h#include <asm/mach-types.h>
" t6 @/ ?4 Q4 ]! I) [#include <asm/mach/arch.h>) _1 @# F# M# ^* Y8 l6 H
#include <mach/da8xx.h>8 \! K) B+ R0 ^  w
#include <mach/mux.h>, Y6 G; U* ^/ ^. X

8 ~! Q! r" K. x7 y3 d0 x7 S$ b0 U. i#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
& \& N( M7 ~) n* A5 L- ^7 e# ?#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)9 _2 M+ B+ Z# ]9 b6 N) |. [
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
8 j- e( S* U* }* n: V% M# R7 E#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
# _; L- V, m. V0 ^3 O4 I5 Y& P: J2 N6 H  g7 M; s7 h5 o$ |. I
/* assign the tl som board LED-GPIOs*/
& O& W) v/ ~  ]0 \4 X6 m* V( Nstatic const short da850_evm_tl_user_led_pins[] = {& E5 u( d& Q4 U) _- w1 J* ?
        /* These pins are definition at <mach/mux.h> file */
. s2 x0 M( }: m% n% A6 ^+ G2 ~" N        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,9 ]( J4 g% n# Y" Q0 e) Z3 ]
        -1
  V. y) L! G" R0 E; ~4 @: z};
+ Y4 ?  K! `/ ?3 p! K( N8 b0 H0 o7 t
static struct gpio_led da850_evm_tl_leds[] = {
. k4 v% z- }8 p! O4 j* U        {) i/ s* ~2 C9 c- i+ @# {/ F  M
                .active_low = 0,
* a% ]7 \; A/ X$ V( @2 t2 y                .gpio = DA850_USER_LED0,$ {( z7 f  J1 D" ?1 Y+ v
                .name = "user_led0",
! Z0 H& F" }6 \' s0 }' z( S& e                .default_trigger = "default-on",* ^9 f) @" Y4 r7 ]
        },
) m* k9 }& O5 u, v        {
" R! `* X5 I! a- e! e, P                .active_low = 0,
* r' N6 T% o/ t( [* O                .gpio = DA850_USER_LED1,2 N, X8 W) h+ U; }2 R$ u% |+ X
                .name = "user_led1",
5 v/ F5 k$ G% m7 e                .default_trigger = "default-on",6 u- `' R! k9 I" }" k: Z: [
        },
3 o/ F& M1 R: _2 ?        {
" `) F- G7 h) U0 Q+ T                .active_low = 0,
, \- h6 y# b8 V7 V  ^1 k* h                .gpio = DA850_USER_LED2,2 a7 g- {. L; ^9 a( H5 f; e1 I3 ~
                .name = "user_led2",% h- v& w4 D( a4 h4 T
                .default_trigger = "default-on",2 c/ H1 s, c" }/ I* n: g
        },
8 y/ G! Y5 Y) Y) ^0 j3 l- F1 g        {  ^; _- R5 b8 m3 {% [
                .active_low = 0,
4 i% _0 u' x* Q7 s                .gpio = DA850_USER_LED3,
- J# M. R% D# ~. h% B4 t                .name = "user_led3",  U+ J  u3 k3 E6 {8 y& |$ n
                .default_trigger = "default-on",
7 J, i5 R1 W6 k% w& C        },
' j5 G& K( i8 s& l9 ]};( T4 j" _* a8 S: b& _

2 i4 _  G9 ~1 fstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {  D$ h" L; y5 Q' p0 Q- J
        .leds = da850_evm_tl_leds,
* c- |4 r) Q# L! A, o6 y6 G        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),+ R8 P. \* `/ b, }" e+ q# w, y* f
};7 E. A2 m1 U# [6 p1 Y+ n* Y
! e* k9 D. K, F$ w" u) a4 i# ]7 H
static void led_dev_release(struct device *dev)$ k4 L8 O2 ^! `5 C
{
* f' K2 v4 n* c4 y6 d};+ y7 ]+ p0 S9 k% S3 y8 G
2 W/ \1 ^: x) r: K, Y
static struct platform_device da850_evm_tl_leds_device = {; i7 F& Q. l8 S3 l& _  i
        .name                = "leds-gpio",7 l+ ]7 N; y0 e
        .id                = 1,
+ R& F0 R8 @" z- J6 U2 _. V6 f        .dev = {
0 q4 _6 F4 y6 L                .platform_data = &da850_evm_tl_leds_pdata,
" j% v. L5 ?: z0 ?/ ^  o                .release = led_dev_release,
0 d7 t8 S* z$ @" S2 M# q        }" w: }5 |  ]9 ?# x
};
( n# p. e6 B+ p$ b& v$ h6 n& G1 o, Y  W, D2 g% \5 R+ k
static int __init led_platform_init(void)+ @) J6 S. S5 c  j! L7 s$ ~% Z
{
5 A8 \; e0 U! r! C4 ^  R+ ~3 M2 c/ k        int ret;( I- s2 f" B2 j' i0 Q% I7 O
#if 0* V# R0 }& D# K: j1 L
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);% A4 C% k$ x! M! h5 G+ s
        if (ret)2 \" q# a! h5 B& ]3 A
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
& C& }( E4 x' ?2 Q' \5 R5 s3 L                                "%d\n", ret);
0 X' s# i  ^- }# |#endif! a& r7 ]0 v* N
        ret = platform_device_register(&da850_evm_tl_leds_device);
9 i' [& H$ d* X2 T6 R1 g        if (ret). y* d* v2 O0 q6 C
                pr_warning("Could not register som GPIO expander LEDS");  B3 z  `3 F1 p, _* H! s- T7 \
        else
$ f2 @; l. e8 t$ d' r                printk(KERN_INFO "LED register sucessful!\n");
( w( s, m3 ~2 X% l
- @2 L0 U/ J+ C        return ret;
1 h; c  Q! X( n}* L% J' T( q$ T5 e; ^) x/ B
/ e& p+ _; |7 V- Y9 d" Y. |2 W6 \  v
static void __exit led_platform_exit(void)- y" l* @# T* L
{
; G& I$ P  z7 W2 {4 K9 ]8 ]0 H        platform_device_unregister(&da850_evm_tl_leds_device);
1 M- m4 _9 @% G" z, h
4 ]- ~1 \' g( Z, \) Y" G8 ?        printk(KERN_INFO "LED unregister!\n");
* g# j7 w" D: X* J1 H2 ?2 K- K}# V$ n' d) L' ^% _% O
. j% M1 D* _) I2 T9 \
module_init(led_platform_init);
* [* v0 X" O. E& `4 r0 \module_exit(led_platform_exit);
. \( y6 E- x5 x  X' @" I3 e/ M, @! S( S+ A3 n
MODULE_DESCRIPTION("Led platform driver");
4 }- Q, Q% R! C, T2 e/ lMODULE_AUTHOR("Tronlong");/ c4 v8 j; C* o, L! C
MODULE_LICENSE("GPL");
* q4 p- x* l2 z0 Y9 [  t# d1 k2 r- Y) G8 V0 t1 D  T; n& l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-19 23:58 , Processed in 0.038767 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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