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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。; [+ w% {6 A. B4 E! t( s$ }1 z% {
#include <linux/init.h>. z7 X) W+ t+ H$ A4 w0 C4 ^
#include <linux/module.h>! W3 @. {3 l6 D- J& A' ^+ G% b
#include <linux/kernel.h>. |: o0 X1 }5 Y  Z% z7 v+ E& e: d
#include <linux/types.h># |1 y; q+ J; N1 _4 d! W- [
#include <linux/gpio.h>
% @. N/ m% L1 M3 J#include <linux/leds.h>/ z* I4 U, Z2 v/ ?0 Q/ t
#include <linux/platform_device.h>
3 o/ N4 i$ X9 s0 p' S9 j) u" q; e9 ?0 |- m4 _: N
#include <asm/mach-types.h>0 P+ R5 S3 z  S1 R
#include <asm/mach/arch.h>
5 }3 d  K& F* A& T7 u#include <mach/da8xx.h>% r  v) w) f( D& S
#include <mach/mux.h>
7 k% B! {; X0 g; f, c+ A
# ~+ X- h8 ~, _) _9 q; h+ l#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)9 a2 |: Y5 Y1 k7 f
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)% k# x: H" v. s. {2 _& k
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)( B$ F: y- [4 e
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
( V8 b& C1 s/ Q$ {* l% T/ V! T3 s6 p+ p6 Z6 s9 I4 r0 }
/* assign the tl som board LED-GPIOs*/: N) _9 Q. C6 `& ~" G' f5 C
static const short da850_evm_tl_user_led_pins[] = {; U6 S% K9 ~8 x7 o: m6 l
        /* These pins are definition at <mach/mux.h> file */" @, s- j, C6 o  m2 i
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
4 L2 \5 N1 }# C" h. E0 j        -1& a+ E+ m' N% v8 v8 c% W) N# |* z
};
# P! D5 h3 y+ W+ z# j0 ^/ F8 d. w3 ^; c% V
static struct gpio_led da850_evm_tl_leds[] = {
( q) U' v2 P8 m+ W- g        {
; o+ h8 S  I$ o$ F9 K8 \- j  c                .active_low = 0,
# x( \5 |9 B# }! ^  s                .gpio = DA850_USER_LED0,
0 \1 j. g$ l8 a- d" }) m                .name = "user_led0",
- W* k$ Q- K7 w) v7 ~+ `8 j. @                .default_trigger = "default-on",2 K$ q( l3 T; x: ]
        },5 a) J/ y$ P2 Q! @/ w! F
        {
; R+ c5 ]0 t& z                .active_low = 0,  H' l( X+ r, T0 s) P6 K2 u  ]# i" @
                .gpio = DA850_USER_LED1,
% L; K: S( O6 z                .name = "user_led1",
/ J0 I5 ?0 V, q7 k                .default_trigger = "default-on",1 ~& v( I* F& F- c
        },
: X: d9 M  _! s" r* L        {+ K, X4 o  A7 I; D8 F; r& K
                .active_low = 0,
6 C3 `  H0 m+ W8 ^                .gpio = DA850_USER_LED2,/ {2 Z+ Q1 [% ?; h+ T
                .name = "user_led2"," w- k8 @! G, G" Z% V" ]1 Z
                .default_trigger = "default-on",8 G, }# k% g7 |: e/ O, m
        },
7 Y# M7 S+ ~  b: b, Z4 R        {5 m$ t' r! p- q( ^; z3 j; c
                .active_low = 0,2 Y& m; C+ w) J
                .gpio = DA850_USER_LED3,- p8 r" f& Y5 y) M" q  \* g+ ^
                .name = "user_led3",
0 G9 I* J# h& E6 x2 }                .default_trigger = "default-on",
: \' `" q7 y$ c' O+ u' {# c        },2 z/ h$ L, ~$ o$ a9 M/ l
};$ n( F/ C$ C) l! @  y

& ~, X, [0 I- b6 pstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {# {1 H9 i+ Q1 Z! h1 R) l
        .leds = da850_evm_tl_leds,1 D, |% o, c+ I
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),8 z( t1 b, A9 \( q4 C
};" l% ?( A3 n5 @1 w% h6 k% H0 a
! O; V% l# @1 K6 J
static void led_dev_release(struct device *dev)
$ T/ Q- W0 d/ `' s4 N{
) V5 H4 `; G8 |1 n};
' {+ y, |8 U3 S! A3 e! x& w& C, T6 b8 h; n2 x4 z$ K
static struct platform_device da850_evm_tl_leds_device = {
, I( Q* [6 @( Q; n1 ?        .name                = "leds-gpio",1 |) x. I1 s* G  U
        .id                = 1,0 n! w2 w$ y5 X4 _
        .dev = {
$ ~2 Z% e) u  `5 ]                .platform_data = &da850_evm_tl_leds_pdata,
6 S( D& a4 {4 L% |7 l                .release = led_dev_release,
7 N, B6 ?$ T5 T. \        }
% {/ l4 M7 t* Y( k};8 G  j5 T& H9 `% e7 I

& X" _$ N, S2 X6 U# F8 Z; O. Kstatic int __init led_platform_init(void)
/ v/ ?" e' [6 G3 }- R! H{( g8 o3 u- F6 W2 Q: @5 v7 c
        int ret;, x' \2 e8 O7 y) Q' P1 U9 t
#if 0" @0 H- M  P: I5 ~! |& M! s
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);5 Z8 B; q1 R0 s/ d: C' e
        if (ret)$ U4 f: K: y. B* \1 w, B
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"" N4 G8 u) S; y- j! h; V
                                "%d\n", ret);, j% n4 Y$ a& W# {8 a, ~
#endif5 A8 r' N. f/ e5 p3 {) ?
        ret = platform_device_register(&da850_evm_tl_leds_device);
. P: r$ k" V' C. r% g        if (ret)
( f6 t0 N% f- P% b1 a) V0 h. r. r! y                pr_warning("Could not register som GPIO expander LEDS");
8 f7 @; E- m: E9 N        else
# `. [; D* n0 \                printk(KERN_INFO "LED register sucessful!\n");
* Y2 e8 i; z4 u; r
0 u/ s' ^" S- }0 |! A        return ret;* I' `4 @4 g# h7 A1 j# ?
}4 ~, l0 C+ u9 v( H2 M( |

: T% G0 g% u5 u1 I2 e) q  M( nstatic void __exit led_platform_exit(void)
$ h' s; `. {  d) u" x' p% ~{: F9 @( {9 \) S1 L1 x( |# x
        platform_device_unregister(&da850_evm_tl_leds_device);# t. d% U" D, i1 G6 f- k+ A4 [

3 U2 _. U4 s; d2 d* ]+ I8 N7 }- C        printk(KERN_INFO "LED unregister!\n");
2 J% ]0 W, c, c. p) Z  D& {}
& s2 W! ]  W! r- _$ Y8 n. p
# y4 f7 k  g" Mmodule_init(led_platform_init);
0 ?- G# j# ?3 |; n) L: umodule_exit(led_platform_exit);. ^9 W) h& j$ m8 I- O

/ J2 Z" ~+ {- {' V/ FMODULE_DESCRIPTION("Led platform driver");# T$ o% y, @; K- x: O) p( ]: k
MODULE_AUTHOR("Tronlong");
$ b/ v% G# e6 Y  O5 q, R; ^4 WMODULE_LICENSE("GPL");
, [; o* g4 O1 b0 Q. I6 @+ w9 U3 c! n4 f0 h! Y& L2 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 16:54 , Processed in 0.040948 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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