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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。0 u: E4 P) D: X3 a: l
#include <linux/init.h>
5 ]$ s0 r4 f0 s! F' M#include <linux/module.h>
. u& r- }2 r+ B" Z$ W; w8 ~6 [#include <linux/kernel.h>
. J8 P8 i$ F. Z5 s2 U' c; D#include <linux/types.h>: p5 D% s* e9 ]
#include <linux/gpio.h>2 E+ Q. S8 f" z" |
#include <linux/leds.h>
  T) u! }: y2 C0 W' ^; _#include <linux/platform_device.h>* J; W& \5 B) j* J6 S" P' {

4 ^& x5 Q& N5 L' U4 K8 m& b9 a#include <asm/mach-types.h>1 ?4 C' u# R( E( G& P% n
#include <asm/mach/arch.h>5 N0 m1 i$ x' d0 e2 W7 g
#include <mach/da8xx.h>7 Z  C7 c9 J" q; w* k' J
#include <mach/mux.h>$ @2 s' W  h  A3 ]+ M& M1 U) _

$ G% K3 O- j, _#define DA850_USER_LED0        GPIO_TO_PIN(0, 0). E% u9 Z( X1 W, a
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5). ?1 C4 ], ~- [/ c2 z% [4 J% U/ t
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
; ~+ c9 J  {4 B#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)) {! q, q' Y: T! B& L. a" q
5 |4 F4 V. S! Z& I9 l
/* assign the tl som board LED-GPIOs*/
/ [+ P( O5 A7 j( f, e6 @! X- mstatic const short da850_evm_tl_user_led_pins[] = {( d: U. V1 E% n  _
        /* These pins are definition at <mach/mux.h> file */* K2 U5 l3 Z$ k4 g
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
. e' o9 f3 r" ]2 z( V' r6 }        -1
! d3 J  _5 W% `5 Y, D. e5 }};
+ u" _7 J5 U' ~3 Q( O$ w' p! x0 q  Q& S* ~  C" y, ?( L6 z# d
static struct gpio_led da850_evm_tl_leds[] = {2 n0 ~2 b7 D" g9 m
        {+ G8 K+ S* }9 ?5 F  j+ j0 z# n
                .active_low = 0,* @/ y- ?& w  j/ z$ C
                .gpio = DA850_USER_LED0,
8 s( z; q' `+ X2 D( v                .name = "user_led0",. Z; I7 w2 {6 Y6 y/ B
                .default_trigger = "default-on",5 V2 a; `  A& c6 e: S) u
        },6 Y' y5 |+ e3 z% D3 }( g! u
        {# u2 X" Y/ {4 }. G
                .active_low = 0,
" J. |) D  o4 {# W0 @- k5 R; ]. f                .gpio = DA850_USER_LED1,
7 p" a  `& k" @0 q                .name = "user_led1",5 ~8 w: ]4 U* u( T( S8 J- h
                .default_trigger = "default-on",# D- i9 g7 L5 @6 J
        },
. F9 g$ ~+ ^* O. i        {
2 h( t0 o0 ^4 w% ^. x& _+ M                .active_low = 0," t5 O1 u5 A) I2 R
                .gpio = DA850_USER_LED2,
$ H3 n( c' q/ O6 b2 I* X                .name = "user_led2",
% l, z8 ]+ L3 J0 e                .default_trigger = "default-on",0 X: W: Y3 n3 I& U& ~; ], h, q
        },/ l4 i" B* @; |: E! @2 w; l8 z
        {0 T' q; o" A+ |
                .active_low = 0,
" ]5 H8 i( ~3 f1 w6 ~8 p, K1 k                .gpio = DA850_USER_LED3,
& |* z$ h6 B+ U5 Y+ m  w# {  |% w' A                .name = "user_led3",
% d3 P5 n( l! U1 q                .default_trigger = "default-on",
/ M* b5 L; \/ F$ i        },
+ c) s: E* z; B0 a# k};$ K2 H% L  Z' A" R

' _: O) Q! G& Y3 Ustatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
* X5 A9 b' i  h: q4 N$ Z" s: V- H        .leds = da850_evm_tl_leds,
( M; @: p" `) t; ^6 x, a; n8 \' M        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),/ {% U9 f/ g, V3 W4 n
};4 p7 H4 j4 Q0 y# q+ I+ ~! O
; m4 n3 J' Z4 Q( _: A# K1 v/ _5 A
static void led_dev_release(struct device *dev)- B+ J+ C8 @( L- K
{$ z  I* n! |, }& f# W
};6 ~/ w4 q# o9 n3 A; J

4 S* F6 Q* u( G. E) nstatic struct platform_device da850_evm_tl_leds_device = {
, X" |% l, t3 d        .name                = "leds-gpio",
* r" T1 `/ q5 I: b        .id                = 1,6 {) c5 W: d. w+ E
        .dev = {
3 ^6 }1 N& F# U7 H" D                .platform_data = &da850_evm_tl_leds_pdata,
/ t, A/ B, g: ^' s4 m- T; W                .release = led_dev_release,% A4 P" y* W, k* W2 G( O
        }" d' Z0 u5 S% i1 S
};
- ^& Z1 O7 n! X4 ^- c; \! h8 O8 a' ]
static int __init led_platform_init(void)+ k' I8 L) e" T; {6 x6 H
{: g. H3 g5 E3 v# m. k8 j# L
        int ret;
/ t  x' p. z; x$ J* J7 w#if 03 B: H+ k; ]4 I8 X
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
" ]. U7 V. ]7 z& W1 g. O        if (ret)) \1 C3 i9 g* Z. K9 \( |7 r3 N
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"9 Z* \5 d; v1 g' B
                                "%d\n", ret);  i- \! j3 D3 U7 D) x: I
#endif7 D# w0 ~  `/ A* w: k3 @* x
        ret = platform_device_register(&da850_evm_tl_leds_device);6 p$ U3 f6 U9 D
        if (ret)' Y: l3 C" N6 B* Y. d/ L
                pr_warning("Could not register som GPIO expander LEDS");
; N9 O/ Z) ^# Y; }( \# u        else
4 C+ J7 S9 ~5 q/ l* r8 p! Q$ W                printk(KERN_INFO "LED register sucessful!\n");' v+ X0 X8 g% ?( \2 F6 R
1 p: O+ r4 ?& H
        return ret;" O3 ]  D3 `( g4 I$ K$ f
}$ v' R% ?. P3 N/ z1 A
5 ~! D7 f4 W/ m6 M9 z. R7 E& d1 r
static void __exit led_platform_exit(void)2 p# K+ a- t1 V. Z; o  g
{# N  E& p: S+ {5 l' @/ E+ {; Y
        platform_device_unregister(&da850_evm_tl_leds_device);+ u/ n7 W8 P7 e
7 x0 ]4 [6 U  U) ^
        printk(KERN_INFO "LED unregister!\n");
/ Q- }" d. [& n' c" l4 _) o}
: X  r! P2 _/ K1 b1 r& R3 \4 \" |+ a6 g; Q" T2 w* o: Y; z
module_init(led_platform_init);2 S0 z; j& N' _0 q
module_exit(led_platform_exit);# l5 f; j$ d3 l8 S
4 ^6 B6 c2 m6 Q7 D8 k: r
MODULE_DESCRIPTION("Led platform driver");6 q" _" R( c8 d9 {
MODULE_AUTHOR("Tronlong");0 u- |& W6 m8 Q5 Z0 Z3 {; J
MODULE_LICENSE("GPL");" W5 v4 X' X+ R: L

* k- ]# [# T& b, E5 N* f. M6 v9 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 13:19 , Processed in 0.039391 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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