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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
; K8 p- @! Z6 h1 ~#include <linux/init.h>
$ X' W- q+ @9 E8 y#include <linux/module.h>1 [) D' ?6 q$ P" G
#include <linux/kernel.h>
  b$ A( S- Z6 k* k#include <linux/types.h>8 C$ `$ v$ v) M
#include <linux/gpio.h>
/ z% n# {6 b$ {7 E4 W6 c#include <linux/leds.h>& o  {* R6 p  y
#include <linux/platform_device.h>
$ |& f, ]  l$ T; y. k# `; R! p/ S' P9 P
#include <asm/mach-types.h>
+ Q* E3 U0 O8 L, U* f4 p: g#include <asm/mach/arch.h>$ V0 K* s& G! }" Q4 U
#include <mach/da8xx.h>) I% Z. _4 k8 y7 f% U& x+ }( D
#include <mach/mux.h>
, h$ G. ?$ U; Y0 ^: F5 V+ t3 Y  L* U+ ~8 {. r" K
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)) B7 m1 \+ o- l$ m
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)0 E+ }! @( N; N6 |5 _- Q; _
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
3 t+ X+ R, U/ B& E" _8 Y#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
# z9 B$ G4 g2 ]9 v% N6 J+ V. A8 Z8 C) H
: l3 T% E5 }/ ~7 I- g+ R( N/* assign the tl som board LED-GPIOs*/5 p) Y( D; H: G6 {1 ?) n; u7 }
static const short da850_evm_tl_user_led_pins[] = {8 Q2 B# ?6 l) j2 Z
        /* These pins are definition at <mach/mux.h> file */- u" F1 ~: ?8 R  }% O! V1 p
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,0 _, v. O  `3 P( u0 z
        -1$ A: v% R; l% o& u+ b. N( J8 f% }
};  h. z+ |1 i( e( t. e4 K

8 h4 S9 r4 k' R$ M; W! p  z/ {static struct gpio_led da850_evm_tl_leds[] = {# M1 b; S  G0 y  @" M0 |$ h
        {. h8 n/ g" n1 T1 [& ]' ^
                .active_low = 0,
' j2 x, S* b* K1 }                .gpio = DA850_USER_LED0,' u0 Q9 A7 e6 d6 D9 T
                .name = "user_led0",
- v7 Z: ?+ Y4 n1 n2 T                .default_trigger = "default-on",
1 J, p# q# B$ C        },9 t$ H  O8 L2 ^6 A/ e& {9 Z: R
        {2 M3 d. |& `3 \; t" g' G* K& G: e) s
                .active_low = 0,, Q$ U5 R8 G* ?3 p6 P7 m
                .gpio = DA850_USER_LED1,0 R/ ]. j% Y! Y5 q* r8 }( }
                .name = "user_led1",% q6 m) M) i' v0 z2 b* m. S; Y
                .default_trigger = "default-on",
# [' ^* ^2 v2 S+ J        },8 V/ s) H/ E: C8 s
        {
" |, w" \# d4 Z  s0 y9 |0 ~                .active_low = 0,! t/ O: ?# o6 I* q! ~
                .gpio = DA850_USER_LED2,
9 \' k7 ?% Q, j* D/ n                .name = "user_led2",
# t: ?1 \0 A- q" j) f9 E                .default_trigger = "default-on",  i3 a; t( G# P6 [( [& g
        },2 k- m$ A& E/ x, \( T& m4 ~/ F
        {7 B3 ~4 C8 Y$ l3 d
                .active_low = 0,
, Z% G/ w* V# c( s. i                .gpio = DA850_USER_LED3,+ p1 g9 F" V/ s/ F& ^
                .name = "user_led3",
7 T. T  r; p: J. O                .default_trigger = "default-on",% w7 I+ D  m9 }1 k) i: z
        },
' J) `& N) T- G7 R1 `# S% r};
& z: Y2 R" V1 w! }0 _1 V8 r8 V" ]9 r# a
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
6 P" U" Q) O- u* V) s        .leds = da850_evm_tl_leds,9 m* K- T: Q# g0 W5 l; i
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),$ t+ ]) b4 F4 B  A, j# Z
};
* D! [; A% Z; L& o- z9 ~. A7 y1 O/ h
static void led_dev_release(struct device *dev)3 r# l; _' \% D7 E# n* H0 A% R! ~3 {
{
- D- c. @5 G# Q: f4 o4 s' ^};
8 ^- E+ d- U# A% ]0 B# H3 w/ D; X. O. r" W
static struct platform_device da850_evm_tl_leds_device = {+ I, ?2 V4 \2 g& D- }* a, n% e
        .name                = "leds-gpio",1 ?" |& {/ X, b
        .id                = 1,$ B; j# z; H; F/ L) _
        .dev = {
; k3 e2 a/ A7 I4 W* z% t& p                .platform_data = &da850_evm_tl_leds_pdata,
5 o: B( g& V+ r/ h                .release = led_dev_release,. b4 s* }# ?+ p
        }
! _6 L" ^- W9 W; L};9 m9 I$ ]7 Z/ n% u: B) I3 y  d7 p
6 s) z. J, f3 G0 C
static int __init led_platform_init(void); w  Z2 e. z* p% r. N
{
+ s, {" U- x7 E+ A        int ret;
# W3 Q. c! Z* [* o: i& d#if 0
9 q$ g, }: E2 n1 i- Q/ r% W) m        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);( ]5 F/ e# B/ q2 d  R% I) u
        if (ret)
* |3 H) [6 d3 l0 B& Q+ m                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
* G1 F9 q. P$ A; c' L7 e) n  k                                "%d\n", ret);
9 z+ D  `6 H' n4 A. v9 ?2 M#endif
( K# |8 }- i7 r; ^4 q. N        ret = platform_device_register(&da850_evm_tl_leds_device);; O  h+ |& f: ]2 q* c
        if (ret)6 _/ z" w9 S7 x% R
                pr_warning("Could not register som GPIO expander LEDS");
/ n9 A& n$ T  a4 B/ M: X        else
4 X4 _9 U7 C- E                printk(KERN_INFO "LED register sucessful!\n");- P$ t0 G, q6 |
. A; X3 ~2 w! A
        return ret;
( U# L2 T$ k8 [6 p  x! m}
2 _- V0 h: l7 g6 X+ Y
, n: C$ w0 r5 b$ Z- X/ kstatic void __exit led_platform_exit(void)+ X8 R; ?: d! k/ q7 _6 J
{
: U/ O$ _7 z9 `, n9 m        platform_device_unregister(&da850_evm_tl_leds_device);
( z" @3 G7 n" K
& r% H: e( Y0 a% k" H* H        printk(KERN_INFO "LED unregister!\n");6 T2 ?( U# @- O- k! S
}
0 v8 s5 [' V3 p5 p3 X5 m6 W6 |
7 b1 _: ]/ W* h" Y0 Jmodule_init(led_platform_init);
! V5 }7 h/ q8 S# Xmodule_exit(led_platform_exit);
2 _6 J- i" h5 g
$ Y# e0 @6 D9 B* ], X3 F- IMODULE_DESCRIPTION("Led platform driver");
; z6 |& Y/ A9 e1 v, f' N) p9 n" FMODULE_AUTHOR("Tronlong");
; ]% o: T0 j7 u  u; s- HMODULE_LICENSE("GPL");
8 m3 }( \& S5 T% E* G4 r6 D" _7 D7 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 07:45 , Processed in 0.038120 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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