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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
4 O% P) t3 p7 h- z+ G" P8 k4 Y. U#include <linux/init.h>
* F& x" P( E+ m$ T' d#include <linux/module.h>
3 f2 x% g6 D& l: r/ j7 g+ i& q  [#include <linux/kernel.h>/ p  a! N- f0 J; p+ |2 Y0 X( v
#include <linux/types.h>2 h# K3 @9 ?8 h  I
#include <linux/gpio.h>
: _5 I  G9 [$ d0 Q) F% g#include <linux/leds.h>
. x' p* F5 m- f) R& K$ p2 E3 j#include <linux/platform_device.h>
7 {( ~0 |! s5 O9 Q: W
' v  x+ B' f* ^; k5 Z#include <asm/mach-types.h>
* |  D8 ]+ _7 S4 H6 S  d8 S2 t- t#include <asm/mach/arch.h>  Z4 Q* \$ C  G+ i7 q* ~# [+ k
#include <mach/da8xx.h>3 b7 T9 \+ H% f$ n
#include <mach/mux.h>
1 p# {- k, }$ g/ L
) d( p6 I7 O8 X) z# ?7 j#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
- Q5 ?$ W  A3 J7 b#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
, b+ {# l, F' Z) [#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
7 W6 s: c5 ~: D#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)" F# \! o+ y1 p- g& H* |2 z: b
/ K3 \' ~8 j, f5 W
/* assign the tl som board LED-GPIOs*/& k6 @/ I7 |, _! n  O
static const short da850_evm_tl_user_led_pins[] = {0 \; i5 H* b  J* C3 G- Z2 P9 ^
        /* These pins are definition at <mach/mux.h> file */
" ~7 D- A% x, x7 S: c9 u0 ^9 Q        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,& d0 R0 {5 r& s7 R
        -12 T0 R2 l3 k' U4 L; h2 Z1 J
};
% u9 m' z/ s9 B0 o% j+ n% I. R4 ?3 B+ @; O8 z/ C$ C8 e
static struct gpio_led da850_evm_tl_leds[] = {
& n& N0 Q' _. ?% r$ L- D        {
2 |& G# N# Y( H& c, _3 J+ t$ q                .active_low = 0,
5 ^7 H' M+ }; j: }                .gpio = DA850_USER_LED0,- i$ a( f8 g& z# a% c8 O
                .name = "user_led0",
' T$ G& c& ?9 q+ n/ i4 x                .default_trigger = "default-on",
) O/ _* E+ {( F, j. f" w        },
5 H; S* I" Z9 M        {
( l& b1 A! t# N, u                .active_low = 0,
& \9 ?, z" A! b: D7 e                .gpio = DA850_USER_LED1,
- b- l. X( V3 e  ], d9 c# U! O' e8 M                .name = "user_led1",
  O, O* r( }" C$ x" S                .default_trigger = "default-on",- M6 j2 V; P. X& I" B* a" f! S
        },/ U/ |' h+ B/ T
        {9 \2 n7 v5 x* a7 `
                .active_low = 0,% q, r; a0 m: z5 Z9 l+ V; M8 g# m
                .gpio = DA850_USER_LED2,! {# G' Q' \) j% J& t* C7 u
                .name = "user_led2",- _! u) b9 Q" w6 H' [
                .default_trigger = "default-on",5 Z& d9 Y4 B$ S& W( L$ }7 G
        },  f: G! E; k3 [
        {
, i" X% i- e- b1 y, U                .active_low = 0,
+ V5 T) ^* J0 L7 G6 c                .gpio = DA850_USER_LED3,- M+ X9 y8 F6 H  ^6 B
                .name = "user_led3",
1 S* I! L1 ~: {# D% ?  \                .default_trigger = "default-on",1 `: a2 }+ f" ?; g4 X3 x
        },
+ i9 N* }8 ]) a' T* T. j};
- d4 K0 e4 A8 G: p9 T$ j
" C/ L& ]6 q8 r' }* |$ Gstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {' r2 g! ?; S" G, c+ w  g$ x8 ^
        .leds = da850_evm_tl_leds,
# j; q3 S, j4 z% K0 Y* }) T( `        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),! D6 m# ?! `( x! c+ X
};6 E8 W: S! u* s, r
  |* l9 i* [9 u* M. o9 o" W
static void led_dev_release(struct device *dev), O7 b7 ~( J4 ~' V
{/ }( {( s9 K: ^% E! F& Y
};$ ^9 O0 k. c# I8 |; b0 v
' X) M- X9 B5 r; P
static struct platform_device da850_evm_tl_leds_device = {
  n4 k0 `+ A7 z        .name                = "leds-gpio",5 r5 E8 @) N! t2 T: ^
        .id                = 1,
; B& s* M: o% V        .dev = {, S4 ]! o% Y: U$ W$ ~7 Y
                .platform_data = &da850_evm_tl_leds_pdata,
5 ?4 g+ ]7 h9 N$ b: B9 t& x* R: U                .release = led_dev_release,
6 L6 L  G$ h+ ^9 e# D$ _% L        }
0 c- A1 n3 a, z+ U7 w. \1 h};
5 }$ G  B1 p1 t$ @1 B& e  r3 u9 J8 y/ C* @8 M( Z. J% ]" K* E
static int __init led_platform_init(void)
% T% V* ^8 @- |{  `+ G! N6 ^5 \, ~8 E( j
        int ret;% `: M8 L5 h$ x  ?) B" k
#if 0
6 ~3 U5 s" Z$ A( n8 W        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);1 r: d* T0 ^; ]
        if (ret)5 F: |% Y3 R: @6 D
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
+ b' f# r' F# }                                "%d\n", ret);: b, W$ o/ y$ |$ i" L
#endif/ g# y( [% O. G5 h: V4 d% D
        ret = platform_device_register(&da850_evm_tl_leds_device);
# s% X* G! P' Q( R) O" H7 s! o- l        if (ret)
' X* A# f9 n5 W                pr_warning("Could not register som GPIO expander LEDS");
: `, B' e! R. Q, ?6 [% _        else
6 L9 j! }0 P4 O4 `                printk(KERN_INFO "LED register sucessful!\n");& H6 N: @6 f- b" J0 }. t

* h" _5 r- O( U1 g/ T        return ret;: w; _% N  L+ P1 p
}, Q" Z8 Y/ }; ^7 K; B% \
* p. L6 X6 J/ S( Q( n
static void __exit led_platform_exit(void)
9 f/ B  D! F# r- ]8 I7 u{* E5 N2 g7 }6 n7 b
        platform_device_unregister(&da850_evm_tl_leds_device);: `+ u7 c* G" x. L/ H" h  j4 x

) u3 r) [, G& n+ n$ Z        printk(KERN_INFO "LED unregister!\n");* f- y8 ]  |5 X7 `2 H, |
}, I% d$ w* T% N! v+ L2 o

) M, k0 |0 s& S" \" R# Hmodule_init(led_platform_init);
$ L" Q* d% f8 b9 ?2 w& vmodule_exit(led_platform_exit);
& ?6 g0 @$ P. |3 W1 k+ D! N- G. d- }! }
MODULE_DESCRIPTION("Led platform driver");
4 C! m2 J5 v# ~! r# t9 @9 l  i$ dMODULE_AUTHOR("Tronlong");
/ a$ l, ?# C1 B6 w) ZMODULE_LICENSE("GPL");7 e4 ], c/ G  {& n; {! B. D
- _. A$ G! X8 v8 j0 F' r; A9 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 13:09 , Processed in 0.041128 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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