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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
: P% b. D% m4 V/ m7 X6 M#include <linux/init.h>8 }3 E3 v) i. r/ i. Z; c
#include <linux/module.h>
- J% ^. X0 H3 N. Q( w: W#include <linux/kernel.h>
( Z, {2 [3 f- i  E7 ]7 V  B, W. J5 X#include <linux/types.h>7 j: D# U' O1 n: E+ G1 o6 a
#include <linux/gpio.h>
5 g+ A1 M- E2 E, u6 }#include <linux/leds.h>
' C2 B8 d7 A- |/ x. j; c#include <linux/platform_device.h>
$ G/ X1 ?2 O' w' [/ U  ?; O  o: S9 c  G% B' _* N
#include <asm/mach-types.h>1 k% L( b9 B/ @6 i. }# ?
#include <asm/mach/arch.h>
" {+ R- r5 T9 x1 ]2 h#include <mach/da8xx.h>1 `. A1 c  H% h7 b4 A
#include <mach/mux.h>) ^. g5 L/ ?4 {* r3 ^' ?

4 u% l/ S) J8 q9 q: {#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
) n% G7 L) T0 ?" t8 x, u' W#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
1 _! e# b3 U$ V: w0 @#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
* i2 g$ Z( F* H#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
( p6 j% L* x7 K/ G# e3 `% R2 O
+ G& S+ v$ w4 Z6 W, s0 ?& P( W# E# Y/* assign the tl som board LED-GPIOs*/$ g0 R# z2 N, L  z
static const short da850_evm_tl_user_led_pins[] = {3 k( ~' W& o' F$ \: V* W) V
        /* These pins are definition at <mach/mux.h> file */
4 b  R4 Z. N) y: r$ X: Z. S7 J        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
2 m/ j2 I* m0 h( B: s! u8 J" Y        -1
) r. S) t1 S$ a" v};
, `# [' z" L" {5 N, b: Q+ |' k4 e7 L$ i1 p/ p# M( N; i
static struct gpio_led da850_evm_tl_leds[] = {
  C, }! a! k9 R( x# L        {
% p  l8 a' ?( i, {' @; L) k2 {( J$ L                .active_low = 0,  f' d! G) `7 n: a
                .gpio = DA850_USER_LED0,7 O7 ~# E1 G3 U. J3 ^; x& Y
                .name = "user_led0",8 L( d+ |! X* V, E0 f: g, K" d
                .default_trigger = "default-on",- R( `& U6 Z9 E5 d
        },( V$ d5 ~9 {, Q: O
        {
" S) q6 Q1 Q& d% s* i+ S                .active_low = 0,7 ^4 f* s# D' G7 E
                .gpio = DA850_USER_LED1,! j) U2 i% G# j# |9 L; U, O" H
                .name = "user_led1",
( h4 I5 a' y7 e2 l                .default_trigger = "default-on",
/ n. z  `/ P9 I& _7 l        },
& F- ?; |! A% U( R$ M        {
! w1 Q: M2 Z* ~1 o                .active_low = 0,
2 e$ {6 _7 ]! q+ {4 G' h$ B: h' M, c                .gpio = DA850_USER_LED2,3 c" ]" M, R) F/ O- f  U
                .name = "user_led2",
/ m& _2 ~. H* `, P                .default_trigger = "default-on",
, o5 ]5 b( j- U  r( t% |% {4 ]        },
4 q; V+ d+ X$ h& J$ Q% Q        {
, l, C# m5 B1 T9 t0 G; l                .active_low = 0,# }0 h' m8 o4 z% \; r  U7 N, }
                .gpio = DA850_USER_LED3,
. X& X- @  r1 \( y' a" p. }. g* ~                .name = "user_led3",
# a/ a& n4 Y; x! Z                .default_trigger = "default-on",1 j5 b" g& I2 D; y! G
        },
3 g9 U: f" [0 v% j};
0 @6 I& r5 n( G& Q: e# h/ {2 G* c
; z, R- l( {2 \  wstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {# [- `/ y8 P% c+ ^* y; k4 W# f
        .leds = da850_evm_tl_leds,
$ ~* Z7 {5 t( G: l% a        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
3 C3 E! I; e. ?5 s  i! b};8 a$ T: D- E: X+ F

* T! @7 ^5 l' }. |! A' Sstatic void led_dev_release(struct device *dev)% T% E2 L3 v1 J  [
{
! L+ L7 Z9 j* x/ S0 ?4 I8 F};
' [% \/ [2 K6 m1 s( Y, V0 |( C* L. M4 k% u5 P) D+ [
static struct platform_device da850_evm_tl_leds_device = {
; ]. G, K" c6 I; Y& f/ P5 m: r        .name                = "leds-gpio",
( |) i6 E6 h8 M1 b& Y8 r        .id                = 1,
0 ~$ B; b" C9 ?9 X9 M7 y        .dev = {
* D- r6 \& W4 e: V+ x. W                .platform_data = &da850_evm_tl_leds_pdata,
1 w; ?  l& `' S( }! N  |                .release = led_dev_release,* }* y/ J% Q& H6 w* J4 J
        }
, t, N2 T. h1 e8 F. r9 s};& s: f# c" S" f4 i" n
# ^5 ~, @5 e/ A/ V  E1 s! W' N3 S
static int __init led_platform_init(void): ?! J( e) ~3 ^' v9 r
{1 M: H" ^: V. w" s9 W4 M, t# a. o
        int ret;
1 K0 F$ e! @- d2 V#if 0
- }) z6 D9 u6 ]8 M7 g8 U- N        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
$ `$ _+ |7 T6 ^" x        if (ret)
; }& {4 h# j5 u& U# @- l! N& r                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"' t3 q# a) L: n3 e0 K
                                "%d\n", ret);  L0 R& J+ L! d' `, p# `: ?
#endif/ C6 q) s5 ^) |
        ret = platform_device_register(&da850_evm_tl_leds_device);
) e8 ^$ u& P/ o) y+ W, ?' r) T        if (ret)
1 [# e; A% A" K; \! m5 h5 T                pr_warning("Could not register som GPIO expander LEDS");& A( [/ \5 C/ @# q
        else3 x8 w" u, E' Y+ g! ~
                printk(KERN_INFO "LED register sucessful!\n");* q  w/ j% r2 }9 }! d: G3 V

8 j" k! f, F: U9 X9 D  N5 u        return ret;
1 u: D3 ?: [7 ~}  }8 q# `3 C3 y. n( ~$ H

& {  B- o. d! _7 C3 jstatic void __exit led_platform_exit(void)5 ], R' a' S. J# `. B; p
{
2 S* ^: c% _  I. s" F  d/ h        platform_device_unregister(&da850_evm_tl_leds_device);
/ l9 r( o" K% j7 O0 P1 m$ U6 j7 a: j% M5 h2 G, ^. L+ R
        printk(KERN_INFO "LED unregister!\n");
: u0 v4 {8 m9 ^% A}
- b4 w+ m% n# u+ s$ R; x  ^8 r
module_init(led_platform_init);% \: }% T' A* M
module_exit(led_platform_exit);' L) d. \! U5 A4 T" ~6 t8 H
$ H5 D% f7 c5 G* g% P
MODULE_DESCRIPTION("Led platform driver");
+ z9 p% m# m( v# OMODULE_AUTHOR("Tronlong");
, Q5 e& d, p  j- h4 ^MODULE_LICENSE("GPL");
% m) ^# ?) W! q8 Y
$ Z* l, ?% a4 N5 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-9 07:22 , Processed in 0.036547 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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