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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。0 a' H* n' f9 C5 e7 p+ n9 G
#include <linux/init.h>* t  P* i; I9 y9 X" O
#include <linux/module.h>
8 ^7 x3 G3 l3 r: W+ Y#include <linux/kernel.h>: U# v9 H! r1 w4 r; i
#include <linux/types.h>
1 K  h8 v, d" S' \8 o#include <linux/gpio.h>
" T# o5 Y% @+ E, D; N#include <linux/leds.h>
% I0 m$ f& [' w) E8 E6 g#include <linux/platform_device.h>
+ [7 J# X4 k; d  v, a' K% I" c) s. v2 H4 F8 j' t
#include <asm/mach-types.h>4 u* M6 x% P  L8 S& I! i
#include <asm/mach/arch.h>
9 R% g+ L" l+ q3 a* d/ V4 i#include <mach/da8xx.h>) y- F& m6 n- k! h7 f
#include <mach/mux.h>3 Q, [5 u; r) f% J
' f: V6 a$ H0 D, x( D* ]
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)' h2 k! _+ S3 A  [
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)5 E: j/ w9 \3 l# Y
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
3 B. f9 M+ R. D& X1 l#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
* B- m2 S5 o; j+ X0 X0 ?( t1 ?) e3 y& }" c+ L: |  i3 Z) T2 ]6 x
/* assign the tl som board LED-GPIOs*/
* d7 }+ V% \' c" [static const short da850_evm_tl_user_led_pins[] = {
* ~+ @0 R* K: U" \& L) C        /* These pins are definition at <mach/mux.h> file */
/ `7 M: v" l4 z  W$ e        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
2 O+ G) f6 E5 S; l3 a. }3 p" ^        -1
0 z! o( ^: w% k- I0 T8 v};
- [& q% q4 a9 D* E' D  w
" d) ~* @3 ^) ]# @' gstatic struct gpio_led da850_evm_tl_leds[] = {
* T- L& v1 D0 @" c! x        {
& P3 v; f; c% e/ W                .active_low = 0,
& t% w& o# ^- z3 l2 ?                .gpio = DA850_USER_LED0,% J+ o8 G# b, b& K% ?( T
                .name = "user_led0",6 Y2 T" d( _& `! S2 n; X  Z
                .default_trigger = "default-on",! g7 V4 Z1 ?) V
        }," F& G) M8 T. ], X$ l
        {" }4 F1 K2 B* }, m4 l8 e' b, A& a
                .active_low = 0,
5 Q! z; ?" ^1 }4 n( ]                .gpio = DA850_USER_LED1,; Q) `8 P2 ]- x1 q
                .name = "user_led1",( D# u" _& z4 s
                .default_trigger = "default-on",
# V7 }& d( G% x) v9 V        },
" G" r2 t" H. {4 G8 w3 n8 M$ z        {
+ Z$ C2 @1 k6 G; R) S% k                .active_low = 0,3 {( Y8 A" b/ m) o* W4 t  b
                .gpio = DA850_USER_LED2,
, V1 a5 j# ]/ O/ w                .name = "user_led2",
3 A: N- W7 L! y$ c- r8 |+ ]0 W; p                .default_trigger = "default-on",
" X0 _9 D1 V! |        },
% \; \2 b& \! V/ c# o        {
8 Z; \0 B$ Q; [; M                .active_low = 0,' j! u$ A: f/ J0 X
                .gpio = DA850_USER_LED3,
/ ]  d1 q+ D5 `% J% ]                .name = "user_led3",
( J4 B" p$ u, l                .default_trigger = "default-on",
" E/ S4 m) v2 p1 S# x8 j7 N        },
& t4 [. O+ g7 S# Z8 M7 c, @};0 `& w& ~" d+ {

& S, b! v' e5 Z- R+ g( Ystatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {1 r" F0 J: n8 n! J# n* g% [, D
        .leds = da850_evm_tl_leds,
" F( Q0 O, L; Q% y: J        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),/ e  ?6 h0 P# E* x) D. J
};. ~" J/ l: U8 p( M" L, N
8 ?0 t" y5 \* f
static void led_dev_release(struct device *dev)/ S$ h' @) v/ r6 j- T: s* z
{, `0 d) d( m3 j3 l7 ?
};- b3 r7 R3 h8 O% Q% p% E

! P" j! I! S. V0 dstatic struct platform_device da850_evm_tl_leds_device = {. F+ m, ]% f0 c. v& r! p4 {
        .name                = "leds-gpio",
1 ]. x& z- i  M        .id                = 1,6 o) R9 X) P* F; V
        .dev = {5 I3 g- `- O0 [6 [5 e% @! B9 u3 {! R! M
                .platform_data = &da850_evm_tl_leds_pdata,* d, C% C' N9 y" _0 @
                .release = led_dev_release,$ h$ |/ p4 p. n6 y
        }' O$ d# T8 ^0 \
};
) j) F0 p+ J0 l) A% }
- U) h* c' w$ _  B) d0 H& ^  |4 Nstatic int __init led_platform_init(void)
+ g, W' {: `- ^{
+ f) C1 U( \) ^1 G. @7 X: x. I; Z/ l        int ret;
! d7 m$ W/ r) c) X3 c  i#if 0
; ~+ M$ w' Y" |9 C$ {( x        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
' h$ D" _1 O$ Y7 R4 D7 L        if (ret). \, t4 d7 _* ~. K4 x
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"" Z8 w! C, h' v7 l, t/ Y, O- c
                                "%d\n", ret);
, I2 D% s( U( B9 Q( Z. k! K5 s3 N#endif. b& k5 D  F3 H; `$ X
        ret = platform_device_register(&da850_evm_tl_leds_device);
) a3 l% ]/ I3 t$ S  S  K' V9 d        if (ret)3 _/ i! Z$ t' U2 m
                pr_warning("Could not register som GPIO expander LEDS");1 _; H# x0 Q) v5 d
        else
" J0 B# [+ b# X4 w+ H" l8 Q2 N                printk(KERN_INFO "LED register sucessful!\n");5 k  K0 o; {, A5 f. x

) z1 L$ i1 b' r$ r( h        return ret;
: d" P7 Y& N, M3 `4 t}; S3 k2 [4 n  ]- X+ ~0 P) p, o

7 j" J& p8 ~( Y2 J# I/ nstatic void __exit led_platform_exit(void)
$ q. u' t% H  O4 t  S: f  H{! U# ]) r8 L0 v4 a
        platform_device_unregister(&da850_evm_tl_leds_device);9 w/ m% j6 |. Y2 P! E0 E; t2 {

1 r8 e7 A1 {. N% ^: w        printk(KERN_INFO "LED unregister!\n");
7 Q5 c/ Z2 Z0 c. r}
9 ?* D. ?* w  G) T$ w" b! K! L5 r% U& v0 n1 b4 N3 C1 l* e
module_init(led_platform_init);1 H3 W( \2 W2 R1 h! k  ]6 T' b1 S; m+ n
module_exit(led_platform_exit);
1 p2 n. [5 t; D6 |7 _* E3 o5 P: g4 }. [! q9 K1 U$ T5 c) j6 t
MODULE_DESCRIPTION("Led platform driver");
6 @& O; Y4 N; I$ Q) V4 g4 zMODULE_AUTHOR("Tronlong");
: Q6 ^2 f7 W: {" |MODULE_LICENSE("GPL");3 z! |) B+ X( i
! j" z! l2 ^3 ^' `! a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 09:38 , Processed in 0.050469 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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