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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。9 F( ^8 M  D) [% [% y5 K4 g2 Z0 Q( m
#include <linux/init.h>6 s. c: `& S6 i" |; b5 e( F" W. Y( N6 q
#include <linux/module.h>  p2 `5 B5 w) n
#include <linux/kernel.h>" n9 @' R+ y- t  n5 @
#include <linux/types.h>9 l% {  S( o  }6 F5 E& g8 H
#include <linux/gpio.h>
/ Z$ b2 R5 `: I6 B! {  }#include <linux/leds.h># q7 B, b" V  z( s, G
#include <linux/platform_device.h>
, c" K; {" R3 I' o
2 {% r5 x# B6 K% w2 S2 d  I) ^: r, p#include <asm/mach-types.h>% h) Y% A3 m0 c3 l( C( l, D7 I- Z
#include <asm/mach/arch.h>  ~* {! O% M! \: r7 W) w
#include <mach/da8xx.h>+ @# T6 K0 H! {: U
#include <mach/mux.h>
& O/ F& u7 \& E
2 j3 I' o( J# ~  d7 u#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
0 O+ e) j, g9 [7 z! A5 p#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
8 g8 Z4 j( K6 }, F7 i  o#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)  e  I( J4 `0 }
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)* Y* C$ B4 _$ [! j
  l4 ^! ^1 w$ p/ z8 {
/* assign the tl som board LED-GPIOs*/( W7 O$ G' b& R" ?3 D2 p
static const short da850_evm_tl_user_led_pins[] = {
( O) \/ R! D- S        /* These pins are definition at <mach/mux.h> file */; m1 d. D% o8 d4 J( G5 z, C- h
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,3 l7 O9 g/ I9 g6 _& F) x' i
        -1  U8 }' O3 @6 a; l' n# |
};9 r' V$ }- }  }: F% G! j

1 ]) `" D4 u  w( e  b, T# cstatic struct gpio_led da850_evm_tl_leds[] = {
7 ~5 Z3 `) w2 `; O# P8 J) O0 K        {
5 k( t- x4 g3 b* {                .active_low = 0," S/ w# `. l# S& r
                .gpio = DA850_USER_LED0,; ?0 q" g, N6 L2 \+ R" @* ?
                .name = "user_led0",
. a  e5 ?; Y4 |9 X: |/ p  m1 @# a                .default_trigger = "default-on",& k7 {/ a2 B6 Z) b' g
        },. |% e& K8 j2 @, s( e
        {; K* f/ E( M+ a, ?
                .active_low = 0,4 Q) G8 |2 [. Z- N
                .gpio = DA850_USER_LED1,
1 d" k  }; C3 ?6 d: @6 k                .name = "user_led1",
. r0 T. V! V. t$ p1 o# C" U  y                .default_trigger = "default-on",
' z1 T" {0 k4 |3 _+ v7 W+ H* a+ O        },
3 R. M3 _8 |+ D& x' Z        {; I/ a; `  n- R' Z% t7 F
                .active_low = 0,
* F) i* u" ^) [0 t1 H                .gpio = DA850_USER_LED2,7 K3 n$ q( J5 @8 v  y$ p
                .name = "user_led2",
4 L, I! D4 \$ c5 }/ ]  }/ Y4 T% h                .default_trigger = "default-on",
6 X8 G3 J& `9 O3 n5 S' S        },2 s, N/ R) s3 }1 S
        {
* h& y9 V# j- e7 \% q                .active_low = 0,& F5 c8 v$ d/ e6 ?# `
                .gpio = DA850_USER_LED3,
$ a) x  k# |. ]* _                .name = "user_led3",* f- u& Q# g- n- j8 r: v
                .default_trigger = "default-on",2 W* o; H9 z" ~' c
        },
4 ?/ @  P  N  N2 C  p- Y};
6 {7 J* l  N& H
- M$ F$ e8 u  c4 _4 cstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {* e- d- e9 h" \- {0 o3 y
        .leds = da850_evm_tl_leds,
7 j; L$ h# T; W; `7 m        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),4 U1 m# |' x4 o/ ?4 }$ H3 i
};
, o- ]% A' }- t* \" F
% m5 c, e0 f" mstatic void led_dev_release(struct device *dev)
* a- s% ~" P" b; T" ]% q{) Z; V8 @8 [) z6 `5 r% ]+ t
};7 [2 f1 N5 u% I5 r- g
: V: x( O' P! g+ F2 @; `  k8 H
static struct platform_device da850_evm_tl_leds_device = {. g' G, [" n: E+ j8 {5 P  l! S% i
        .name                = "leds-gpio",; V* z4 L% w5 O3 V( ~% q! T# [! w! T
        .id                = 1,
, e* n) t$ h) ?# B3 X6 f% |        .dev = {
0 b, ~0 t2 e! `/ k( l                .platform_data = &da850_evm_tl_leds_pdata,
% ~& \8 h, |$ Z& i/ m                .release = led_dev_release,
5 m* H* |: {& O/ \- p  l& I. z. A& ?        }1 |; E0 z% \+ M; M7 n
};
: o" f: P  t) ?. U3 p/ H; e- O
/ m7 v/ N  X$ N: D8 `static int __init led_platform_init(void)2 d9 L. D: [* t6 I
{
! q- N' S6 I4 f& c4 V* g2 B6 Z        int ret;+ L' L* {1 o1 \+ x' K, r( d
#if 0& D: F4 Z1 O, B0 |
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
9 ]& s0 U' }( J" |        if (ret)1 }: x- ^. L% n+ p8 j
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"& B& w( @3 `/ Y' J. {" n
                                "%d\n", ret);) Q+ E" P! }- S; D- }
#endif/ G! R0 s. g' O! N; i
        ret = platform_device_register(&da850_evm_tl_leds_device);0 C, e; ]0 l/ `0 T) Y
        if (ret)( b+ h6 _- n3 ]# S1 N
                pr_warning("Could not register som GPIO expander LEDS");
' T- M5 ~. A* m! Z' G8 N* R        else
) f- W! }" t/ h                printk(KERN_INFO "LED register sucessful!\n");
% w7 s3 K: \* o; E: g- B3 l. I; ^2 x+ [
        return ret;3 @1 l2 Y% [$ ]7 Z0 s
}7 Z! e' m/ [! q$ ~  Q# C3 A
9 _8 @1 M( g7 V7 f
static void __exit led_platform_exit(void)
% M9 h$ V% D- ?1 f{. }8 g! \9 a7 x/ M
        platform_device_unregister(&da850_evm_tl_leds_device);
/ a5 A# M  l% J0 U7 Z9 L' Q. W* {7 b, F7 U! u
        printk(KERN_INFO "LED unregister!\n");5 X' i& k' a3 S6 d: `6 x
}
1 ^. k. p; N: F5 u2 j! t: D
& a/ B$ s# k7 Y) q1 e- d8 Ymodule_init(led_platform_init);( b' H+ f2 K& i
module_exit(led_platform_exit);3 q7 O/ G5 M6 O  G8 w: J2 q: x$ j$ }

2 o8 ~  y" v4 }; @( T3 U! P! pMODULE_DESCRIPTION("Led platform driver");9 O6 y' }6 [0 V8 G$ w
MODULE_AUTHOR("Tronlong");
# X  D. f) F1 s0 {MODULE_LICENSE("GPL");- a# u5 m* I" l4 U  A3 ~0 I- G
' f5 g8 ^  }* Y- r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 05:11 , Processed in 0.038527 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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