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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。5 z$ n5 o$ [  x; t2 B/ J8 B$ X) d; q
#include <linux/init.h>: [5 e9 z. s3 U
#include <linux/module.h>' `% m3 T' o; `7 m
#include <linux/kernel.h>9 t$ p2 R' X$ O2 P" E; k* R6 ?; |
#include <linux/types.h>1 r" l  |2 S" D8 A$ E
#include <linux/gpio.h>
3 G3 O% E6 q7 N! f6 E/ G2 T#include <linux/leds.h>
6 N* e2 S& ]0 H6 Y& E4 _+ G#include <linux/platform_device.h>
+ @% c( P1 u. j, c4 p& ?
7 I, \' H- M/ Q) _1 j' j#include <asm/mach-types.h>
; [& x- v3 P! m/ ^#include <asm/mach/arch.h>+ y: {2 G" m# e) R, l+ J; u' H5 e
#include <mach/da8xx.h>* P9 [  K; a; q" K
#include <mach/mux.h>
! r: u; V6 i$ X2 `5 ~# |- g
" n% y! d2 U$ a/ g#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)) l8 H* I7 S( G4 M# w! k* q
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)8 u' U* t# z) N3 X. f+ F9 p" t
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
; q# |% R( e3 B0 ], i6 O# \9 e#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)8 q9 A! b# p* d1 E" f
2 X4 T' G6 ^3 a1 n
/* assign the tl som board LED-GPIOs*/
6 R( v) Q- e* [% f6 kstatic const short da850_evm_tl_user_led_pins[] = {
# L' y2 Z+ ?# j8 ~2 s" w        /* These pins are definition at <mach/mux.h> file */% |+ p# l1 J2 b
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,, C& o' Q& `" Z4 I
        -11 I8 Z9 ]) R7 W+ f3 S" B1 d
};* G, p4 A# c/ ]! D+ Q- x8 x

( m7 u1 P, |$ ~) `0 p( Rstatic struct gpio_led da850_evm_tl_leds[] = {1 {+ s, O5 x; P5 T) ~7 {& D
        {
$ J- O7 @6 I' \; w                .active_low = 0,
& @/ n+ F, Y% ]& |9 w/ M                .gpio = DA850_USER_LED0,! j3 }/ X. K- _
                .name = "user_led0",; A4 e7 u/ O+ w5 M/ Z  c  m
                .default_trigger = "default-on",7 F7 I8 y8 B' \. s7 T
        },- z5 }3 ^. Y/ o. g2 ^, Y, U5 r
        {
, a) u8 g: O. z" V2 z                .active_low = 0,
# e$ g5 {+ {5 z; F                .gpio = DA850_USER_LED1,3 e$ ?/ l5 K) G$ h5 j6 f
                .name = "user_led1",
2 c; n1 h- |5 f1 H( ]7 Y                .default_trigger = "default-on",
; G; y1 u5 O, _& B" ?/ k" P! S7 \        },
# ?% i$ m, B& b0 f4 T4 E2 G        {  ~( G$ B! _6 X8 r/ Z: K9 I
                .active_low = 0,3 ?: j5 K4 T6 F$ |; s
                .gpio = DA850_USER_LED2,
. i+ }  B9 n5 A2 [! q                .name = "user_led2",
& M4 a: W# i7 f  n6 V  c& U                .default_trigger = "default-on",) M+ ~1 ~: G2 \- @- Z+ O
        },
. T! M" r+ A9 q8 G% M, P1 Z$ g        {6 A, E- V3 ^- `
                .active_low = 0,
  s; ]! z* g1 {# y3 |                .gpio = DA850_USER_LED3,, K0 f8 z( T) f1 C0 D
                .name = "user_led3",4 C1 m) h( F1 Y
                .default_trigger = "default-on",- y% X1 e( {# a7 C; M! B2 |
        },  P1 U7 o7 h1 ?+ O  r+ y
};
+ K' Z; D" Z0 f( N4 m& p; s2 n& {, N/ M+ P( t& g
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
# b* v' L& k) Q8 U$ s$ T        .leds = da850_evm_tl_leds,* Q, o4 Z; m( K
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),) b0 ~# q: {0 u# k& n6 h
};0 {* ]1 N! n7 h+ h7 E! N6 {
% N5 u- o- S7 D9 i4 w$ O" x. x
static void led_dev_release(struct device *dev)3 [: B! G6 G2 Q) m
{
' e2 L5 ?- P3 Q$ e5 h, V};
* z# C9 r6 C/ ?5 X4 p3 e% {8 n0 g  U& D% V& l/ l! [/ H
static struct platform_device da850_evm_tl_leds_device = {/ ~6 C# Z9 z) f/ X; U
        .name                = "leds-gpio",6 e: q  T2 T" q$ X7 {0 {
        .id                = 1,6 U: B- Z7 r8 z2 S
        .dev = {
" |3 r& v9 b  C# O                .platform_data = &da850_evm_tl_leds_pdata,5 V8 b" b4 D- M' ]! a! _/ k
                .release = led_dev_release,
! C$ k3 l2 k3 O6 Z, c) }. G        }# N1 t; T+ |5 g! K) V2 \  p9 b$ w7 U
};, U; P% ?( Q3 E' K, d  ?

2 U, q- z& U2 @; \. wstatic int __init led_platform_init(void)" p( u. f9 g& P" X, w. H
{4 b* t/ o" z- i: ^7 e. X7 z
        int ret;' ?; E. X/ J+ Q
#if 0
6 h& m& o6 E' R        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);2 p1 p) Y0 M9 M2 ^
        if (ret)4 n4 k# P5 U3 r" C1 B
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
! a. {. [$ ^6 V  Z3 ?! l                                "%d\n", ret);
/ V0 s% |- N- l( }8 X, Y#endif, u! v$ c. T3 S# W
        ret = platform_device_register(&da850_evm_tl_leds_device);$ i! W3 \- j; p3 a
        if (ret)" h7 ]9 F' J0 m2 g# ?! H
                pr_warning("Could not register som GPIO expander LEDS");
7 D: B' i9 v0 o0 k3 J! {        else
% N6 r; I2 f! O  P                printk(KERN_INFO "LED register sucessful!\n");% s, u' M! s0 _9 T
* R" X* j2 u; X# g' R4 U. _
        return ret;$ A9 Q8 k. ~& G$ t1 s$ z
}
! j1 O' s7 w7 L) x
1 ^* y% t  f* J( qstatic void __exit led_platform_exit(void)
, P; N0 ~% W" I0 g; _( l/ @8 o+ a{3 D* ~, h1 P3 z" r2 f# o. `$ l
        platform_device_unregister(&da850_evm_tl_leds_device);
2 c3 M1 B) y, T8 T
- n% |$ A& G( @# ~! K2 K$ `        printk(KERN_INFO "LED unregister!\n");* c- n# g. b% l8 {$ _  v' L
}
( M  c+ P6 i- J  o/ {1 r2 x& u  ]' S; Z0 F" e, k
module_init(led_platform_init);$ e7 m& H7 _! T/ q2 o- K
module_exit(led_platform_exit);
- |# ?7 ]& @& l; z
' ^$ ]; u$ m% A) z3 n: w/ }2 ^MODULE_DESCRIPTION("Led platform driver");0 N+ j: n1 x% f' B
MODULE_AUTHOR("Tronlong");: [3 j+ ~* m3 T1 R+ S3 h! E
MODULE_LICENSE("GPL");0 o2 T* r2 h  V0 A+ v& ?$ w  W

! h0 W" t# b1 R" P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 19:54 , Processed in 0.041592 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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