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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。" H  E$ m7 S; t' z2 h
#include <linux/init.h>
+ f" m& N) T$ |# E7 Z; z4 {' q#include <linux/module.h>2 Q5 D% ~; E; b- a) J% E
#include <linux/kernel.h>2 c! d5 l' Y& w
#include <linux/types.h>
4 X1 ?7 V. x- A1 j6 d#include <linux/gpio.h>$ g6 _& G7 i7 U3 ^' v0 o
#include <linux/leds.h>
1 o  K4 j6 S% f( r9 g- g#include <linux/platform_device.h>0 [7 n2 `8 c$ j6 [
4 c5 h; P" z5 K
#include <asm/mach-types.h>8 f% r. a* E% g( a. D0 p
#include <asm/mach/arch.h>% {: ~5 f0 Q/ n& ^9 b7 D8 ~
#include <mach/da8xx.h>8 C2 m- ~8 L, i3 |1 H
#include <mach/mux.h>3 S& h# o. S5 c6 y
4 B* j# V" }6 v- X5 U
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)( J7 I" S% ~, f3 _( a, e# u
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
8 ^4 V) Z4 J7 |#define DA850_USER_LED2        GPIO_TO_PIN(0, 1); |+ L9 i" Q% O+ Q  N. D6 n
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
4 O. b* q, i! N; T# S7 x& @7 I" a6 u- k" b% O3 s; h; {
/* assign the tl som board LED-GPIOs*/
  E7 h2 e* D5 a! p$ Xstatic const short da850_evm_tl_user_led_pins[] = {6 T$ Q# [8 H+ w- l2 u
        /* These pins are definition at <mach/mux.h> file */
' W; Y+ x5 }$ v6 i! i7 G4 O        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
! o% k% `% r6 ?        -1
4 n) \/ F/ e+ n+ s) S};0 d+ F- Z; W5 }

4 E, f0 e& O0 Y+ Z7 Nstatic struct gpio_led da850_evm_tl_leds[] = {" L9 M$ [( R8 g- ?0 J
        {' P( r  a% Y$ ]4 P
                .active_low = 0,. ]  _% t. e- T5 B; W, d' [
                .gpio = DA850_USER_LED0,9 r' B1 Y# W7 v- S+ |/ A
                .name = "user_led0",! M/ R- c% C% _% ^$ T6 e
                .default_trigger = "default-on",& b, @. Z6 \" o1 m
        },. X4 [+ I3 [$ n: M3 E
        {
1 L4 ?/ B$ _- K8 M                .active_low = 0,
  t3 w' C$ Q7 t4 {                .gpio = DA850_USER_LED1,. ?1 O7 t2 u) D
                .name = "user_led1",0 y  N! n' O5 ]. u9 {* N5 g0 R8 d4 v
                .default_trigger = "default-on",9 Q1 x4 \7 L1 w9 g: U8 ?1 x0 K6 j
        },
7 G+ i) S3 A3 z        {
! a0 i; {5 ^# i4 p9 q* E                .active_low = 0,
9 o6 h6 z% h+ t                .gpio = DA850_USER_LED2," B* A$ w7 |( ]0 `5 X/ F& Y
                .name = "user_led2",
+ A2 B( L: z0 J, \5 g                .default_trigger = "default-on",2 N) w5 y5 }4 I; H" e3 U. e6 ^
        },; {* S5 F2 y! N; E) `- J- Z
        {# ]2 U1 c. U7 v$ G
                .active_low = 0,
0 b) ~5 i& ~5 {# D6 F# d; z                .gpio = DA850_USER_LED3,* X; `, c$ p& q# n4 I; @1 j3 }
                .name = "user_led3",. s! `# z2 L: `; a5 i' C5 m% F
                .default_trigger = "default-on",1 @/ [3 d# g6 z3 n2 l" o
        },
2 G( z; @% F! p6 H' O6 E};
% o/ o( W, b1 ]/ I; ^/ v/ X4 ~+ b2 i' ]* F
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
. x6 z9 ~8 V6 h; H% D! O% B0 S& H4 b$ y        .leds = da850_evm_tl_leds,  ?( {+ L' j# z. [# y
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
6 j5 Y& p% s/ C) d' M/ D};
  i9 p; u" `+ _4 }& |- v$ T$ N
1 \4 Q, ~9 A3 V6 _: R; m# |static void led_dev_release(struct device *dev)
9 M4 X7 _5 _9 x% g4 M: D2 ]" T+ W{( h/ B1 Y) {& _; N
};* t: X8 u+ P# N! o$ z8 ^8 E
5 ]$ v# W- m8 [! {" J! [
static struct platform_device da850_evm_tl_leds_device = {
7 T9 a' B: @& |) c! G! `7 R2 O; x        .name                = "leds-gpio",7 a) d" C* S1 ]/ [5 N" I
        .id                = 1,8 k- n7 P8 C5 ~5 `! {
        .dev = {8 F6 H" f5 w( f0 \6 |0 f
                .platform_data = &da850_evm_tl_leds_pdata,
) C) V/ ]+ F& D, v3 x4 T                .release = led_dev_release,3 r+ M- Z  L( \3 e' s8 E3 K& N
        }
% Q( G4 l% g$ W/ a! e" r1 W};
/ f$ O; f  Q- `7 f( ?- g" U% G0 q
static int __init led_platform_init(void)7 g3 a1 t4 A7 T$ L( y! b4 j
{
0 v" ^  G" V, A4 i% D4 V0 p        int ret;
! |7 ]: k$ k$ j2 ?7 N  A- P#if 0
2 d7 Y/ v* Y9 A( G+ w        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
2 x( m1 |3 X$ Z, r5 a* g8 |% g        if (ret)9 u9 w: s. M+ C9 `; d9 i0 v
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
. z% q5 p$ j# Y# a6 r                                "%d\n", ret);
( \* _9 m! i; e: ?) i#endif2 a" |6 s7 O0 F2 T+ u. c
        ret = platform_device_register(&da850_evm_tl_leds_device);& V! Z, B: T  o- P
        if (ret), P! Y( a6 o) ?0 o- F  x7 i  g
                pr_warning("Could not register som GPIO expander LEDS");
& W- r  @2 I. q' Y& P: J1 @& r: P        else) ?7 ~3 A' m  {
                printk(KERN_INFO "LED register sucessful!\n");! h9 q) p4 W2 i1 F8 {
- f3 H% i* ^  Z4 ?
        return ret;% h7 [3 b3 c( E6 ?4 s0 c
}
" U3 E: A5 W6 L
3 V/ o2 Y! }* `: o$ b. d2 m: sstatic void __exit led_platform_exit(void)
8 {2 W; m  E' N1 I3 p- |{* M4 a0 p! m) ]- u4 O  h& J  \4 H% K
        platform_device_unregister(&da850_evm_tl_leds_device);
4 {7 u, m8 e, P/ [  ?; U" O. Q" h$ D, x6 K
        printk(KERN_INFO "LED unregister!\n");
/ z& W6 f! r1 b3 m}- E( C$ Y8 Y+ I

' u+ X0 M( h- X* bmodule_init(led_platform_init);& F) v8 _; o0 q" ^. |, Q7 Z
module_exit(led_platform_exit);, k7 P; K' Y; T* R& f5 Y2 t2 l
+ O5 W# e. }% _
MODULE_DESCRIPTION("Led platform driver");0 K* U9 c& A9 o8 [8 l
MODULE_AUTHOR("Tronlong");4 K; O& X' h1 c; f% w. W
MODULE_LICENSE("GPL");
4 @, g' N3 }2 n8 _1 V8 W" C1 l1 F: q( v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 01:50 , Processed in 0.047845 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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