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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。2 F6 Y9 M5 s7 b4 D7 X" ^
#include <linux/init.h>6 L: v5 }9 D+ ~
#include <linux/module.h>' i6 o9 I5 M3 t) i2 j8 U) E
#include <linux/kernel.h>
+ k! |3 X( q6 S$ R, E#include <linux/types.h>. ]- J, g- f9 a2 Q0 f- x* I% D
#include <linux/gpio.h>
0 y5 l1 w; S8 B5 q# K1 R#include <linux/leds.h>: J( o! |9 t1 |7 u% O% e) v5 F8 }7 X
#include <linux/platform_device.h>' x+ e2 `, O3 }  Z

) d1 z0 W6 ^/ e$ K#include <asm/mach-types.h>
5 D8 Y) r3 b) g6 P) `/ l2 K7 z#include <asm/mach/arch.h>( W1 x2 m# d, ]+ W: S  _
#include <mach/da8xx.h>
0 d& o! n5 \' b1 E#include <mach/mux.h>) b0 \, q, o$ e! B8 U9 w

& e. T; p, u4 h* ~: X3 M  d+ F, p#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
4 o6 e/ S$ i2 {7 ~% I% L- B: S#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)) D$ Y  N0 s  E8 M7 {) }2 g0 M
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1), t; K5 B+ q3 F
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
" N* f+ T/ @1 O" s) w4 V5 y, a/ D8 S) {) ^4 r; W" Z- Y# G  E0 Z
/* assign the tl som board LED-GPIOs*/$ Z3 Z* h9 w' d5 t. B" Y
static const short da850_evm_tl_user_led_pins[] = {2 @7 X( Q# A+ H" [$ x; S9 Z
        /* These pins are definition at <mach/mux.h> file */
! }6 O" D% r) {0 J        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,  K$ F/ c- y: m& B
        -13 B% c7 v$ z0 f, @+ f
};: G) F: G7 P& L  u
* R- U# ]' O( m$ J, Q) @
static struct gpio_led da850_evm_tl_leds[] = {- [' g, A( D' A4 g" i
        {# U# s) q: c* B/ c7 b/ _
                .active_low = 0,
; N4 n' N- {* _- P( d8 y                .gpio = DA850_USER_LED0,
' X9 i* S  X+ i) E5 t                .name = "user_led0",4 l) X: Q' D" Q" U
                .default_trigger = "default-on",8 B; J0 `$ C) x$ m, G
        },
* Q. h2 ?8 x# h4 Z: a- y' @        {( S2 g3 Q$ u( N/ [, N
                .active_low = 0,; n. N: l4 A- j- \) G/ T
                .gpio = DA850_USER_LED1,
3 D3 r9 m+ i/ i/ s                .name = "user_led1",
5 h7 x; n) k/ R! ?0 e' T" V, t                .default_trigger = "default-on",
$ a* o9 {, S9 `- C8 k; T6 `* v! m7 ~        },+ b6 j2 `4 d2 f; d& v
        {
: ]# z9 b$ E5 I                .active_low = 0,( t/ ^& x) X4 E# `/ \
                .gpio = DA850_USER_LED2,
' U$ `. I5 E& D' `/ T( }                .name = "user_led2",; g" y# I' o" s- e3 f, A  d
                .default_trigger = "default-on",0 @' c, f/ _+ d# B6 m
        },
8 T* |; s; c2 h+ S        {# w4 l9 P+ c! K) A0 F6 X% Q( o% [
                .active_low = 0,6 K0 d9 ?3 p& }/ Z
                .gpio = DA850_USER_LED3,, I' L6 `, g4 k" l
                .name = "user_led3",
% V4 V+ `4 s4 ^2 s. A7 X! |% V/ }& p                .default_trigger = "default-on",9 F* r, n" c! S1 J9 ?% U
        },! V/ p; [7 K' O! S# ^: [; r& F& {
};
) g* t. d: R2 j+ ], g
- @! S. F- l2 \) astatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
; w5 B, c2 C( [3 i& A        .leds = da850_evm_tl_leds,
; l# ~& V% p4 f  S  K        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),8 o9 u' Q6 i' ]- Z
};
& h5 O3 j1 K3 v: N* _4 c$ @4 t. U1 |
7 }3 P  R$ j  n3 _$ I' e; tstatic void led_dev_release(struct device *dev)/ F% j6 O) N# g+ o6 Q" B6 ?
{6 v( O2 w, ^/ [  n8 z3 e
};
7 [; N: n/ I* ^2 W  O2 [
7 }3 [; p+ q' S; e3 Y& cstatic struct platform_device da850_evm_tl_leds_device = {2 }3 i6 b7 w" A7 ]# N0 G# g* {
        .name                = "leds-gpio",2 `% s: ^9 D2 T( f8 p8 m
        .id                = 1,
. ^  W: i) E; H9 M" `& k8 {1 g        .dev = {7 h6 r0 X& q$ a! h: V/ c* F
                .platform_data = &da850_evm_tl_leds_pdata,
* U5 X$ E  f6 o                .release = led_dev_release,
5 C/ h) F" H! b2 U3 f: h& A        }
* j, j! G9 @0 Z* s. H) k};; o% i! w, g/ Z& G
" v! ^/ \8 `9 V
static int __init led_platform_init(void)! r4 j: x5 q: y, @- d
{/ Q! f0 @! @$ T6 w+ T
        int ret;- _5 [" A3 b' v+ h
#if 0. B5 \; m9 y( a
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);" |$ L# e' M/ Z# `
        if (ret)
4 ]" Q* _1 O! X- s' f                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
, u6 ?2 e8 f3 ?+ E                                "%d\n", ret);7 j) _! e7 r; V. m3 e
#endif
! O" A$ D* D/ _( f        ret = platform_device_register(&da850_evm_tl_leds_device);% P# |" h" J5 d5 G
        if (ret)" v) D" M2 Y! m  k( Y
                pr_warning("Could not register som GPIO expander LEDS");. _: T! y+ R. F$ \, a
        else
" }; K  t: L" W- f0 v5 t; I* L                printk(KERN_INFO "LED register sucessful!\n");. a2 e( q! G1 q1 B% A! c( F0 Y2 |4 f+ I

9 j3 ~0 ~, R6 |0 c7 C: X& ]        return ret;
1 S7 c3 a6 a: I}# g3 D; |0 a/ t; z# Q' F+ f% r
4 C6 M3 w8 [$ \$ O. Y
static void __exit led_platform_exit(void)" B' `/ l) k$ |6 _6 F/ V
{9 l/ o* i2 u8 l4 ?$ U9 s) R
        platform_device_unregister(&da850_evm_tl_leds_device);7 f' s+ h3 E5 Z0 Y* o5 {

8 k) H0 H/ R- ^        printk(KERN_INFO "LED unregister!\n");3 |3 x7 g$ Z" v/ W7 O9 ]/ q) m: f& g7 h
}6 o3 |/ e% f7 T/ J
1 z& `9 o, @% f* e) L/ z- r
module_init(led_platform_init);7 M8 P% n% s, ]  H
module_exit(led_platform_exit);
" L: \5 U! B4 e7 b* v# a! C; T0 O6 r' r
MODULE_DESCRIPTION("Led platform driver");! I3 ]9 J% b9 D5 \- y
MODULE_AUTHOR("Tronlong");
$ o- Y( k% D' `. e& I8 ~2 t; t/ NMODULE_LICENSE("GPL");
# |" x$ n5 q0 _! U1 d, ?0 G( {+ u  S3 m) b4 B( u. D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-22 12:01 , Processed in 0.045135 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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