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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
$ |. ?+ }9 [# p: ?% F: e! D& t+ X. O#include <linux/init.h>
2 W! J# `- @7 n/ G. C#include <linux/module.h>+ F( |8 E& O3 o- [
#include <linux/kernel.h>
4 r" ?$ X4 C- V: h* D9 X2 w; `#include <linux/types.h>
) m, M, J: r' @/ k: O! b" m& C#include <linux/gpio.h>
% u  F4 ]) K0 ]#include <linux/leds.h>: ]6 y( \$ U7 q, h/ d4 y
#include <linux/platform_device.h>
) ^4 i  o% q3 ]- N: I0 x. @' V, _) u# q7 ?9 @
#include <asm/mach-types.h>
5 ?) `! m* V( A% [8 `8 J, x7 d#include <asm/mach/arch.h>
! L: h1 u5 C$ q1 j) Z& \3 A. H#include <mach/da8xx.h>9 M; F" i" L7 C4 W. X. C4 w
#include <mach/mux.h>
* ~5 S6 H; j$ X# R. a
. [  X" A; F7 c+ F" \: K#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)* t2 p+ j3 r4 D
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
1 r$ b0 C& s/ A4 R+ g8 f7 V0 t#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)1 M9 u' Q. w$ G) }; J# w
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)/ W8 g  M& s* C4 o
0 p1 l4 S- w! m* ^& Y# ~
/* assign the tl som board LED-GPIOs*/8 d" K! w6 Z1 q, N4 b7 u
static const short da850_evm_tl_user_led_pins[] = {! t, d# K, y2 M2 W2 d) T1 W
        /* These pins are definition at <mach/mux.h> file */- X5 F& M. `# w, z
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,& A3 M/ B! k, F8 D  o3 ?
        -19 ]/ v7 n# o4 K. u
};6 \! @, U" K/ _9 ?3 Y4 V
4 u% s7 h' N5 j* o. ~$ S4 q
static struct gpio_led da850_evm_tl_leds[] = {; z" d& @: w+ D  W6 G9 R- H$ _) a7 y
        {
( Q) b7 V2 z1 y6 b                .active_low = 0,, F4 ~8 {$ g- U  R/ J
                .gpio = DA850_USER_LED0,
! r" i9 x$ \9 g3 n                .name = "user_led0",
4 D& ^- F  E/ R* g; p                .default_trigger = "default-on",
" ?! v  X2 C8 U        },
9 G% ^  R4 {& @: x# Y2 ~        {
  B5 `6 L/ X% o  i. F) l                .active_low = 0,
  Q* B/ U, u( \                .gpio = DA850_USER_LED1,% E0 W4 Z0 @0 ?! q5 h$ U9 f+ Z
                .name = "user_led1",/ ^. a7 I( n5 T7 D
                .default_trigger = "default-on",
; I& S" ]# v. L; t( ~5 M        },
* X1 Q% r) ]% e7 Y2 M3 D! a        {
2 Y  a3 w: m& Q: a+ ?. n                .active_low = 0,
9 Z4 x' D- x) C+ e8 y                .gpio = DA850_USER_LED2,6 a; v  r4 T7 q) k/ D2 |4 f
                .name = "user_led2",# W0 Q5 s5 B' N9 f" S0 ~
                .default_trigger = "default-on",
, y9 U! G4 Q% ?8 I        },
( w, _& f. b) h2 P+ d8 D9 J3 g        {4 B. ?2 P" m/ K1 a
                .active_low = 0,3 B) F. x# \! U) `% Y5 G2 E
                .gpio = DA850_USER_LED3,$ t0 z8 K. U8 T. i1 _2 p
                .name = "user_led3",1 ~- p8 C, o! O1 y) @% w
                .default_trigger = "default-on",
" @4 X& @  y& b        },
' u0 H: M4 b9 F4 T, {0 L; |$ Z};
$ a  _- l" A. I4 l9 u. ?% `; ^
% M# `4 ]# a: Q% @, g; Y5 F5 ^& estatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {  o. P3 v4 f# f
        .leds = da850_evm_tl_leds,. Q1 @& c4 ?# O" R1 e
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
& m& E6 t) i4 ?, G! }$ K};
' f8 C1 Y9 W; g1 A
5 |0 b" `4 ^% L+ ]' X8 r0 ostatic void led_dev_release(struct device *dev)
2 k5 ?& V( F: W* d( ?{+ j/ x+ G+ ]: C8 v+ L: o9 S
};4 o2 Z( g5 [" ^; E: V. n

6 h, I, q/ V, t6 G2 u+ ystatic struct platform_device da850_evm_tl_leds_device = {
% L7 a- Y3 ^1 C0 Z8 s        .name                = "leds-gpio",% D' \* N+ ?8 N$ ]( n7 Y9 L
        .id                = 1,
. J% m) a) M+ d1 Q; o- J        .dev = {( h. z9 h& A1 D9 j( s
                .platform_data = &da850_evm_tl_leds_pdata,
  g9 q5 }5 i, ?3 t2 ?# s                .release = led_dev_release,1 M# J* G# T( e# T. K" {! s
        }& y. ]" t! I, L) t, d2 @( o
};
  [( f, @$ L& Q1 U( Z" C
0 b$ ?' ~" R2 }; kstatic int __init led_platform_init(void)
  i3 s; H" G# A% N9 h  {! ~: x{
' O3 [7 D" e: w0 n( f/ r        int ret;9 `6 w% h7 u) s' n7 o
#if 0# R$ R4 v  L5 Y7 Z% k3 S" k
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);4 u/ m; O7 @! @. G9 m8 S: n
        if (ret)
! J7 i2 c  B1 E+ J                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
2 v4 V1 x. ~! |- y' r                                "%d\n", ret);
7 E6 [2 h7 g( `. M# J, n1 B. U- b#endif- G6 `: R: t, a6 s! J/ a
        ret = platform_device_register(&da850_evm_tl_leds_device);
( s: m5 R. \- P5 W        if (ret)
) [+ p; `& q: i0 Z) }) L+ V                pr_warning("Could not register som GPIO expander LEDS");
: H* U$ r: l4 z- c) S        else
. h; I' S- e4 A6 A                printk(KERN_INFO "LED register sucessful!\n");$ W- G. @+ F4 }9 ^4 W/ a8 s

# Z5 `! b! a' W" M& C& M        return ret;
+ r7 R7 d" h) Z}2 G$ ]' E. I& p/ s- M. {1 x+ _
2 F1 T# ?8 p, Q& u# r5 V
static void __exit led_platform_exit(void), b7 |# f1 v. S3 v# Z' O
{, S5 g0 G: X5 `) V  g
        platform_device_unregister(&da850_evm_tl_leds_device);, X# O; o/ z9 J, K& ^

8 H3 v# g( r7 m! c        printk(KERN_INFO "LED unregister!\n");( w" S6 a" Q: d7 o" ?" S) M: S
}& b7 [' x. V. k- H2 V7 N# @7 R$ |6 D
% H$ ~: v& ~7 w3 Z$ O+ }/ d3 q9 u- R
module_init(led_platform_init);8 X3 a& n" H2 D% Q  `
module_exit(led_platform_exit);  |# K! s% M- o7 J1 ^7 a
& S% _  Z! d" y% W
MODULE_DESCRIPTION("Led platform driver");
/ W* r& s4 w2 E; F9 |MODULE_AUTHOR("Tronlong");
1 k" f9 U% L4 E) y. x7 j- jMODULE_LICENSE("GPL");4 b5 ]3 f; ~$ ^

+ N9 d1 [9 a4 ?* ^5 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 03:29 , Processed in 0.038271 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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