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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
( B2 c% B- F% q2 X#include <linux/init.h>& G% D( R8 \8 o& ]/ @% g- C/ e4 u
#include <linux/module.h>6 g# o* ~& g1 h7 m
#include <linux/kernel.h>
0 y/ N0 ]: h9 E2 H9 F! [. U#include <linux/types.h>
( X% [! ]3 ?9 O( i) A#include <linux/gpio.h>
9 i% R& K% `# T8 x% y#include <linux/leds.h>9 M) O' B. v& m: t
#include <linux/platform_device.h>
: A: p* l9 c# g( c9 J4 Z. C9 [# ^( o* B8 k
#include <asm/mach-types.h>
6 [2 a6 ^8 W( z' i. _. ~) a4 n! Q7 X#include <asm/mach/arch.h>$ p7 `3 b% s2 v) f
#include <mach/da8xx.h>
& |. `+ h- w. p' ~9 ?. q& P#include <mach/mux.h>6 A% ~" i6 c5 \

0 _/ c. s& B! k! L% ]+ j#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
) J3 G2 O9 ?7 e! j% {' ^$ E#define DA850_USER_LED1        GPIO_TO_PIN(0, 5). X' [  j& `5 k% R: e% n. b% |
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)+ c5 s# G' V+ ]- g) K7 E
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)$ g% @( y8 u5 v6 C& s" B  A

! _2 x" p! U& I+ P- x/* assign the tl som board LED-GPIOs*/
1 B6 u' A2 R; k  c  ^static const short da850_evm_tl_user_led_pins[] = {4 z+ A* Z+ v  \9 F! C) I
        /* These pins are definition at <mach/mux.h> file */4 U6 S3 b9 p* N' x$ i8 k: v# U1 {3 ?
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
, u1 }% F) T" _; Q9 L        -1
% y$ `0 n. b: v8 |/ ]: E};
, i0 X$ e/ \# r) k0 F( P
$ Y7 X8 r' F& {" j6 O/ V* lstatic struct gpio_led da850_evm_tl_leds[] = {
7 c- z% V2 R# Q0 z% e* R        {
# K) n1 o' ^  V4 I6 E0 V8 B                .active_low = 0,9 b9 i4 T& l- }8 E0 W" M) n' h5 t
                .gpio = DA850_USER_LED0,
/ [0 L, x3 X" H/ A. L                .name = "user_led0",
- }1 u! g4 A2 n2 h; _6 o                .default_trigger = "default-on",' Y6 P$ p5 h0 u1 n. U2 G/ M! |2 z
        },
" f/ x( F6 E' J% W9 I        {
3 K2 B+ O- k9 x3 O" ?7 \                .active_low = 0,
* H3 [& H5 Y6 {7 V                .gpio = DA850_USER_LED1,7 O. u8 T, g) y% ]# r. C$ `3 {, u( }
                .name = "user_led1",& c9 ~- b$ n- s7 v! y. L: C
                .default_trigger = "default-on",! f! g, Z2 B% j+ l# q
        },1 E6 v* X% c1 ^4 a
        {
) Z! P' I% n/ L: E8 l" X7 i                .active_low = 0,; y* m8 J* b/ r6 m
                .gpio = DA850_USER_LED2,
2 g! f5 x' M4 o- N1 @0 b3 c                .name = "user_led2",
9 P( p& R$ A5 j0 S0 Q7 v; V                .default_trigger = "default-on",
/ E  [7 X/ c5 V$ y        },* G5 K/ O$ g8 l1 D
        {) |4 i; [) H, K8 N& `. i2 O9 v/ I
                .active_low = 0,$ L! J) f: |. P
                .gpio = DA850_USER_LED3,
5 N6 X; ], G5 \; `1 W: |1 L                .name = "user_led3",2 P* Q( s& ]' ~$ n& g
                .default_trigger = "default-on",5 L4 |: M( |- t1 n. s
        },/ U# b. `  R: i+ P, }" `
};  J! ]6 z9 l. L8 I

# Y4 @1 l7 n# B; O* n- K- Zstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {8 K/ ]) ^! t) ?3 B+ ^
        .leds = da850_evm_tl_leds,, t0 X" ?  ?, s" o4 z% B9 c& c" r
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),: g7 Q4 M. o3 m
};- m& k9 E( H) U8 `+ F: R

' R9 e% [( J& R5 ?- s, istatic void led_dev_release(struct device *dev)5 [4 F$ i6 N8 G2 d. ~/ c$ q
{
+ F9 [! Q+ g% i; [};
  K* c4 h- i% O
6 f9 L, G! }" X0 X$ r! f- t# Dstatic struct platform_device da850_evm_tl_leds_device = {
) P/ d! P! l# m; V+ ?2 E        .name                = "leds-gpio",! ]: b1 [0 i& q- k3 n5 ?
        .id                = 1,+ t' S  s7 L, t. ^& F) b
        .dev = {; j. Y5 |+ }, C) P8 F' X# I
                .platform_data = &da850_evm_tl_leds_pdata,
9 s" f; B) z: O                .release = led_dev_release,
2 b  J' w" {% s2 c/ i# S  _8 K        }
/ B  \7 e+ E! o% A: A0 b1 c};
; C% p# f3 K) J3 a. r! v% R( y' `; K/ y
static int __init led_platform_init(void)
' x- B4 U# F6 f{# p7 S0 A" V! h& S0 |" y" E$ C9 j
        int ret;
0 C4 t+ x& b7 Q5 ^#if 0# W9 b& ^5 ]+ q* Z" M* k7 q
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);: q9 Y; U" G+ j9 |4 Y
        if (ret)
! w( {0 Y6 N8 Z4 c" I5 r8 ^( w- V                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"; S1 P- `( c7 C
                                "%d\n", ret);
5 O$ Q( `) q+ W  \#endif: v! x$ y; S2 y! p# B3 W: i
        ret = platform_device_register(&da850_evm_tl_leds_device);3 ]" k; k4 a) m
        if (ret)% k$ N& k% w& q& }9 _, Z
                pr_warning("Could not register som GPIO expander LEDS");
" U. J' u& |" _        else: S3 z4 _- r, ?" Z
                printk(KERN_INFO "LED register sucessful!\n");3 d( r1 E8 S* H6 k

3 q& X% X; _! n" [        return ret;6 ~  H3 q: ^$ t6 p
}4 w1 r$ [$ j5 O. x2 {
8 R( I; X0 {  m& v5 J
static void __exit led_platform_exit(void)! _7 u7 |/ ^+ h! t/ P
{9 n% c& c- P" q) A
        platform_device_unregister(&da850_evm_tl_leds_device);: e+ u4 L! y& [0 a

% f+ M1 ~% m2 W4 D2 V/ c2 A        printk(KERN_INFO "LED unregister!\n");
( @0 E- t$ G1 {- z}( g9 _) @% I! z1 X4 b* @5 X7 g

4 d5 H" j# h# U2 ?) U' q3 Imodule_init(led_platform_init);
: D) x* r0 M( m  |module_exit(led_platform_exit);
& U+ A' H0 w9 D( q9 M& e. o: e( v. `5 d6 o
MODULE_DESCRIPTION("Led platform driver");
5 h, A, ?) I- N, y% Q7 R+ A8 ?" ~MODULE_AUTHOR("Tronlong");! f% G- {0 ?& [, D
MODULE_LICENSE("GPL");
* K4 `( T1 n" X% y2 x8 G
0 `  T' h' f: K$ U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-31 07:25 , Processed in 0.041171 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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