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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
7 D0 ~2 P) X6 q4 ~. S8 Y. n#include <linux/init.h>  I4 ~( y+ h+ y, Q
#include <linux/module.h>
! x4 _( k& k& k3 D* F$ l6 b/ e5 t#include <linux/kernel.h>
; m2 o0 }0 D, }8 r, B4 X#include <linux/types.h>
: W+ L  w' R+ y4 J& x2 G#include <linux/gpio.h>
. x3 K( p! X  t4 d#include <linux/leds.h>
6 B. N5 m7 d8 f% `. C( y% J% e#include <linux/platform_device.h>, }0 B/ [/ C/ ^3 r1 c2 c* n

  d) }0 T& L0 f  G+ i#include <asm/mach-types.h>
5 ]6 [8 v" s2 Y% ^  l/ `- [) M4 s#include <asm/mach/arch.h>' }, K9 k5 F- j# \( a4 f5 g
#include <mach/da8xx.h>5 E, c. k) \; c: j8 m5 _  q% L2 r" s
#include <mach/mux.h>. @# h; B) ^( ~, _# y0 o3 C5 ~

( `! X9 S  y& W5 L& s#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
/ j6 \8 u/ W9 ^& K# l4 W2 Y( X" E#define DA850_USER_LED1        GPIO_TO_PIN(0, 5); [1 {* Y1 M2 H2 A1 t( H' r6 _3 @
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)1 f. m" E: _# ~* w
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
' F  c% [. j' p) t/ ]* C# H9 R5 |1 U0 z' T4 a
/* assign the tl som board LED-GPIOs*/* m0 R: Q6 |3 f: i. U3 t
static const short da850_evm_tl_user_led_pins[] = {
' r( b/ _3 x: m" `  }! d+ j        /* These pins are definition at <mach/mux.h> file */: o* O1 W6 S0 C; h4 _
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,' e' r7 m% H7 R  C- V
        -1
; I# I8 U( V" ]! Y. S4 j4 i; W};9 ?( j4 z% e( I% `4 y7 R

) ]: \  w# {' Q& u3 ?+ Ustatic struct gpio_led da850_evm_tl_leds[] = {* A1 I+ ^# [; @, }2 f
        {( y: h- Y. I0 i% i
                .active_low = 0,
$ j4 X4 Y% |( N: N6 ^0 j                .gpio = DA850_USER_LED0,
( G" y3 ?2 u0 W6 [+ }9 G                .name = "user_led0",
$ L5 ]8 s9 ?5 J+ w0 x                .default_trigger = "default-on",
# w- M4 q$ ?% D' N+ a        },
9 ]! f' o7 \+ b: V, w( s% f+ u        {: g+ s9 b/ S, M" H) T! d1 Y
                .active_low = 0," e2 [; \7 M4 f
                .gpio = DA850_USER_LED1,
+ I4 q8 o' n; N; q                .name = "user_led1",  \/ ~) T* l" w9 D" U, g& n
                .default_trigger = "default-on",
+ w. ~5 {: f- t7 }" H( P        },) e3 M" T4 [4 @! ~0 D
        {( o0 r8 ^, s: X1 R8 G  s( T
                .active_low = 0,2 y& z4 W) {0 K5 \- q$ H
                .gpio = DA850_USER_LED2,
7 U. I3 M( c+ i' ?. u/ ]" o/ m                .name = "user_led2",) k; l8 s+ k  Y! r
                .default_trigger = "default-on",+ S: T0 J; _5 _; U6 U) `" a2 e& z
        },
3 {# ~" j% u% t7 \3 c        {  `/ |3 _( l) S% b
                .active_low = 0,; J9 f% c; F1 w) V& O1 z" Z
                .gpio = DA850_USER_LED3,7 I9 j$ K: f* p  Z8 _. @, b' J
                .name = "user_led3",& g* ^2 F3 e5 i  S* g! I; Y
                .default_trigger = "default-on",+ Z3 u, W7 `7 b# Z7 H! T8 v/ L
        },
+ c4 h: N" v8 A# s1 @};( w9 I3 a. T8 Z) L

) c1 Q! V4 A: W/ c, D9 ]static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {2 N* N0 D0 f+ ^( U# _
        .leds = da850_evm_tl_leds,
; }  k! }9 ~/ j1 s" z        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
& r& e5 \! h3 A  L8 G1 Y: I};
* J. S9 [6 b! `" B8 d$ |- T
! Q) b6 ?" t  U$ ^' g9 W( D1 z5 jstatic void led_dev_release(struct device *dev)
; e& f4 B8 A. G1 o{2 l& k: s4 S8 G
};5 E" ?: A9 x" Q) {
2 t! T2 M7 b4 w% b3 w" L
static struct platform_device da850_evm_tl_leds_device = {
; v8 G5 K9 y; r; T3 U3 M        .name                = "leds-gpio",
3 {' D) }/ x' d5 S3 w' U4 H        .id                = 1,
3 ?2 M2 G4 `- I. p: h        .dev = {
" p6 m7 z) |' r* m                .platform_data = &da850_evm_tl_leds_pdata,: W3 P' m. t/ h4 x
                .release = led_dev_release,
; s& Z" K2 ?5 c- s        }
' ~8 N- e( O5 R" M$ O};, U, A: A# D2 o# ~; d' ?
1 K  [. r& e$ S$ Z. ^
static int __init led_platform_init(void)% ~( |4 k' {1 }$ X
{
0 W4 H$ y' h/ A! Z" k        int ret;" B) g" F1 i! Q. e& ~
#if 0; M6 [  r; r4 g- y. Z6 c
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);" d+ ]1 Z) X' J& f: J! R
        if (ret)7 a! q- r& T6 k; C
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
8 `* b7 g& [) Z0 E; _3 P                                "%d\n", ret);
; v" y) _7 I( ~+ p: L. u5 _#endif
& W1 X4 {( s- E# b8 {6 ^6 t' Y        ret = platform_device_register(&da850_evm_tl_leds_device);5 b$ ?1 u, E  R0 g$ c
        if (ret)
; Z8 C# e7 K) ]" ?7 ~! e                pr_warning("Could not register som GPIO expander LEDS");
" `1 c1 `8 |% A) a7 N7 y        else: l4 Y2 c4 d; a- F8 D
                printk(KERN_INFO "LED register sucessful!\n");" K7 Q9 A( p: k4 C- K
# U/ T' l# H1 w% ?5 ]3 \% |1 g& x
        return ret;5 n* H6 h; K( O+ j
}8 l; ^) I& P' q; Z: r- u* |7 x
$ J- u0 t( u: \& u- `4 O% S
static void __exit led_platform_exit(void). H; ?8 b; ~& \4 j
{
$ K6 f8 @# T9 m7 P2 e        platform_device_unregister(&da850_evm_tl_leds_device);
* X; b0 ~" t3 _/ \8 X* S6 g  z
8 K7 L, M: S9 j' X: ^        printk(KERN_INFO "LED unregister!\n");
* B9 C( X$ l2 Y8 P}
! T5 m3 R- j& p
; `+ m/ E: C& U# kmodule_init(led_platform_init);7 g& i- K+ W% ]6 [- _
module_exit(led_platform_exit);
  ^* `4 j, w. ^1 I& ^$ b. i3 x: ?3 ^
MODULE_DESCRIPTION("Led platform driver");1 p9 ]& I9 {+ ]# j, P
MODULE_AUTHOR("Tronlong");7 y$ q% y" \3 K+ P& l
MODULE_LICENSE("GPL");
+ k( J, Q0 j- H* ?2 G* y" E
2 E% \4 i& L, g* [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 08:58 , Processed in 0.054733 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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