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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
1 Z6 E) z' T) [! [4 z7 S$ q+ a#include <linux/init.h>8 e+ T4 g: _, R4 n" N0 `6 N, H
#include <linux/module.h>/ x. ?7 Q/ m9 F" [8 c7 y
#include <linux/kernel.h>  B, v! o" }5 I7 k, s; f3 l1 {
#include <linux/types.h>" u: r- ^7 m8 Z$ \* x
#include <linux/gpio.h>
  u+ A; D4 K6 O2 @#include <linux/leds.h>
' T) \; r$ |9 ]: U6 m#include <linux/platform_device.h>
2 k" L0 e& \( _
, `6 Y$ x4 `5 f% E' {% V#include <asm/mach-types.h>
" U" q, G* L: X) z( g  s3 g2 B#include <asm/mach/arch.h>; ^- m* {6 ~5 H
#include <mach/da8xx.h>
) j, I0 p+ l* P. Q& I7 ?/ Y#include <mach/mux.h>4 A( }) G* Y$ A8 o: Z; T& L
) R8 a3 G& s. ]
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0), P. p8 }6 }& e' d
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
2 @" J5 B" T" K! }+ T. ?# }#define DA850_USER_LED2        GPIO_TO_PIN(0, 1). ]& [9 {* [& Z' i, m% V
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2); D) Z" ^" a8 W) G! Y

7 q0 F* C2 Z0 `8 B. U/ f  k/ D% r! u: X9 f/* assign the tl som board LED-GPIOs*/: o: r. a6 r9 |' T0 Q
static const short da850_evm_tl_user_led_pins[] = {
( m1 F# @/ b* T: x3 k5 ]) Q        /* These pins are definition at <mach/mux.h> file */
% Y6 [; c, a8 w% N0 G+ i  f        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
7 C# O! e! v, m$ @& |        -1. X' J3 u7 ?4 E  q0 ~
};$ [/ x$ A9 G2 s# U9 {

7 ~( J, ~4 g$ e4 d1 ]% S" t5 K% D. ~* Hstatic struct gpio_led da850_evm_tl_leds[] = {% o) j8 p7 |; V. Q- c* U6 P
        {$ Z9 h- e, S# N0 F! C
                .active_low = 0,6 Q$ V! G4 Y8 t
                .gpio = DA850_USER_LED0,
1 A5 I% {: ~/ E; K& P0 P                .name = "user_led0",4 e! V/ r. I: `
                .default_trigger = "default-on",
1 N: I0 A) O3 h0 w7 l$ r        },$ m/ P* G: g) u, r& t+ q( W, }
        {
2 z3 v0 @4 v+ y, c* s                .active_low = 0,
, I$ Y6 l9 ]/ X( h                .gpio = DA850_USER_LED1,
% _2 a: h' Y$ M* `- w& C1 ^7 G                .name = "user_led1",! A5 a) e# y7 p4 l7 J- s
                .default_trigger = "default-on",
2 f+ O1 C, ?5 h1 |2 v& r        },6 _0 D& P8 E6 D  O1 Z: x: s4 i* ~# R
        {  e- z4 j$ S2 H8 T# l7 Y! E$ s
                .active_low = 0,. b5 q# p* V* S9 Z5 ^' ]7 Q
                .gpio = DA850_USER_LED2,2 L3 M/ r& U6 ?9 R. P
                .name = "user_led2",
' b9 Z. q! [% Z                .default_trigger = "default-on",* T1 w) Q. R9 H& m) ^; q
        },' Z: \- {7 l9 i
        {6 F& ^& h# Q4 F5 c' y
                .active_low = 0,
+ Z  p6 F1 N! y, i                .gpio = DA850_USER_LED3,
% C0 G6 }. y, J8 j- k                .name = "user_led3",
; ]7 f' y8 Z" V/ h3 w                .default_trigger = "default-on",
0 G* |4 r  A. B        },3 Q* D8 z  i9 Q. Y) h6 Q
};! t4 n% [1 U' r: c. E7 B

6 s; j- c( z! {; H2 @* mstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {( s$ P" p$ a  G$ v, Z' |# ^
        .leds = da850_evm_tl_leds,
( l' Z, K8 B( [0 K8 r6 s        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
8 I2 w4 Z$ t" N};
+ N9 [: Z' [/ W% B6 o, ]
. V& s: y$ q, _- c. O3 d! zstatic void led_dev_release(struct device *dev)
3 d) M+ N# Z2 v: g2 d+ E{
* ~8 U: [7 h& l: C/ z};4 ?- g5 X" S* I2 ?& d  Z/ u0 D
9 T' p3 P+ e2 R
static struct platform_device da850_evm_tl_leds_device = {  ~$ N0 V  `" ~; D
        .name                = "leds-gpio",! K; ~/ x( o8 T1 V: o& _
        .id                = 1,  j2 L) b# t/ Y' L* K3 e
        .dev = {
5 p# u; s! Z" l. h                .platform_data = &da850_evm_tl_leds_pdata,: W+ N: m. N$ T
                .release = led_dev_release,( u. N7 `8 D5 c) s( x3 m. e
        }* i, z: Z, ]; X) H. \$ W
};
7 ?) \/ u0 p8 S0 p: L, a  B8 e
1 v2 G" I% K" [$ e2 ~% O+ lstatic int __init led_platform_init(void)
7 _" O! I1 w# c+ N{
  y7 c8 I- D/ i3 q/ _" C        int ret;
0 T" w: t, Y4 h, n+ J#if 0' E, Y" F- R& G2 Y( E+ w( u
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);  @( q- h# X* f9 S5 |& v8 j5 f
        if (ret)
9 N5 s  g9 a0 ~$ B; y                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
. R* i# s8 d: O                                "%d\n", ret);
1 o( _' A) c, l0 D% k#endif4 g/ J0 G% e: G) o1 I3 }8 h
        ret = platform_device_register(&da850_evm_tl_leds_device);
; U* }8 O: d) X+ u; b        if (ret)- g/ m' t" u2 Y7 ^. r+ a( a' A/ R
                pr_warning("Could not register som GPIO expander LEDS");' t/ [+ u6 V' S. m7 G. x! j
        else% D' {: o4 F4 d* G# q0 r
                printk(KERN_INFO "LED register sucessful!\n");% A8 ~* k$ N1 _& {* s3 @7 O9 g* x0 F

  a* m' r  {9 p; _' B        return ret;1 \% X  S/ W$ U; Y; K+ d; q
}5 ~: @# l) a7 o! W' [/ ?2 |7 {

, F; J- P3 T: H- L* L; estatic void __exit led_platform_exit(void)
; G2 h: N" J( a{5 w" ]- _7 O& x8 m. E4 w& g
        platform_device_unregister(&da850_evm_tl_leds_device);  k( ^  C4 J9 j3 l: T5 ]
- `# h# D- A; Z5 d3 }% X4 G) L
        printk(KERN_INFO "LED unregister!\n");" K5 o% W9 C/ |3 |
}9 |9 h3 j5 K* W6 B

8 l% V; l, u4 ~% g/ r/ L' m9 z/ Umodule_init(led_platform_init);
0 [% B0 d: M4 imodule_exit(led_platform_exit);1 o* M4 u- w9 V4 o: f
9 R: A1 i% t. y0 h  @+ A2 M
MODULE_DESCRIPTION("Led platform driver");  e2 E1 a2 F9 F" N1 B
MODULE_AUTHOR("Tronlong");. n' ~$ ]  b1 f$ R. }; p
MODULE_LICENSE("GPL");
+ v6 _0 F+ z8 b% P
) m8 j2 i% u) z  }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 23:34 , Processed in 0.050878 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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