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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
# y& s* c/ X& b) q+ b( X) r8 K- k#include <linux/init.h>
' O4 R9 J' p/ ?& v" _#include <linux/module.h>
3 W) R, @, D8 j0 }1 o#include <linux/kernel.h>
8 f* k7 ]+ ?5 a, j" N9 I" Z- f" f#include <linux/types.h># x% O  @# T8 J2 F. O- E, C; E
#include <linux/gpio.h>; G9 M$ g3 X; u* i
#include <linux/leds.h>* Z& |7 H% T5 H" s. @* Q
#include <linux/platform_device.h>. w+ m6 E4 S2 J6 x4 ?
  Z* G4 v) O% W8 ~# P  D
#include <asm/mach-types.h>' f4 F+ Z" S! C% t" S3 O" e3 P  ^5 s
#include <asm/mach/arch.h>) N9 P, z4 j+ r+ T" ^
#include <mach/da8xx.h>: Z# k3 n$ ~% o- [
#include <mach/mux.h>
# \9 R$ \% T* ~
1 Q& S8 p7 y4 y#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
; L8 L4 T5 r6 O: y#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
: ]- K3 u+ z3 Q! U0 ]6 r2 D#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)7 l* I, ^% f2 D" x' A* x
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
7 p( _8 R% Y; p  Y& ^0 b  a9 K
3 F0 S5 W" j$ b0 U4 p/ I/* assign the tl som board LED-GPIOs*/
, @9 N( P7 X; x8 F4 [  g" g$ b0 G) g/ ystatic const short da850_evm_tl_user_led_pins[] = {3 w8 |0 V8 V, N" M6 w
        /* These pins are definition at <mach/mux.h> file */+ }! V7 O, u" u8 m4 x
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
0 ^4 }5 n  A3 Q: q+ E% m        -1! Q2 {: Y" b- [- }& v# Q$ Y" [* w& i
};
# Q' }8 D) @5 @% Z$ n. m8 G& Z) A/ M- X! |: @+ [
static struct gpio_led da850_evm_tl_leds[] = {
1 a: }1 G' O3 L% q        {; ?& n! _  O" o
                .active_low = 0,/ R; }# u  i, x0 [8 r" }4 z2 [
                .gpio = DA850_USER_LED0,
: w+ ]* n5 l2 h8 Q' l& K                .name = "user_led0",  d) U( a# v# J% ~
                .default_trigger = "default-on",
# D9 z4 r0 \# z5 T$ Q& ^  n        },
( ]# g) A5 r% A: j3 O        {: I4 {$ j/ ~5 ?, I0 T; r9 V
                .active_low = 0,- [7 y2 U+ n5 h  y
                .gpio = DA850_USER_LED1,
0 ]' \- c' s/ W0 c3 T( U& E( ?! B                .name = "user_led1",/ [2 b, c: m# i% Y2 n( d! o
                .default_trigger = "default-on",. x- O5 q# {& S7 Z) m7 F
        },
; N8 P! S+ O! I        {
$ W6 m+ [# d- N5 L$ g# h                .active_low = 0,
. B" v+ m4 a  }& h: B1 A                .gpio = DA850_USER_LED2,
( k" E  M! k& L: s+ e                .name = "user_led2",/ |, b  s/ f8 G: D0 m
                .default_trigger = "default-on",
. z+ _, i3 Y% c, W/ t        },
# }. {2 C7 o( N0 j, ^        {' a1 i# ?! H% A1 C5 U* b& G; v
                .active_low = 0,3 [, Z+ o" U0 `+ [
                .gpio = DA850_USER_LED3,) i, l: S' b1 k/ t, f3 p8 L2 C' {- M
                .name = "user_led3",
4 s; q2 t% x7 q/ t                .default_trigger = "default-on",
4 \1 H0 p. Y* g5 U$ B" Z- C        },
2 y. e* b7 w( X};5 d9 f5 V+ f0 F. ^

5 l6 o* x& k: A% H# ?static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
& J, A* @2 t; R6 O; L( |        .leds = da850_evm_tl_leds,
# x3 A! f! U" n& t9 H5 a1 r/ B  b        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),9 f$ l& y7 ~: ~3 h9 j
};
" @0 @2 Y2 w7 I+ X& i$ `( t* g! _) t7 a( H
static void led_dev_release(struct device *dev)
: K/ G! Z( X) D0 A- r  Z{
5 b5 w* r& C/ ^9 c+ ~0 I& Z; \};
' I  b6 I' `; B! R9 b  y
; r7 a* e$ {6 a0 t1 o' T3 h+ nstatic struct platform_device da850_evm_tl_leds_device = {
7 J7 e3 \0 T+ r        .name                = "leds-gpio",6 i$ ~1 q" K$ t
        .id                = 1,/ s: z0 R- L5 O. f* ^
        .dev = {3 n; n' X$ p% r% c
                .platform_data = &da850_evm_tl_leds_pdata,' X# m/ Y# B0 W- X: l" S  l6 a
                .release = led_dev_release,1 T. m# d* M' t1 l+ ^
        }
% M4 L; Q; G# c};+ s7 y  j; {/ b) r8 ]3 G4 p2 J! A

9 U) p: U  A  A6 A1 \' s# Ostatic int __init led_platform_init(void)
' C3 d: W% l* C, s, Z{4 Z$ g+ f' V& W. d3 ]5 v
        int ret;
2 E+ x- U2 f; |#if 05 |( V* \) \9 l3 R. D* n& O
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
& ?3 w! J1 }/ e6 O        if (ret)
3 @+ y5 I2 B% V/ x" t                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"0 c( h1 M2 [4 k% I/ D( q; r4 v
                                "%d\n", ret);
: @, ~$ Y6 E) f#endif- y* a6 U- F  e- m# ?$ ~
        ret = platform_device_register(&da850_evm_tl_leds_device);. ^% R9 @6 w' T2 r6 a- @* T8 v& F* ]
        if (ret)
- h* d" F9 W2 Y                pr_warning("Could not register som GPIO expander LEDS");5 r. {/ N+ x1 G# ~+ Q; K4 I
        else0 E/ Y6 j2 u1 B3 c4 M& r7 _3 e
                printk(KERN_INFO "LED register sucessful!\n");
" U' R- m+ e( L3 K5 r+ k8 j2 e) L& Z3 u6 W- L# q
        return ret;* i% {$ P. i0 e+ N& t! m7 J
}
9 z3 ^' ~; U/ }
! P, v1 b3 z+ S" l. Pstatic void __exit led_platform_exit(void)
9 ?/ x1 ^9 O$ L# `{
% w# I) B  h* `4 b& n        platform_device_unregister(&da850_evm_tl_leds_device);
7 [9 R8 j6 N/ J8 v3 b& z, J/ _+ X4 b, I! ^- x, ~. _& G2 x8 B
        printk(KERN_INFO "LED unregister!\n");
" N* ?# F7 k9 R4 o6 z$ M}8 x7 M" b" F4 I' w1 m# I  k
4 x& P! R$ z# ~; \* m
module_init(led_platform_init);4 _* `2 H/ y- U* \; g
module_exit(led_platform_exit);7 I8 T; P  J% _! D% n
$ V& H$ \3 O2 T: T& T! m0 M; [6 l
MODULE_DESCRIPTION("Led platform driver");
  H2 u  N% e0 h4 W* E! S% aMODULE_AUTHOR("Tronlong");9 V/ B; ~5 V  i9 H/ @
MODULE_LICENSE("GPL");7 L( s# v7 M3 E

4 |+ n+ s/ t, e1 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 00:34 , Processed in 0.039780 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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