程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
7 E& ]; J  |$ m% B4 O#include <linux/init.h>
2 A2 T/ n' P0 Q, A7 r#include <linux/module.h>
# z  v7 U- _8 ^# v+ {, O#include <linux/kernel.h>
& G# ^6 G( C0 n* T* h% z#include <linux/types.h>" B4 y3 C. W3 e  e* I
#include <linux/gpio.h>
+ n- s5 I8 z  F# c6 t# l& v2 j+ g6 Y#include <linux/leds.h>
: Y; T! D  p& R" X0 Z  }#include <linux/platform_device.h>
9 X) [0 g6 F) h3 `5 U: q3 r/ G$ B, B7 O
#include <asm/mach-types.h>( n) Q8 b1 T5 E" L; L6 u; [
#include <asm/mach/arch.h>4 U( h9 [# u0 f; d3 w2 P! \
#include <mach/da8xx.h>
) _, O0 x6 H$ U; w#include <mach/mux.h>
: [  s$ U+ k* M% e$ s, R1 ~" R/ r  k9 V4 R& ^+ L6 J5 t( O/ r/ j" _
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
: T3 _7 K1 }& o#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
) r9 M# C2 ~* v/ T' w#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
% O* Z0 U& N1 v#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)/ \$ W6 F$ b4 G! p
( s( ]8 Y0 s  s! ^* k" ]
/* assign the tl som board LED-GPIOs*/
' k- Y9 t! W6 g+ n$ l* rstatic const short da850_evm_tl_user_led_pins[] = {
7 j8 c# m: o/ U4 z        /* These pins are definition at <mach/mux.h> file */
  |+ H  h% T3 B9 e3 ?        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,3 P5 N' }- \- H! E. b* Y' C
        -19 h) i/ k+ k: u( J) j
};
4 _- o0 z" X8 b8 z, M7 T) z7 m
static struct gpio_led da850_evm_tl_leds[] = {
: U0 q; K- X, [5 T; \$ O1 Q/ d        {
9 j1 ?3 ]9 _0 i3 `/ H                .active_low = 0,& c7 f  r1 L& ^% h/ O0 F
                .gpio = DA850_USER_LED0,# ~( K" g; Z% C) U* o
                .name = "user_led0",1 w8 q( H9 b6 {- A2 z
                .default_trigger = "default-on",
! d9 g) M2 O: P$ K7 F9 k: G3 l        }," N) R- {9 L: o. ~3 u
        {" A- x0 h' e8 w0 @3 v
                .active_low = 0,) ^- N, f: q% U6 G5 h% G
                .gpio = DA850_USER_LED1,' h% V$ G/ W0 a! D$ b6 L3 _/ c# D
                .name = "user_led1",8 S$ g2 h8 f: g2 N9 W
                .default_trigger = "default-on",: {/ |/ h  g, J! V0 r" J
        },$ p; _% y: T8 N3 r
        {
5 i' i. W. e9 u, e, O                .active_low = 0,+ N# w; ^1 }) r' ]' g. ]
                .gpio = DA850_USER_LED2,
% j4 V' u8 L8 ~                .name = "user_led2",
* f- ~) [( D& h$ Q( W- H5 v+ S+ n                .default_trigger = "default-on",3 w0 h7 |' Y/ P6 a/ ~! L. ]( i9 q
        },
* X) `' c9 @. \5 o/ G$ n        {
" q. r: H: R4 B) ~3 F1 `                .active_low = 0,* o7 E8 u% B' N
                .gpio = DA850_USER_LED3,
0 ^# C+ B2 w8 ?                .name = "user_led3",% H6 h4 h% s9 h' w9 y
                .default_trigger = "default-on",
  B  Z1 P, K5 e: w' h" Z( y        },2 y) S& M7 w- v
};
* ^' _; b! B9 V: \( ^2 U% e% N% _! h5 S6 ^# P. k
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {' f/ g. V. s! E5 M$ {+ M. R+ m
        .leds = da850_evm_tl_leds,9 a$ w6 Y5 N, y- k% B9 q
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),% e$ D; r$ k1 B# T6 o! ?
};
- s2 b! T# s, G* n5 g! O& C6 y+ l3 ^( g+ ?
static void led_dev_release(struct device *dev)& O9 M7 K4 T) P) m$ i
{1 q( S2 M) ~; F6 \3 A3 @0 J4 ~" n
};
: t  a. X  I$ u% ~8 b
' G7 X6 V% [2 i# R* c; y+ P. Z9 Rstatic struct platform_device da850_evm_tl_leds_device = {
' r! R' J6 D' ?& L0 f        .name                = "leds-gpio",& z8 W, E% ]  }
        .id                = 1,' D. _7 z% m. o
        .dev = {
! K0 E# b7 [8 L                .platform_data = &da850_evm_tl_leds_pdata,
( T0 K: t, Z! {4 b$ c; p                .release = led_dev_release,
! l4 f0 p6 u+ A8 I        }
% V  n& s+ o1 T+ f};
$ \1 {. C/ _. O* [# [& \# x& K* i6 O  r
static int __init led_platform_init(void)
; [! d' a1 q; d7 @9 J! I{
6 G. h& n; B- c/ a- H        int ret;/ [! N0 b, S3 g4 u& @
#if 0
* H% ]3 f+ f7 I" D: Y$ V        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
# X0 ~9 L2 H2 T) m( r        if (ret)
4 L* A& Z! n3 U, `3 U1 l5 a3 z3 v                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"2 S# V( V1 p. w% I
                                "%d\n", ret);7 K+ c9 b8 J# p, O0 |
#endif4 @+ k) I- E5 X# N# e
        ret = platform_device_register(&da850_evm_tl_leds_device);5 o& C3 z( x2 l. r$ t2 E+ i
        if (ret)
1 [2 F3 w9 h. z# h1 Q! d                pr_warning("Could not register som GPIO expander LEDS");
4 |. D4 C# S6 m        else
" g5 ~  w- @% V' ]                printk(KERN_INFO "LED register sucessful!\n");
% o1 W, M3 Z: x' R% b2 P' E0 C; K; Q# p" z; J) `" U
        return ret;
1 |( }: b3 J7 ~7 _; p0 Z}
5 [  C0 G3 q/ e$ @
: l% `3 c" \8 r7 e4 h- Pstatic void __exit led_platform_exit(void)5 N2 j2 w! e; y: o  X% x+ x; w  q
{
2 p' V( D& L9 K* ?( N2 s        platform_device_unregister(&da850_evm_tl_leds_device);
5 {4 x4 E& F2 l' S; u/ d, C- j1 Q- i2 T( y' E, n- D
        printk(KERN_INFO "LED unregister!\n");
( ^" Y1 `) e( j* N}! d/ j7 J7 l0 ~' A; L( Y6 E

' z7 H6 I) `' [+ Emodule_init(led_platform_init);
4 B' v# E4 @+ k+ amodule_exit(led_platform_exit);
2 |" g) W4 X1 y# U; u! A! N$ v- B, \! i' @
MODULE_DESCRIPTION("Led platform driver");9 a5 |9 V: a; \/ P0 X
MODULE_AUTHOR("Tronlong");. ]5 u5 X: ^" ]1 H0 g9 j
MODULE_LICENSE("GPL");. F: `" k( i4 K
; E  K# U9 h: Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-18 12:53 , Processed in 0.038628 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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