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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。+ ]" j( f: ?2 o0 J  r3 f% s
#include <linux/init.h># H& v4 `$ X/ \. H) B3 _4 \' i
#include <linux/module.h>- M2 K# `* _. n) ~
#include <linux/kernel.h>
* h/ y, b1 k1 K#include <linux/types.h>) R8 P( i9 d1 b; B8 W/ b
#include <linux/gpio.h>
* e7 R+ _5 x" S1 o+ n" u# O3 [! t#include <linux/leds.h>
/ r  m# [' ]3 ]. Z  H1 P2 ^- S#include <linux/platform_device.h>$ T" S" h: m( b# ^8 L
4 E" t+ s) h3 c: I
#include <asm/mach-types.h>5 v. S; G& Q# M' d+ ~. o
#include <asm/mach/arch.h>: }6 S. \' P. p3 ^$ I* l  V: t
#include <mach/da8xx.h>! g+ |1 _( f% a2 G
#include <mach/mux.h>1 C0 M% `, M  `! n" G

$ R8 M" @5 F- B2 D3 r* D7 ^#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
; K. C" ^3 ^' Y9 C3 d) z#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)' L: M* `" k9 i, Q8 \4 `
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)' t2 |: X0 V1 A9 Z9 L
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)1 ^1 i3 o; F% a2 n$ `- x
0 z, M$ q8 B, v/ b8 u% _
/* assign the tl som board LED-GPIOs*/
& w# U8 O: X2 v* D  p7 `4 |$ Z& y& astatic const short da850_evm_tl_user_led_pins[] = {1 z) i  f* D# ], a
        /* These pins are definition at <mach/mux.h> file */
# n7 E: G( l/ W; W        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,/ K0 \; E: y; ^  |" ]
        -11 a1 e* Z3 V/ }% {5 R9 L9 @  {0 R( f
};
+ K! ]8 F8 w* E# B
. g, T9 z& c7 r& Ostatic struct gpio_led da850_evm_tl_leds[] = {) I& I! S  y( Z- U6 d2 g& {+ |
        {1 M+ b4 |) }; N( u
                .active_low = 0,% w, T9 k. l5 b; t6 ^! K! ]. x0 l
                .gpio = DA850_USER_LED0,
* `; f2 H" I* |                .name = "user_led0",4 W" W4 g4 Q$ |; X) e
                .default_trigger = "default-on",5 H/ C1 V& L7 A+ [) X+ Y6 b
        },
, Z; i  N5 q' \0 N( d" M' s7 x        {
' ~) z; n/ S. a                .active_low = 0,
# l7 U7 R5 C! D( s" ?8 m1 k9 Q' C3 u                .gpio = DA850_USER_LED1,
7 [5 t+ g( B8 E, f0 g( H                .name = "user_led1",; Y0 C. E) u5 w1 F# F- X' s
                .default_trigger = "default-on",
# @% I6 j/ U* N" i% y1 H        },5 x6 F) K. C; t+ m) F) ]; f
        {9 V! x0 c& e4 U+ G+ T+ J  S
                .active_low = 0,
4 [4 ^* g9 G' k. ?$ V# ]/ j                .gpio = DA850_USER_LED2,
1 ~. K/ f. v: l+ D( X6 Q5 t, i! j                .name = "user_led2",
: [8 X2 |( V' `+ c                .default_trigger = "default-on",
. _3 c) w# d5 U$ s$ y5 W        },
6 O5 [$ d! `/ P3 Q& a        {, @5 X8 y4 b8 a0 `2 U
                .active_low = 0,# ?; }2 \* h# F
                .gpio = DA850_USER_LED3,1 w3 u0 ^/ }1 m. X# G+ I' O
                .name = "user_led3",3 c6 z3 k3 s* [# P4 D
                .default_trigger = "default-on",% B# B( X4 p& T! E1 c" |; Z
        },$ s, n' b. \. o8 j% H- _$ C; S2 j
};
* D9 P: k8 }1 y# ?' V  @, m- K0 x0 c7 p! I7 c8 o
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {7 H; |$ ?% j/ v: x
        .leds = da850_evm_tl_leds,
1 n* D8 }: W+ _9 ]        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),$ P/ Q" d+ F6 T9 O0 n  }% ]
};3 X- @6 j& [; o( m7 @% B
' w/ P4 @, z; H1 h3 y
static void led_dev_release(struct device *dev)# X. r2 Z& M/ b" o3 `/ p! x
{" ^4 d+ `% ?" P5 H5 o& o: W
};
2 \3 N1 N$ n; t7 L! n$ f' `! S- x! s$ m& Q4 T+ X& S$ Q& x
static struct platform_device da850_evm_tl_leds_device = {
7 L$ e' F7 D$ b. c( ^        .name                = "leds-gpio",
/ o' ?0 X; I5 D3 A. |        .id                = 1,# }& J$ Y7 r3 g3 i' @& \
        .dev = {
$ T9 R3 h' j4 @                .platform_data = &da850_evm_tl_leds_pdata,* E3 G. `7 z. a7 O
                .release = led_dev_release,
7 M( K+ ^( V" o. R9 y5 z        }+ A' g- _2 m3 y# X& {* I% V9 K
};. q5 S8 x) [# L$ [4 D1 S# b3 z

: K) m* q  N5 ]3 Tstatic int __init led_platform_init(void)
- t/ v* _! a( F* t1 Y- t{
  l' J4 q, f" M% o        int ret;/ G1 x! e2 i  J: N! d! a- U8 v$ ~
#if 0( e- s  L! o" l" ]
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
4 w7 a3 `) W- ~( k( p0 ]6 L        if (ret)
  O% @) H# {3 u' N3 e* Z                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
) N! h: h0 U" k0 w                                "%d\n", ret);
# {5 {: W/ U  a* ^3 g+ A9 q* F8 A#endif
; ^- S6 [: I" b& K$ I9 I        ret = platform_device_register(&da850_evm_tl_leds_device);' q( x% |- F1 v+ p$ X6 C. C3 U
        if (ret)
2 B. F& {" e3 L' k                pr_warning("Could not register som GPIO expander LEDS");
$ _2 z, i, x4 ?$ j        else( K8 }0 |3 z; v# B+ {
                printk(KERN_INFO "LED register sucessful!\n");$ J6 n+ ?2 C9 {/ ?
& y7 R; ]7 Z% s5 m$ f
        return ret;" s( n3 J# |. Z, p. w8 t
}
3 p. C3 W) `; S/ L* V  \
1 j& `0 l" ]. V* M  b+ Zstatic void __exit led_platform_exit(void)0 a, e; M$ @$ _+ m' n: E
{/ V/ M$ v9 a4 X  `: i
        platform_device_unregister(&da850_evm_tl_leds_device);
2 w" ^( l, R7 M5 d: e
4 o6 j( ^" A; s! A# `$ m        printk(KERN_INFO "LED unregister!\n");
% k- r+ C) c/ A1 t8 Q5 Y}
: N# D9 R1 s7 h, [6 _. u' n- J* J0 o, m0 \1 x# F8 w) I2 @
module_init(led_platform_init);
& ]2 U! @1 ^, d7 h" emodule_exit(led_platform_exit);
) z; _  J, V  W1 U0 _1 R, o
) R1 ?* T0 P( b0 o4 qMODULE_DESCRIPTION("Led platform driver");& e- n( {, U! i+ P6 S8 u
MODULE_AUTHOR("Tronlong");
3 n7 |8 k% S) f; O, B+ R% GMODULE_LICENSE("GPL");
: r) Z: G7 p9 A4 K: t5 v3 L6 U& O6 v5 J# T0 v! U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 22:04 , Processed in 0.039694 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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