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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
9 ^% Z+ ~) M- Z% p. Q  W$ f( M4 i, l#include <linux/init.h>
) p' }+ ?8 s8 U. O% Q  p#include <linux/module.h>1 z8 I. }2 m- i6 i' \! I4 J
#include <linux/kernel.h>
# O4 o; k8 T8 D- {. `( t' Y, Q0 ~#include <linux/types.h>
# d& B& a/ h2 `. @/ _#include <linux/gpio.h>- H- p; ]( z2 Y  X
#include <linux/leds.h>
) e! q" c0 {! q" t$ D#include <linux/platform_device.h>6 j4 N9 P# g5 Q! ]1 @1 Q+ |6 r" V
$ x$ `' u9 R. x: z- f( f. h# G9 w& B5 }# q9 Y
#include <asm/mach-types.h>
/ T, I) r& C% E# T0 l; R2 t/ {* ^; ^#include <asm/mach/arch.h>
  ^% h' M. [, @% W4 @+ u#include <mach/da8xx.h>; D& A2 R) @' s) E
#include <mach/mux.h>
" F6 T/ ^  k. o# g" W: e& g/ N8 m4 l3 x+ |; Z' N& i
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
) l( K# L$ O3 _3 M' B: Q' x#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)& K* m& F  y* Y" Y' ?
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)1 m9 c% W8 \0 f3 ]
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2), W+ W2 {. }9 v
1 Z; K; ^: M0 q# Z$ D0 o
/* assign the tl som board LED-GPIOs*/# h  U/ E/ e5 R. K9 i
static const short da850_evm_tl_user_led_pins[] = {
7 ~, k4 Q5 Z5 V  m3 F6 A        /* These pins are definition at <mach/mux.h> file */
+ l7 V: A0 |1 _! B( E  `; w7 m        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,% M8 B! t# s3 s( w+ |5 ^
        -1
7 T6 o+ a, W8 N# a9 R};
; [. E' e0 v6 p  j8 m) X: D- L1 d2 R3 v
static struct gpio_led da850_evm_tl_leds[] = {1 E) z6 M# a; [! e+ F
        {' b1 g$ b8 a$ M
                .active_low = 0,
, j9 W' S1 @* _& o: m& i+ b- V! [8 s4 {                .gpio = DA850_USER_LED0,
3 I) J( J5 {$ @                .name = "user_led0",
4 {9 ^) c& V  ?6 A! j. O$ z                .default_trigger = "default-on",
" A- D0 U" \! ?* k! [4 i. V        },6 W! M8 k5 t4 s; y  X- ~, S
        {' d* P/ ^7 A2 J5 W. M
                .active_low = 0,( u7 ~& r; u2 I2 r7 w6 Q3 L' B4 A( ?. F
                .gpio = DA850_USER_LED1,
2 l' z3 @  j- ^                .name = "user_led1",3 a: B4 Z3 V* F8 N2 k1 W" j
                .default_trigger = "default-on",% [1 n2 F9 d, A. e+ a: Y
        },+ T, l1 g( H+ ?, \: H9 s- p
        {
  h) A" e# I) z                .active_low = 0,
# a% D6 A& C, Z5 I' l; J4 z                .gpio = DA850_USER_LED2,
6 W. [2 _7 ?; H# r) |/ c& \) \. ^& h                .name = "user_led2",+ d) B5 l& I6 j7 {2 h: g! D' \' d' ]& l
                .default_trigger = "default-on",6 s# Y3 [( \5 Y2 H+ p$ K
        },! v8 o- T0 D% \( R* o, M/ O, z
        {. ~6 ~# q$ r9 J8 u* ~- a+ f) C
                .active_low = 0,6 k& d6 I% T1 r) \7 `/ h
                .gpio = DA850_USER_LED3,7 ]2 T$ b" r  t. j* ~
                .name = "user_led3",
: X. x+ l3 W- v: E7 H+ }                .default_trigger = "default-on",8 Z% t5 K3 F- D7 k
        },( C6 ^+ w7 Y! c8 q/ o
};1 S" ]4 [- L0 V7 a7 K% A1 T* k

; I3 P+ A+ }6 l% `* @9 Ustatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
7 h, G- L; L1 ]        .leds = da850_evm_tl_leds,$ n' L- a+ C) K. }8 p
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),% v- J. N) C  e
};' N5 k6 c1 Y/ X2 _" r9 ?3 J

' U" F4 b5 N3 c5 s9 {& _static void led_dev_release(struct device *dev)
' t. h/ M2 `, E" l{
* U/ b; d$ g% P" D* w( H};
5 {1 o$ Q/ b- ~0 |$ E2 s/ T, r" F  Y& q* A$ w0 J
static struct platform_device da850_evm_tl_leds_device = {) @" O8 e* o$ a; i9 v
        .name                = "leds-gpio",
3 ~' |1 p2 h5 p# L8 c        .id                = 1,7 b4 `9 i3 g3 T* e
        .dev = {
) q! J3 s+ P2 {1 L& Z. R# x6 _                .platform_data = &da850_evm_tl_leds_pdata,
3 j3 {2 M) r8 T7 F                .release = led_dev_release,1 w8 E8 ?3 Y5 L) D$ z2 Q$ t
        }. T& Q1 ?) i/ Y* A; X- j( \
};7 \/ k% {. }1 ?5 e/ [: @

* T8 R, G) I; L$ @/ Wstatic int __init led_platform_init(void)
  j+ _; ?" Q( z& F  u{
  c4 e. Q' h0 n) w# g: h5 l, w6 L        int ret;
" N% p  B! ]' e1 ^2 `#if 0
  c& h3 m; P( J6 g: G. `        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);: N: b' [9 E/ [+ o! g% t
        if (ret)
) @  ~/ {/ T5 y6 b4 L3 N% r2 _: E                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
" e2 v& a+ Q2 p" e: t                                "%d\n", ret);5 C% N2 L7 h$ Z, x, [3 J: P
#endif/ w$ b8 l- O* L4 [% {
        ret = platform_device_register(&da850_evm_tl_leds_device);/ m' L+ d. e) z# j. F/ b( p
        if (ret)7 o5 G* U7 }9 c4 x- j0 o
                pr_warning("Could not register som GPIO expander LEDS");
1 w# k; D! O9 U        else
3 ]* b3 _2 K2 l  n2 O4 Q% Z                printk(KERN_INFO "LED register sucessful!\n");+ o; ^3 c3 _/ q$ a) b! _/ o( O

. c% {# e( z( `$ h4 H0 j        return ret;7 {! D9 l& ?2 V! m1 T- }% h' n
}
6 a' G1 k) {; s- J2 a
; [% g1 c( s& fstatic void __exit led_platform_exit(void)
- p. T$ G5 {9 f8 J3 c{
2 G% x# a, K! Q2 ^+ m: d: ~        platform_device_unregister(&da850_evm_tl_leds_device);
  Y+ E" w* ^7 l! J2 I+ a% ]: N+ }- i& D- B
        printk(KERN_INFO "LED unregister!\n");* S  |2 r, @0 O! {) w
}
; Z: X0 Z8 E+ b8 m# s! J  R/ k" c( I; b6 g5 n
module_init(led_platform_init);$ m- T3 _" A& t5 _
module_exit(led_platform_exit);
/ l  E/ ~; t4 r& B: w- S1 H2 C8 K. B
MODULE_DESCRIPTION("Led platform driver");
# B1 n2 E6 ~3 l+ u9 h5 |MODULE_AUTHOR("Tronlong");
2 P& I* n0 j! AMODULE_LICENSE("GPL");
0 Y8 ^+ |2 I* z6 i
- R: F6 R6 j$ k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 17:55 , Processed in 0.038793 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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