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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
& e* ?  V1 `' [& V; p#include <linux/init.h>
* Y( `* D9 O0 B1 c: ~5 y; @#include <linux/module.h>
8 p5 G/ {2 H' L: z#include <linux/kernel.h>
. _; H& `4 X9 M3 [. ]9 \4 t#include <linux/types.h>
0 _6 H0 A: ]- E2 z5 g1 m3 g#include <linux/gpio.h>
/ e# ]! }; }0 z#include <linux/leds.h>
1 H+ ]$ F- Z% \6 s) p+ S0 s#include <linux/platform_device.h>9 v. {2 C" l. Z5 c# ~2 g  U8 ]1 `  c
/ |$ Z. F0 i6 Q/ z" L6 Z; F
#include <asm/mach-types.h>
0 v3 e' J1 l* U# O#include <asm/mach/arch.h>
1 F# U0 }8 ?8 j# l2 y! }#include <mach/da8xx.h>6 ?+ s( D$ u- x& r
#include <mach/mux.h>
7 ?8 G: D. R' Z  G
4 y3 N" O* `7 A#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
; k8 p4 l7 Z8 f8 k4 `#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
3 j- h* Y2 h# J( C0 A#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
5 v- h+ B/ `) P9 P#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
+ f/ _. \5 U" t  ^' x( ?* ]0 F: h: V* B/ h% e; H: |+ [
/* assign the tl som board LED-GPIOs*/
2 `( t# V  }+ jstatic const short da850_evm_tl_user_led_pins[] = {1 N& p& z* L2 H) }! i3 Y& K7 R# j
        /* These pins are definition at <mach/mux.h> file */& J( ]. X; [. ?" m: W) \  t" U
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,7 h/ L' l3 ?8 a/ b" D& n
        -1, F: r; h- S6 e" _
};
# g) G. o/ C' ^7 K" l
0 r/ e8 T" G1 H& mstatic struct gpio_led da850_evm_tl_leds[] = {
" \9 a; G( B9 U# P        {
; U+ y6 D. @. _) H                .active_low = 0,* f4 ]  m1 k; Q3 h" A* s% G
                .gpio = DA850_USER_LED0,
& L& N2 j+ ]. P! u" ?$ h' I2 z9 D                .name = "user_led0",
7 J' r# S- ~  @                .default_trigger = "default-on",
  @) T6 x, y% J  m" z        },  g" F+ x2 t+ K- Z
        {
1 z* r- H, }  ~4 e                .active_low = 0,& k" ?0 d$ J- P# X7 S2 E
                .gpio = DA850_USER_LED1,
6 Y3 n$ G) F# f. |. T; j( h' q8 x) S- r$ n, Z                .name = "user_led1",: P' T8 |2 n; D) H
                .default_trigger = "default-on",
- t8 X& P' e; T        },
3 r8 W3 V# L: S9 @0 X        {$ b4 p* F$ u: ^  u- d9 v" i3 w0 [
                .active_low = 0,4 z$ v" s- t8 @7 D- ?
                .gpio = DA850_USER_LED2,
3 s( J: C0 H1 M) K! {# D1 i                .name = "user_led2",9 c) B  K: S* Q+ w* J9 m  F
                .default_trigger = "default-on",( }) l& Q1 |, k# d6 {4 K3 y6 r
        },
& `- B. y0 @' D. p% @4 g        {
' b2 b1 ^3 n. @# T                .active_low = 0,: Y+ A- R. e5 w5 ^- h0 F
                .gpio = DA850_USER_LED3,: {' S* c8 g' C6 L6 C: r* c
                .name = "user_led3",2 }& \" y' M/ E& E5 o8 R
                .default_trigger = "default-on",
7 ^8 G0 J! ]4 U* I$ K        },
0 r( n9 n! s( b6 o6 Y8 B3 q9 h2 D};% X2 N1 b  r& v& X% H. `; Z

) ~& x  ^  D. Bstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {6 R3 ~2 q* a2 M( Q% ~$ a  e
        .leds = da850_evm_tl_leds,
0 x3 }: a8 v3 s9 d7 V6 L9 ^$ m        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),; l  z9 D6 z: B2 j' k2 I
};0 x- \  ?! I6 T$ Y
2 a8 v  H$ B: j3 K7 G. A
static void led_dev_release(struct device *dev)3 Z1 r, \  r( X: X+ O3 g
{8 R. L* Z# ~3 L0 @* r0 h# S
};
$ w) I; X% @: K8 S2 W# u8 \/ |. [* I
static struct platform_device da850_evm_tl_leds_device = {' f( O/ K  L6 b$ F
        .name                = "leds-gpio",
; X4 P$ l8 L2 P/ ?& v  N9 _5 e        .id                = 1,
( V4 \+ d/ c( t$ a$ Z7 f        .dev = {+ C/ `: F; c6 `4 U1 b* `0 I
                .platform_data = &da850_evm_tl_leds_pdata,1 w  [$ I9 @+ E# W# \* D
                .release = led_dev_release,
$ F1 F  t+ y. q% w$ w- Y" v% L        }( O$ U: A+ I2 I) J; N$ W
};/ b. K% o; M1 C/ A

3 y2 i. B0 N  {& E8 qstatic int __init led_platform_init(void)/ ]4 ~5 k; o5 y* Z% D
{
( _3 X. V9 G& b% k; k* s" j8 i, U        int ret;7 W  l* ]: A; b* U
#if 0
9 H8 \5 l. O# B" }9 D, e7 W% I" z- U        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
4 k# W2 [( Q! j2 w# P  I4 I        if (ret)
/ |7 V) y% H6 {% k, `                pr_warning("da850_evm_tl_leds_init : User LED mux failed :") I3 D' M- K# Z/ K- [
                                "%d\n", ret);
# R8 n+ p8 p) G# Q8 y9 ?$ a+ w#endif
9 E% _0 t% U( \        ret = platform_device_register(&da850_evm_tl_leds_device);
7 D7 Z% _9 n2 m        if (ret)- h! ^2 j% [9 n
                pr_warning("Could not register som GPIO expander LEDS");5 e7 S* f) s) x4 T: {# ~# n, ]
        else
% \1 |" `6 Q9 b* h                printk(KERN_INFO "LED register sucessful!\n");
" g( \, H/ f" T7 |/ x* b
+ C0 ?9 ?5 t. N$ z: Q        return ret;7 y: s4 {7 h2 m5 k
}, _! d% U7 j7 [# y+ b) A

. Q4 J+ ^* i' s& g2 _8 E4 L/ ?5 jstatic void __exit led_platform_exit(void)6 y0 d6 [; R+ P/ P
{
. N5 J' f! k& \! ?- A( r        platform_device_unregister(&da850_evm_tl_leds_device);
0 b7 u9 @) v, r, I" P9 o
) s) |4 @, @# y$ [        printk(KERN_INFO "LED unregister!\n");
; p/ [; y, r2 J) t4 [  Q}& t* x  x: _' O2 u  P
9 C% x) Q2 E- [* ?- ^8 ~" K
module_init(led_platform_init);
" F$ f& J3 Z+ Lmodule_exit(led_platform_exit);
1 d" E% l" ]1 M! i7 B6 @, m
6 y; b" K7 }6 X& h5 aMODULE_DESCRIPTION("Led platform driver");
! v- a' B; w% ?/ W: |MODULE_AUTHOR("Tronlong");1 E+ h1 r& q) D0 Z3 h3 X" t. o
MODULE_LICENSE("GPL");
$ @5 `5 r& |1 u3 z3 n6 W' v( @( y- k) u9 Y. `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-8 16:40 , Processed in 0.037233 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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