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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。& V  l7 r/ W' p& q9 j
#include <linux/init.h>( @; r& u9 ?" F, {3 c+ y
#include <linux/module.h>
! K8 ?/ Y" y9 T: f8 U#include <linux/kernel.h>+ W' u7 }6 A1 K( f8 `" C7 K% @
#include <linux/types.h>1 j) ]0 |- P$ D
#include <linux/gpio.h>  z+ T' {4 ?+ N# k
#include <linux/leds.h>
  {& L2 R) R9 n. U2 p1 M$ U+ F#include <linux/platform_device.h>8 U( V3 B) [9 P! f2 \& H

, T( h3 G% K$ q! ]#include <asm/mach-types.h>  L" F, o9 k& P8 G, ^/ T: C# r7 y
#include <asm/mach/arch.h>3 b4 b* Y4 `9 u8 z" f
#include <mach/da8xx.h>
2 ~3 i4 w0 a/ J+ P: N' K4 ?5 `* g#include <mach/mux.h># S6 b, P  b0 @5 s3 \& b

# C1 _# F2 p4 k#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)3 s4 {4 L; c! k: V3 m' R
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
. G* o8 I: v  Z4 y( f0 T; [$ j#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
# @; D7 _: X& w#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
, b* y0 O4 d& [2 P
5 }0 L2 C7 A" v2 w3 D$ Y  F$ N/ N/* assign the tl som board LED-GPIOs*/9 X- X6 C! D& g, H' S" Q; O0 B
static const short da850_evm_tl_user_led_pins[] = {+ d! [9 ]6 N6 A- P8 c! k4 }3 g
        /* These pins are definition at <mach/mux.h> file */3 n* z6 L1 s  z" J9 J4 v
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
4 {+ \( ^/ f+ x        -1( L' Q+ _1 k8 u6 a) a7 w+ \9 |
};
' O. g( N( r; a5 |
) B$ A6 A, |; q! N0 b+ D6 Gstatic struct gpio_led da850_evm_tl_leds[] = {" P* A. X4 W. d% f
        {- R2 m- m4 l6 i; ]
                .active_low = 0,
% {# i0 D- G/ }                .gpio = DA850_USER_LED0,2 Z- [1 J2 I9 H1 Q4 v5 u
                .name = "user_led0",
' X! u0 W# c9 w1 t( j                .default_trigger = "default-on",
, i6 N+ C& A. v4 R1 x: y        },
6 F. x  f, N; P( U        {+ f* ^/ @$ |3 v) K
                .active_low = 0,
2 D3 @; ^' {/ z0 p3 H% [) L' m                .gpio = DA850_USER_LED1,& }3 H" y, d! E& e8 }5 D# ]" o
                .name = "user_led1",
0 e$ n: y: s: }! X                .default_trigger = "default-on",
! _( r' A9 }7 m        },
% ]$ _5 c+ L( q' w        {/ C: V/ Z8 ^4 U. k  R9 }6 Y
                .active_low = 0,
0 B$ L9 {8 g( f                .gpio = DA850_USER_LED2,
4 W7 h, c6 R5 n4 y. X                .name = "user_led2",
' g% w1 [; J& J# g1 q                .default_trigger = "default-on",* M) C% c: H+ f+ F3 E- h# @$ X! Z; m
        },3 @( P  b0 {9 {0 X% d7 l
        {/ \; p$ z. M, C5 i
                .active_low = 0,
$ A7 k& a4 i' e& `5 E                .gpio = DA850_USER_LED3,
) K# J1 n5 \: L, c0 r( U. K  a6 Z                .name = "user_led3",5 x& L* }, [0 K, @4 U
                .default_trigger = "default-on",
8 S/ u& X9 o! J        },- y' _4 Y! J$ p1 t2 ^
};
, w* s) U. G' c! {1 u% z( a& f/ z, z2 }+ n: m( V3 D& ~7 r, }
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
" b3 C# X; M, I, v        .leds = da850_evm_tl_leds,
( ^. d" V3 n. a% q2 D7 \        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
9 z+ o+ e1 f  i, M};  m1 E5 }) C/ i2 \  z+ @: M( E
( z. K% K" r6 M, ^0 O
static void led_dev_release(struct device *dev). o) @7 t; ^* X" d
{6 F4 n+ V& k# ~. V" U
};
" R5 ?" q6 L, K* ?! o% r6 \$ v9 R1 [2 {8 `( U4 {% ~
static struct platform_device da850_evm_tl_leds_device = {
& g$ B$ }9 p/ N  n9 w        .name                = "leds-gpio",$ i1 b2 l" u! w5 [! h* D: A" v
        .id                = 1,2 C9 c- m3 m5 H/ {
        .dev = {; ~0 ^6 E* c; N) F' ?3 k; E6 ^, q
                .platform_data = &da850_evm_tl_leds_pdata,
3 m+ O% S+ \4 C, k4 D                .release = led_dev_release,
* o: I" l- X" b0 O8 c; e6 Y        }
" U' i% i" l1 D( f$ s. v};
2 ?' \4 w7 e2 S) p5 u, X  a) |, |' E
static int __init led_platform_init(void)6 ^. H' n0 I, @! F) J3 `8 P  _
{
5 l6 L9 r. C4 E$ X, t+ a9 u        int ret;
9 k1 u4 D% E) U0 l# M6 D0 [#if 0' J9 ~4 E* ?% @6 f4 q+ j
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);8 f' O: ?. g! h$ i8 `
        if (ret)
! a& W# M+ j! r; \: R                pr_warning("da850_evm_tl_leds_init : User LED mux failed :", C) d% T" g4 t5 Y' n6 o
                                "%d\n", ret);
* i9 |$ s! X; o4 `! I7 @! e#endif
2 a5 U2 h* o0 I/ N        ret = platform_device_register(&da850_evm_tl_leds_device);: X2 n- L5 C8 h' h3 W
        if (ret)) q6 ~5 z; e* a: M
                pr_warning("Could not register som GPIO expander LEDS");
1 a- J( Q% {6 j& _* P        else
# ~6 ?7 v6 {  j5 S                printk(KERN_INFO "LED register sucessful!\n");  t: u: J0 T0 C7 W( Z& g" }: K

% \" B0 a' u8 i- V        return ret;5 }# y8 a- }7 t/ @
}
) V& X4 W; M9 H
7 I- d% f5 ~' ~8 Q* Gstatic void __exit led_platform_exit(void)" o# s+ e1 D& J9 n* {6 d  N
{& N6 c, \+ o+ {) a6 I2 [
        platform_device_unregister(&da850_evm_tl_leds_device);0 I4 ?: U7 L% t9 r$ o* {
, i; o" I% w7 a: X- ?
        printk(KERN_INFO "LED unregister!\n");2 F! Y" w2 k( ^( Z. ]& ?7 g
}
( S" U, m7 N7 p1 [! K  E* D9 R% }# z" _' l9 V/ ~9 u/ @
module_init(led_platform_init);1 s9 u9 i+ m0 v$ E# @
module_exit(led_platform_exit);9 \& C7 G$ w& g  d  O

) J0 r% M8 j  t2 b3 @MODULE_DESCRIPTION("Led platform driver");
2 z5 T; w4 ~8 r3 y* ~" }MODULE_AUTHOR("Tronlong");! d" E; K) J0 _9 e1 Z
MODULE_LICENSE("GPL");
) B3 s/ N( E+ Q0 Y3 R0 e6 J  g: e0 }& p
/ \. C9 p6 q$ a. G, U9 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 17:41 , Processed in 0.037971 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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