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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。) q6 z7 N  ^) M: K2 Y
#include <linux/init.h>! |) _# y2 H& L; Q, V4 E
#include <linux/module.h>, v' J* N( o5 q( I$ i4 x8 G8 S
#include <linux/kernel.h>- T% S# M$ B3 Q! N* X& s, ~" q0 b8 T
#include <linux/types.h>0 v* l2 U/ D$ C- P( j
#include <linux/gpio.h>  a' O9 p0 g; s0 f/ }; d
#include <linux/leds.h>4 @4 I( g% D1 S' C
#include <linux/platform_device.h>) f0 u, N: H1 ~% F9 [# k" @
- v% l  v9 c" {/ n, Q
#include <asm/mach-types.h>% b* M' I% r  H& C/ m/ S
#include <asm/mach/arch.h>
- s5 c8 Y9 i. U#include <mach/da8xx.h>
1 N# q6 j/ o  ]5 \3 z: x- n" m#include <mach/mux.h>
+ w* E$ ^% r% x+ G* t" \( l- h- _5 v
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)& z3 b5 |4 E1 L3 Y$ ~
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5). U$ ~3 i# |0 `! N: c4 y5 h
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)7 {2 v9 l$ Q7 Z* ]( Q( k
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)+ c. w/ V. k. C) M" p
3 o1 u% f3 n4 `5 O
/* assign the tl som board LED-GPIOs*/
" _) h3 I$ m! estatic const short da850_evm_tl_user_led_pins[] = {
5 H9 {  F* q( |8 F; K2 d        /* These pins are definition at <mach/mux.h> file */
) N/ y  y: A! J7 T5 z0 g" F) i9 y        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,8 N  ?9 y; Y) i3 G
        -1( C3 h5 O2 Y; w4 E; u+ u
};7 o, r8 d' q  W; l& Y
' R& M+ j) d7 {, n! W
static struct gpio_led da850_evm_tl_leds[] = {# U' Q6 e& J0 d" l- ~
        {; \, y6 t; [: t) B7 j  B) q
                .active_low = 0,
( f# i- |0 u. z- H                .gpio = DA850_USER_LED0,
4 ]- {1 N: \( k/ M5 N6 a                .name = "user_led0",) o. d5 f& h3 h0 _$ h8 a1 J( Z
                .default_trigger = "default-on",( }' f/ }6 F9 E# o  |& [: R
        },
) X: D7 l5 k9 e6 X7 Z: {; h7 z        {! c; m% k' t, t( j  \9 r
                .active_low = 0,# p. Z; ~& `) `. Z
                .gpio = DA850_USER_LED1,/ B2 j3 y) J% U
                .name = "user_led1",
$ V# e' ]2 ~- u, K& [: `                .default_trigger = "default-on",; ~/ f4 A8 [2 X& ^; a6 H: I
        },
; B2 w2 V- Y7 U( e# p+ y7 E        {( p# y. g$ _6 b0 b( E
                .active_low = 0,6 t. e* w8 y6 M' G# w2 X7 d- @" t6 c8 P
                .gpio = DA850_USER_LED2," C1 R, W+ I8 b# P0 F
                .name = "user_led2",8 o4 w- b& p; b- Q3 G
                .default_trigger = "default-on",
% o2 O% A, l2 U3 z        },
" y7 ]" ^, g  T1 @  g+ |( q        {
6 }' ]+ k( R0 O/ m7 V                .active_low = 0,' S% a; ^- @$ Z  K4 Z' a
                .gpio = DA850_USER_LED3,
, K0 Z+ d8 Z6 h% |4 n- o4 c3 A                .name = "user_led3",
- ?( r5 x& G, }3 K                .default_trigger = "default-on",
8 s* A3 Q' L8 V$ M        },
2 s/ G# [4 o; q# U) W0 [7 d5 m- y};2 ?0 k+ J$ [2 ~- Y% m$ U

8 T1 e2 w7 H. F9 J: \static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {" D, X% ~1 W1 b# Z$ {' C. Y
        .leds = da850_evm_tl_leds,
# w* W+ c% {* j" Q: n        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),1 X$ p7 L* K: |# \5 T( _
};
0 e7 ]* ^( D* Q
2 {; d' o  f$ d( K+ Y0 ostatic void led_dev_release(struct device *dev)
: y" K) F( ?  m" M' L{
+ s6 ~$ B$ w1 W1 x" q' P& C};
5 J6 V. r- \0 V; ~
/ r5 O: N+ k" H' l3 \static struct platform_device da850_evm_tl_leds_device = {# o# A! V! T" V. {1 V
        .name                = "leds-gpio",
3 J! r: z" c' I        .id                = 1,
7 ^0 i5 }' A2 S% f! Q$ W1 A        .dev = {
: H+ z/ \$ t$ k# j5 W! t                .platform_data = &da850_evm_tl_leds_pdata,9 L) u1 N$ Y1 f! a3 i1 F
                .release = led_dev_release,
6 P- j+ I9 A, r- s        }% Y+ e5 t! P+ x! M. A+ ?0 `
};
& ]: }3 G4 O% Z$ M( Q& g+ y- y0 B) L* T' u2 |
static int __init led_platform_init(void)
0 x: r$ h; y' Q- L4 ?{+ A" V9 U" K" @% A6 W/ O6 u8 j
        int ret;3 X9 R; y( i6 }
#if 04 H- p/ B: G( E# y& M, v
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
: D3 e& w, G2 D! k: t# X8 M8 s        if (ret)  C' e- f4 F  B  Y, g- ]
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"  v: a) a) w& W+ u0 ^; U5 H
                                "%d\n", ret);' p8 |, Y( }6 _( V
#endif6 f; n8 h& N; {' {6 t4 t. m0 r4 _
        ret = platform_device_register(&da850_evm_tl_leds_device);
! z! ]0 m* \7 s/ z        if (ret)
, |3 |6 C: u6 B5 |                pr_warning("Could not register som GPIO expander LEDS");
" Q. q5 _: u+ ]  C7 R        else
" K# ~! O/ D/ J# _% K                printk(KERN_INFO "LED register sucessful!\n");9 h! X3 S- x1 ^0 y4 H6 s- ]
& ]7 Z3 ?) k' D) l; ?3 ?
        return ret;/ i# r+ T8 T2 e* }
}6 @; t  O2 ~  `: P+ G

# @4 }2 e' y9 D1 `static void __exit led_platform_exit(void); D. v4 |0 X8 @% c
{
, m: I" o" y: W( N        platform_device_unregister(&da850_evm_tl_leds_device);
0 a# J9 k8 a  a" X$ o! I/ [2 t; x  r) ?1 p4 H/ ^8 R
        printk(KERN_INFO "LED unregister!\n");
) R+ ^$ C2 {( P& O8 p  Y; ]}
2 A3 b& p7 n& H/ @( X
4 E' q4 V# k0 Y6 C$ J5 {; Tmodule_init(led_platform_init);4 \8 R. F' R0 A# s& ~
module_exit(led_platform_exit);' b0 h% L2 E$ z$ ~
. a4 U* b' o1 }! ]: t$ M8 D) K
MODULE_DESCRIPTION("Led platform driver");
+ z" U9 W; _( Q* x( pMODULE_AUTHOR("Tronlong");
1 U$ Y; ?2 _( {) E2 k7 HMODULE_LICENSE("GPL");" [5 n4 q/ ]* k5 L9 I
1 |- }7 L: H0 s' p) L$ ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 00:44 , Processed in 0.058609 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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