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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
5 I& p  E. ?! o- _/ U& [' U#include <linux/init.h>7 D. b" q& C" N! R- t0 V
#include <linux/module.h>2 E4 u( W) `) p- z' ]
#include <linux/kernel.h>( A2 m+ h! d5 G7 ?6 t- |  E
#include <linux/types.h>6 H5 {9 @' v& M7 T0 J5 i. d' O$ T
#include <linux/gpio.h>
7 r9 ?  v& @3 E4 |% i3 i2 m) d#include <linux/leds.h>6 q* K8 ?7 N( d0 I3 G5 g! Z% {" k
#include <linux/platform_device.h>9 Z# G2 d# s/ h
) ?+ ^1 T( `, l+ R/ J
#include <asm/mach-types.h>1 V6 I9 U* ?! H/ a8 Q( L  D% u4 q9 x
#include <asm/mach/arch.h>: j' L, M" P" L4 d( K
#include <mach/da8xx.h>
( a: V1 r: I. I) W* n  k3 ?8 P#include <mach/mux.h>
& ]7 V$ {, u$ D$ ~0 w
7 {7 P# A; ]9 G, o& p2 i3 }#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)5 y/ `4 @0 T8 J/ R& g/ Z, Y! \
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
6 H. i2 Q2 g1 I% l#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)5 g& q! f' e3 u- C( V$ z" J
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)2 T& {* J; ^# k# a
; g& p2 M/ p' W. x: ^2 l$ I( z, O
/* assign the tl som board LED-GPIOs*/
# F. ^1 I6 G$ e" b* Z, @5 r7 Xstatic const short da850_evm_tl_user_led_pins[] = {, ?) }, X3 k0 N4 d" c7 ]) a; ]0 y
        /* These pins are definition at <mach/mux.h> file */
. I# o+ c* c: ]        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,  L' Q& O" K, X9 U+ I
        -1
3 C. O/ @8 d8 q0 o; R};: i7 c9 O5 Z9 l6 m& f4 O7 _- e
1 w5 o0 F1 h; J3 v+ ~; w
static struct gpio_led da850_evm_tl_leds[] = {
; X1 `5 w: W, ?  z8 A; d1 n  O+ i) c        {
& ^/ c( l! s- p. P! H# p) s1 `                .active_low = 0,
1 E1 H# U. n# I                .gpio = DA850_USER_LED0,
& B" y7 f4 v; w, i+ y5 U9 W                .name = "user_led0",% x  v3 K. K0 l7 |; k
                .default_trigger = "default-on",
' y* S: h; P( ]8 H5 t- H% _  F        },
. A6 R* [$ \: i2 u        {
/ r. s4 G& o7 ]5 Q2 t9 {. ^! t; Q$ C                .active_low = 0,
2 g6 O0 U' ^/ K, P) }0 H                .gpio = DA850_USER_LED1,# S5 j3 I3 v4 i% f1 u. r
                .name = "user_led1",: w" N, i) n8 C6 o- ]2 Y
                .default_trigger = "default-on",
, J. |9 s3 m* w        },
7 }: J3 h6 C9 A8 O        {
0 E6 J4 j$ X6 v# e  z+ @5 e( p                .active_low = 0,
  M( R: d( }% S; n( O                .gpio = DA850_USER_LED2,: D  X( s' H/ k4 _* }2 j
                .name = "user_led2",! @2 \; F$ d7 o+ |; N! \# F
                .default_trigger = "default-on",
4 G5 p3 e0 T0 C5 j& w2 F        },- `) ^9 z: P- I9 _
        {
6 b5 [* S2 O, l; F                .active_low = 0,
5 x" o+ z, ?+ h! Q5 g                .gpio = DA850_USER_LED3,. k) Z- R8 |& n0 q3 P
                .name = "user_led3",2 W7 w6 V& o0 y1 b
                .default_trigger = "default-on",2 q2 \: {2 J5 I+ o5 A
        },# d% N7 q6 i9 g( T* ]7 j2 V, Z! L
};$ B6 a( Q- G8 `: A0 z6 Z
' O5 m0 j, ?9 |1 H9 e
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
2 z% l2 N6 j5 f0 ^, P        .leds = da850_evm_tl_leds,. p& w6 R4 l% T' z' k; Q( p
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
/ R( A, ^7 V1 Z# K: i};1 P2 ~* r" q( z5 p! |

5 n% H% G4 F/ Rstatic void led_dev_release(struct device *dev)
" {0 ?/ A3 B" c, V& x{
# e6 W4 P2 [+ l% o$ c$ l};
6 u; _& R: O4 h% N, B* \& Y4 G) g! ~% S: S6 z2 [
static struct platform_device da850_evm_tl_leds_device = {" Q. b6 I( s! c9 ^
        .name                = "leds-gpio",
3 C# @9 W4 T1 b: ~        .id                = 1,2 D7 [5 s9 h% L1 c6 h, h9 j
        .dev = {2 T* `* _& v7 a1 w3 F8 X9 V$ Q
                .platform_data = &da850_evm_tl_leds_pdata,; S5 Y7 s: {" H' Z; x& P3 F
                .release = led_dev_release,
# U: q+ A: Z6 z9 a$ V        }
  o4 v9 c+ g5 Z  m};, y' V1 Z) l* n; q+ u  C) I4 m

6 r4 g( ^: w5 z# v( Mstatic int __init led_platform_init(void)
" i2 N0 C0 [  A{
* ^% ]9 u" A9 Q- E& y6 Q: ^  ^4 \        int ret;
1 I! \# x5 a. b- n3 D#if 0  ?6 j3 g; v6 F9 B/ J% I  _
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
) i6 Q+ x3 j, t        if (ret)- Q& \3 Q- R, `; S9 L- z- U
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
1 Z' e9 p" B+ r; c                                "%d\n", ret);; u7 K7 k2 g( e3 K1 p; ~  T( S6 ?
#endif, n2 m. _0 i2 H$ m/ q0 X& C
        ret = platform_device_register(&da850_evm_tl_leds_device);
1 a1 z9 f( e" l  w. h) |        if (ret)
/ F; R$ u+ i4 y. H& @: N                pr_warning("Could not register som GPIO expander LEDS");
6 g6 V& L0 _% T2 g8 e        else
! L& f! J4 P2 w* ]7 c: m  j( V                printk(KERN_INFO "LED register sucessful!\n");7 u. Y& U2 t- y, W3 q

' w1 K4 ~- m5 t        return ret;
/ [" h7 u' s/ C4 X- F}$ g' ]0 c! U/ y/ ~0 {0 M

+ e9 @$ X( O/ n# I  vstatic void __exit led_platform_exit(void)
3 L) h5 x* H0 a# Q{
  M) u, k. A5 z) {6 g5 m( w/ j8 B        platform_device_unregister(&da850_evm_tl_leds_device);
' b. |6 f: L  q5 b, Z: a, s8 r1 r* [( R, s1 k
        printk(KERN_INFO "LED unregister!\n");! a2 t& y6 }+ {* [4 {
}: _5 \: i  b! O( B) r

( p3 A) w2 W& A9 R2 ]# O! S4 Amodule_init(led_platform_init);
: L+ A8 f# L3 g# \/ g1 w- o- Zmodule_exit(led_platform_exit);' ]. c3 ^; w! Z  A, v9 z
- i( v- S8 u5 T  g$ i+ C- s3 n; K2 K
MODULE_DESCRIPTION("Led platform driver");
) O0 k6 l; O9 lMODULE_AUTHOR("Tronlong");
9 Q  |0 j8 l2 ]3 gMODULE_LICENSE("GPL");
- k: n) t7 W  H9 T1 H8 `; R5 R3 u$ e% |" V. s+ G+ k5 p. m/ {" P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 12:05 , Processed in 0.040215 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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