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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
8 z8 t  K* c3 S: A- `* X#include <linux/init.h>- d5 a6 C1 H# P9 P, d- U1 T
#include <linux/module.h>8 y# ]9 k8 W! w  ^& C
#include <linux/kernel.h>$ _& a) ~: j1 i0 h! R/ {* h
#include <linux/types.h>9 X( u. {. j" A* T5 m6 ]8 u9 I
#include <linux/gpio.h>
6 Z2 F2 p. p1 K- m; m5 l#include <linux/leds.h>4 n& S# H( Y8 o9 g
#include <linux/platform_device.h>/ a4 y3 o8 S! W. [  [
4 x7 D& r) c3 P/ E7 [: ^( m7 y
#include <asm/mach-types.h>
8 D9 B' P/ g% w#include <asm/mach/arch.h>
4 P/ C2 F; j8 f! e5 j2 h( @4 y; v#include <mach/da8xx.h>( D7 |# Q# s. L% ~* p' Z
#include <mach/mux.h>
+ e. k) c* W" @! G, W% B- K- x  b4 h& j$ n7 `
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)) B$ J; ^: K6 f0 p
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
8 N: }6 v5 Y& I9 h: y4 F% }, w#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
  Q8 d3 l# {* W3 F  g! i8 }3 J#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)% A& l. L+ N' w: O

0 ^/ a( F( r1 o. `/* assign the tl som board LED-GPIOs*// J. D4 o2 K5 f8 n, Z* t
static const short da850_evm_tl_user_led_pins[] = {
; S" C! V1 p9 y2 }3 ~: n4 G0 q        /* These pins are definition at <mach/mux.h> file */7 T* @- ]( u0 t3 m
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,3 A; b/ F6 q0 p8 S0 t: Q/ b) P9 ~
        -1
7 `: g8 F3 v# W6 u# m( V& K};
; f& G: M7 c- z* i6 R! b
9 Q! O" ^! H; Pstatic struct gpio_led da850_evm_tl_leds[] = {
/ R' X/ B4 n$ ?        {( W; W4 ~4 Y1 ^2 A
                .active_low = 0,
# L0 _1 T- K4 W+ W2 n/ K                .gpio = DA850_USER_LED0,: @5 y1 p7 D! S/ N& s. R
                .name = "user_led0",
) F* s' M/ Z) M# y/ F3 z& E                .default_trigger = "default-on",2 u. p, ]* a# J! i2 ]
        },
% [+ a" O/ _4 g. t( f) O/ [        {
& b9 m8 D  q! J8 K0 V) I                .active_low = 0,
; g: o1 E/ \* x                .gpio = DA850_USER_LED1,! \" f) L: m: ?$ Q# h) k2 g
                .name = "user_led1",
& J; m: x+ u- j' _% L0 Z% |                .default_trigger = "default-on",
" t8 j0 c' A4 Z6 y7 w  S0 R7 `4 T        },
$ x% H; ?8 ?- A; p, Z( i5 w: e        {
( S8 |/ l4 z) N2 ~                .active_low = 0,$ _1 u2 ~. h7 |" m: V! X
                .gpio = DA850_USER_LED2,
4 c& N. z0 f& `5 h; j# ]                .name = "user_led2",4 ]$ m- ^" L8 u6 f1 D
                .default_trigger = "default-on",7 H3 E$ p  G1 B9 G2 s
        },
  c0 C5 D3 c: r/ N& T2 S$ |! J; I        {; X% V# H% N# q: F
                .active_low = 0,
! A; j" }- @4 ^. q1 u! N( a4 x5 m                .gpio = DA850_USER_LED3,  Q: }+ I7 O: o. ]; Z/ S5 k
                .name = "user_led3",
: j( O% b9 a  b/ S) p9 d$ ?                .default_trigger = "default-on",1 y9 j7 y2 q$ g4 A' [- w4 p
        },7 ~: P( ^+ M. @. e1 e1 Q3 }
};! O* P7 J3 k( m8 O) `) p
0 Y; l$ J4 j  ~  n' j9 y6 i
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {. Z/ Z3 T" V1 K6 f% ~  E2 D8 Y
        .leds = da850_evm_tl_leds,
. c9 a9 c6 k# P        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),4 c4 z" b% _8 J) w! Q  w
};
4 R( R8 g( f7 x1 ?) U* @5 F
% w/ l; i  k' ^$ x; [0 Rstatic void led_dev_release(struct device *dev)
+ v  T, b/ I! j6 P* Q{
7 R4 x" }/ v; s};
4 C0 Z' H- h$ C. ?. W$ w4 G7 n. B' m* D. k9 n, z" C$ u
static struct platform_device da850_evm_tl_leds_device = {( w% K# d* n$ ]
        .name                = "leds-gpio",
0 k6 v/ R$ K' V; J  `4 i9 R9 m! x        .id                = 1,
' K  b: W) _2 i6 N2 ^6 w* ]        .dev = {5 u# {8 {9 {" ?. _+ D& c+ d
                .platform_data = &da850_evm_tl_leds_pdata,
4 ?" x# ^6 Q$ o& |  C3 x                .release = led_dev_release,- a, S0 |' d: G( a
        }
! n/ l. D2 M+ I};3 k1 k' v' [# r1 j8 c) B% u  C* i

' e# d0 n& R* N- v. Estatic int __init led_platform_init(void)
3 ?; ^0 j3 Z5 e! }7 }5 k3 W{
: ^7 h% R" M# r5 ?& @5 S8 f        int ret;$ l6 S" I' H8 l* q$ b
#if 0
5 W& C# l6 I. t5 I9 k& _( C        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
% Y0 S' T/ j; `* g, Z8 W0 `& @        if (ret)* L2 W" R( t5 n3 x7 G- l# o" S' ^1 c/ t
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
0 r( _; F0 u# N% p$ O, D3 c                                "%d\n", ret);
. n8 b/ B7 }! J; @! W#endif
* f1 w$ j3 d6 h& d        ret = platform_device_register(&da850_evm_tl_leds_device);
$ \) f2 r6 s7 m, {3 [' b        if (ret)
' A3 J" J% J( o2 t& F" C- a                pr_warning("Could not register som GPIO expander LEDS");
* W" t0 d" `0 z( k        else
3 W( L8 w/ t% G6 w1 E4 i; K9 s                printk(KERN_INFO "LED register sucessful!\n");
" N" a/ A* d4 P6 P6 j6 ], t
3 l5 ?6 w; i. L; t$ x        return ret;7 ^. G' U% n( h
}
+ e; w3 d( ~4 N. Q! b
$ I2 P- k$ t+ q  n( x8 istatic void __exit led_platform_exit(void)9 x: y/ \) C& r# N1 ^
{
- M# `5 Y! h* i' E. b6 Y) R        platform_device_unregister(&da850_evm_tl_leds_device);
8 d! R( s, i" O. K8 }6 N* B
* P" T7 n. `; b+ h. |" |        printk(KERN_INFO "LED unregister!\n");6 `9 V' j7 U, a
}  V1 |$ t0 ~# C5 u9 m2 v

) T4 J: _8 J1 }module_init(led_platform_init);2 H. a0 T- U7 O: f- r( M' D
module_exit(led_platform_exit);* h' ^0 }2 ~, W; d

/ J6 c1 H5 v+ G1 |& ~MODULE_DESCRIPTION("Led platform driver");
$ S% l. X! [; A! |% pMODULE_AUTHOR("Tronlong");
- J# t/ S" E6 [1 f9 h" aMODULE_LICENSE("GPL");
6 t! F1 `- @# m% n- [5 W& q/ Z
% J' N: C/ K$ x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 20:13 , Processed in 0.040916 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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