程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。( {+ S1 @7 X8 V% N
#include <linux/init.h>
, s2 ~* ?+ o' l. A; ^6 C#include <linux/module.h>  `- o0 e  \$ r+ ~$ m! C0 ^. B3 A
#include <linux/kernel.h>4 F' B5 \% {9 h) H7 N$ n
#include <linux/types.h>
$ Z6 x5 z4 z/ U) S$ X7 f; G#include <linux/gpio.h>/ n% t5 w% h, l( m3 ^* J
#include <linux/leds.h>
& X+ {9 ^0 z+ l+ U#include <linux/platform_device.h>
2 \1 [6 E5 C: G4 C
2 e8 J0 g" b" ^7 i#include <asm/mach-types.h>9 E6 W( W. ?; _) E9 c9 F
#include <asm/mach/arch.h>
* a" H$ X2 y7 f6 z% c#include <mach/da8xx.h>: k& G; A2 X! P! f
#include <mach/mux.h>1 g; k  l$ ]/ i5 f3 b: a  C

, n' N: |3 G/ A#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)5 R6 D3 y: Z9 n- H+ E, T
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
2 V6 q( h* a$ |, S/ X& g) F! f#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
5 }/ J: K8 v% J* o4 u- n#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)# z/ A/ X! F7 {, \' N

3 G  I# q9 O& ^) U/* assign the tl som board LED-GPIOs*/
9 h! z% G; V; ustatic const short da850_evm_tl_user_led_pins[] = {7 g: m& A% [- y: A) C% M) L
        /* These pins are definition at <mach/mux.h> file */, Q3 F& Z$ l" U4 d8 v) Y
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,* Y: b: i4 R( C. @# s; h- j
        -1( m9 U( d! ?7 L5 ?
};, I" d. G0 F4 `3 w

3 m7 K- E) d+ Gstatic struct gpio_led da850_evm_tl_leds[] = {
' s/ U: \' ~; k2 l1 v; d        {
( {' u, t' a! ]6 g                .active_low = 0,6 `0 J( m7 B9 y# _8 k9 W7 e8 d4 ]
                .gpio = DA850_USER_LED0,0 c$ V4 j+ \* M* I
                .name = "user_led0",1 Z) P+ l! [$ {$ H. u& o6 @: j
                .default_trigger = "default-on",6 P- h# ?4 e; P" ?  s- I1 `  W1 S
        },5 \( y7 S" g' H- g
        {
( W1 y: t7 b. y2 b                .active_low = 0,. _. C- W# m6 _
                .gpio = DA850_USER_LED1,
! c& ?! d) V* K0 S; p( t                .name = "user_led1",9 @# S* o+ K6 a" K
                .default_trigger = "default-on",
# o4 t7 N( r3 n7 k        },
8 L& f; O2 S* k  H5 ?5 ^6 G% ?: K$ J        {8 R6 d; J' n3 J9 E' F9 {
                .active_low = 0,) ~& c% g* B$ u+ N# E/ X
                .gpio = DA850_USER_LED2,
. S& K  V3 `3 U  w: b  ?% c                .name = "user_led2",
# P  \: o; B% u# z) [! ^                .default_trigger = "default-on",
9 E) k* M4 f% o0 z% L% Z6 q7 J        },2 y* i" w9 z! m5 @" g
        {
/ d/ M4 U* C" ?8 g/ }( ^3 A                .active_low = 0,
; T* A/ p# ]* b0 C  z0 ?8 N                .gpio = DA850_USER_LED3,
& M+ z7 {& j* {5 y0 M% y                .name = "user_led3",' g( j2 w5 B, j
                .default_trigger = "default-on",3 P2 V0 A6 k9 ^
        },
3 U2 b  y& C/ h7 X! `" m};2 Q7 h: Z5 i( U% |) V3 B

2 X7 P% x3 T% O) Y$ Dstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {8 n& [* l% y8 p7 G, ]7 [
        .leds = da850_evm_tl_leds,/ r$ l& N: d4 a: O
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
' p& o3 o! x- h, y2 K, l) @};3 r1 L7 r- }2 y6 l' d
& `0 b7 H" t; }9 q
static void led_dev_release(struct device *dev)4 D- v# Z2 K1 W0 a
{. q/ `* ]" x3 P1 r
};
3 t; T5 ]2 S8 n9 N
9 e' ~; A" F7 Istatic struct platform_device da850_evm_tl_leds_device = {
9 c* C4 ?9 h' t9 l3 h- |        .name                = "leds-gpio",. H8 j$ b, Q2 U; ^
        .id                = 1,+ q7 b5 T" w: F6 q) f: m
        .dev = {
! B; M" m- k% \                .platform_data = &da850_evm_tl_leds_pdata,, @5 \/ i9 c( H) {4 @2 J- K, h5 c
                .release = led_dev_release,; M2 Z: @3 {  M$ U% l: I: {& y2 H
        }. @- q  g  g" l7 K* Z6 b4 T
};
. V+ }  y5 d, ~" `2 ?  B
% w( P+ R6 ~- r, Y  P$ B2 ostatic int __init led_platform_init(void)0 Q# d, H5 F. m4 S  A. R
{
7 p. J2 o/ p" b$ I$ r& n        int ret;
7 \/ n  J8 p6 V8 @#if 0
( c8 p$ _! H$ \: ]        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
/ i4 l. v" _0 C: K        if (ret)8 W6 n! d$ m  R
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
" `+ I; ^* c2 Q% _/ f                                "%d\n", ret);
2 J2 v$ _- ^8 c& M0 y3 N. c#endif: w* d* `; _, \  C% x4 f+ C3 m
        ret = platform_device_register(&da850_evm_tl_leds_device);
0 j4 e2 H6 S8 x: j/ M/ X        if (ret)
. e5 R  |9 E3 m: l( w4 Y8 w                pr_warning("Could not register som GPIO expander LEDS");( j9 V- f: ], W) X
        else
# [& n1 p  B: E                printk(KERN_INFO "LED register sucessful!\n");
1 d8 G6 a6 h( f
( f% B9 \5 H5 q* |  D+ _4 |        return ret;& K8 {/ y  \) E4 {
}* f6 c; H  s# P" k; l3 ^  ]: i6 A
2 ~/ t. T+ q& y( F% x3 o
static void __exit led_platform_exit(void)
" e+ O/ ^1 O$ W3 C$ W; n; R9 x{8 h  p- ?, L1 ]. [* n' j
        platform_device_unregister(&da850_evm_tl_leds_device);; C5 y5 \4 N7 S* y* T! `7 d& t

+ b8 _9 d# L2 J, M" Y        printk(KERN_INFO "LED unregister!\n");5 q; q; y, X, D& S' ]
}
1 U9 k( {5 z$ L# p' j0 F: [& X( a+ r- N: t& G/ }0 N0 R4 P: B: k
module_init(led_platform_init);6 n# V3 f* T8 i+ g4 s0 ^* F
module_exit(led_platform_exit);
) [3 M( a3 I# p7 r5 a1 j0 j# r
  \* a; o5 e* Z5 B+ |, M0 O$ D! LMODULE_DESCRIPTION("Led platform driver");
! I2 b! T$ h2 y9 y5 VMODULE_AUTHOR("Tronlong");# K+ |" H- z! O4 d$ A; U
MODULE_LICENSE("GPL");
6 `4 a0 l0 C4 D& O3 h4 a1 O. U% B2 O$ i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 03:02 , Processed in 0.037625 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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