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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
: ]( [7 x0 Z2 g* O& p, _#include <linux/init.h>
# [9 ]9 d6 t' G9 E9 x% ^2 z#include <linux/module.h>$ Q2 G6 d8 v; t
#include <linux/kernel.h>
- }: Y4 ]' O4 ^/ e( }#include <linux/types.h>5 y' ?9 h9 [6 Z8 o* u) E6 E/ {
#include <linux/gpio.h>
' L  M/ z! v& T5 b1 g- R) r#include <linux/leds.h>
+ U  B4 Y1 M9 b- D8 B6 d& f#include <linux/platform_device.h>. R4 Y; d) Y, [9 K2 N( W
& l# `0 v1 m0 C5 M
#include <asm/mach-types.h># g; f) I# q# k9 U3 \3 K
#include <asm/mach/arch.h>2 d7 ~5 s2 X" |' {( ?! F# v
#include <mach/da8xx.h>
% [, c( m& H6 ~7 K; _0 f% o#include <mach/mux.h>
6 i& [" j- v1 T6 X0 M5 q
+ S4 Z9 v7 b0 I7 c: D. T5 J#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
8 q" e) {5 r4 f% e2 ~#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
. Q" s9 R- M& L5 I$ x4 V" K  f, [#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)0 q/ n9 S/ I3 x& b8 i
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
1 z, n7 \" h! P  F: ]- @4 t( ]
( z0 |0 r$ d9 h/* assign the tl som board LED-GPIOs*/
& R+ m9 E* H) f/ `1 Jstatic const short da850_evm_tl_user_led_pins[] = {6 w2 \) h' I7 Q( k1 \1 q0 R' D
        /* These pins are definition at <mach/mux.h> file */
5 g8 G5 X8 I7 ^2 B  `8 s        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
. g' e& p( W. j: U0 N4 }- h        -1
, _! I$ c. s. m! f3 V1 h6 w0 S};+ _$ i2 y- `" k0 G7 ]0 |/ F' O
" [. x3 E8 x' @0 b, Y
static struct gpio_led da850_evm_tl_leds[] = {
9 D' a- E5 |; N: K0 I! K( @        {& ~$ k$ t4 X. X( ?$ z7 H# Y
                .active_low = 0,4 d- r" e5 i' f! [0 _' ^' g! K
                .gpio = DA850_USER_LED0,4 R" f3 ^' Z8 E! w8 `
                .name = "user_led0",# c4 m7 s! @1 p
                .default_trigger = "default-on",+ A  F' A& ]$ C7 d7 ?( ~
        },
, d( ]9 Z# ^2 [8 ?# X- g        {
. F, v+ D( S7 ^2 v) R; {1 F1 h% j                .active_low = 0,. w0 }$ z! _0 v& _6 t7 A8 g$ e% T9 Y3 f
                .gpio = DA850_USER_LED1,: g4 j5 L3 f7 u; }
                .name = "user_led1",( [( Z  V4 Q& F+ l/ f' @+ k
                .default_trigger = "default-on",
: H! X/ X  Q# J$ K8 l8 g4 `7 A( k) q        },
2 R! a; `& ?$ ?9 r- z% @        {; m" d  V' p( J' v' c5 `  c' b
                .active_low = 0,
+ v( `; B* l8 o: K  f                .gpio = DA850_USER_LED2,* J6 M8 e. J* M1 k" a. Z
                .name = "user_led2",6 E( I6 q9 e! N7 o: V& P6 s" H
                .default_trigger = "default-on",; A1 @2 `2 Z2 I. _5 G" \( l
        },
; s# U* l* n' T- D        {& q/ h  R2 b. I! |' U2 A- N
                .active_low = 0,1 s( O  f8 K& ^0 k
                .gpio = DA850_USER_LED3,
6 ~7 x0 k1 f! m2 ]1 l$ ~                .name = "user_led3",8 r* E, E7 f9 b3 j" i5 a8 Z2 E
                .default_trigger = "default-on",
8 i; T- L4 [" _' a, a        },( D! W5 Z! ]- S
};, O5 L1 F# H; d) g& W0 C
2 g" k5 a( l. i4 u
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
% p2 p% n/ Z2 b6 k+ e8 |, t% U+ \2 L, T        .leds = da850_evm_tl_leds,
% [! y/ J" c7 a+ z" @- y$ c# N        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
; [. K% i; l" e9 R5 [};" Y" U( X) K) R$ [9 I! ^0 j

' \" w' [; O! X8 k1 estatic void led_dev_release(struct device *dev)
' J; E1 A7 V  T# r! Q' |' n- Y7 M{
+ h( Q! L; I8 }0 O  R/ P5 m};
9 H' I# b& L$ K7 W& t8 l+ K: \0 [. t. J1 C7 Z
static struct platform_device da850_evm_tl_leds_device = {
, B: a: a: a, w# r3 y( x        .name                = "leds-gpio",- l7 D0 |* A8 ~0 Z# n+ i
        .id                = 1,4 }# F0 `4 m; s+ a2 ~6 E( o. s4 h
        .dev = {
" Y. W% L7 f9 V& z& Y2 j                .platform_data = &da850_evm_tl_leds_pdata,
, W/ p/ z% l) n7 D, g4 ~% S, i                .release = led_dev_release,
! Q- F& [2 E* d6 {% y. E9 h        }
3 {$ g* @% r: K/ n5 h8 j) a: ]5 X};
2 Z- l5 w5 r; D# C6 e  d7 S" f* Q) N" a' {
static int __init led_platform_init(void)
/ ^6 g1 u: N! u{
2 N( _# w' v  k" G        int ret;
! }8 g0 b# O$ ^2 x4 N: B#if 0
$ V, Z! P) A4 B  o, w6 }        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);0 S* Y8 p' i, J' X: a0 S5 {' K
        if (ret): K) m5 F9 j; i9 c# c+ `
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
& P. r, _' O, I" ?. g" z3 Y                                "%d\n", ret);
9 J& t- u0 A2 Q# o* w: K#endif7 |# B8 F9 K! {$ q$ r  F
        ret = platform_device_register(&da850_evm_tl_leds_device);
5 g" C5 f$ s6 X! s        if (ret)& q9 i! D6 z, |9 {
                pr_warning("Could not register som GPIO expander LEDS");
9 v4 r% V- r4 a" l( i, x# U        else+ i4 V  a. _5 h) Q2 e$ b% U
                printk(KERN_INFO "LED register sucessful!\n");' _0 c% b3 r% x

' t; [# v  g0 R& d4 c        return ret;. E2 D2 [+ K2 v) F* y$ f
}
3 Y# _9 _3 d9 _; B
% n. V5 O  R" s$ p& \static void __exit led_platform_exit(void)
8 u+ x, a- R9 m0 B{% m0 a. G" t- l# M, k6 g6 k
        platform_device_unregister(&da850_evm_tl_leds_device);# x; \6 `0 ?% l! z/ ?
1 a0 S( y5 F" e
        printk(KERN_INFO "LED unregister!\n");
* d; b) P1 s2 g' q3 _! x# ~7 {5 j}
2 W. s1 P! z; D8 V7 Q
- O' c, [. _+ _module_init(led_platform_init);
. D( \2 S6 U' m( gmodule_exit(led_platform_exit);0 d% I0 e, A1 _+ `3 K9 X: ~

( l3 p% o, z4 i* C# FMODULE_DESCRIPTION("Led platform driver");# q0 G/ }$ c+ _6 \
MODULE_AUTHOR("Tronlong");
! x% i* v( w/ ]1 w3 d- HMODULE_LICENSE("GPL");
9 C7 X" Q* B7 [5 n
& P% t  L- h3 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 15:28 , Processed in 0.045291 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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