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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
# c" E% D! ]" U' ?1 d! g#include <linux/init.h>
$ j: b8 \7 x. z#include <linux/module.h>$ `( @! ~+ W6 @1 H
#include <linux/kernel.h>) S. E7 T! Q& G& f
#include <linux/types.h>
! N6 b, `7 d) L) N& D#include <linux/gpio.h>. W: R0 U* F. ]1 E& A
#include <linux/leds.h>
) O/ U  X3 a$ m% u3 \  S. E- @4 G#include <linux/platform_device.h>
+ y6 }# M9 f$ f+ w: e+ e
9 z5 |* T+ H. j: Y% y* a8 g#include <asm/mach-types.h>
$ v1 C" ?+ R. E#include <asm/mach/arch.h>7 _) X0 F9 V; T& f) P  d
#include <mach/da8xx.h>
4 q& K) \' b5 }) ?7 ]* j#include <mach/mux.h>3 v  ]6 s  v% Q2 b- Z+ M  ]+ `
0 }4 S3 ^" a  n1 _
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
. x& P1 X6 g5 S% S#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
* S( W4 D) S4 A" e8 T5 U: P6 Z* Y#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)) a. B- |( U5 \7 q7 ^5 j
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)% K9 ?' Y: H0 k( T" u$ I

5 V- I9 _, @3 V/* assign the tl som board LED-GPIOs*/0 x. F7 i5 [/ W6 K9 }
static const short da850_evm_tl_user_led_pins[] = {7 Z; b) u1 D: Q- l: ]! d$ p
        /* These pins are definition at <mach/mux.h> file */8 z; H4 P3 ~  }3 h
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
4 j' f% i, v6 u/ v7 M        -1
  }, k0 J1 N3 [9 x0 h9 m+ T};& ?) M$ j& R9 [( C0 k8 X! Z, a
) i$ L( ?  `; H2 _, ^" H$ I
static struct gpio_led da850_evm_tl_leds[] = {6 u( m' {% W* L4 T+ f
        {4 h( f5 p0 U* K2 s4 r- D
                .active_low = 0,: e* r# ?+ a+ F" Q
                .gpio = DA850_USER_LED0,
7 C; F5 n. K5 h                .name = "user_led0",4 s1 M: p  t. X% J$ ]; \
                .default_trigger = "default-on",
! B4 [3 o, m6 V6 [        },
$ |4 w3 I, P, N8 `7 P        {
4 G4 J& y- X& h8 A3 w                .active_low = 0,
+ S$ l% k- V: h9 n/ R4 M8 L                .gpio = DA850_USER_LED1,8 D: U  K. E8 I% H1 e
                .name = "user_led1",: o6 T+ ~9 d) Q) P1 S/ u
                .default_trigger = "default-on",$ ]9 ~2 T: v" m+ C+ ^. S
        },
7 ^8 y9 o' C% T) g9 t        {: o' Z9 g3 y* w6 C
                .active_low = 0,
$ }( D; J9 P7 G                .gpio = DA850_USER_LED2,
: l0 z5 I- ~$ H, b5 D8 \                .name = "user_led2",9 h- @9 o4 \% z$ e
                .default_trigger = "default-on",/ Q+ ^( B+ P" x" u" v
        },! X% R2 g. V( |
        {
2 H+ b; h( T1 c2 i+ \                .active_low = 0,( o. p1 F4 H$ h( ^, v: T
                .gpio = DA850_USER_LED3,$ v9 \3 o3 m1 \; ~! ~8 {
                .name = "user_led3",6 R( r- A9 A; f6 n# s+ N
                .default_trigger = "default-on",4 s% Y$ \: K) ]/ [3 P
        },* D, x, Z& _! `! H6 ~
};; y6 M0 _; E; ]: a, F
, ?$ O7 n3 @7 }# I9 F& s# K
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {9 A* l3 J0 P: w8 u+ U6 r% Y6 V
        .leds = da850_evm_tl_leds,
" o. P* e6 d/ c: |9 p        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),0 G: k- B6 e8 V! x
};
# `& {8 S3 }" b
9 S* n$ z( d# q+ xstatic void led_dev_release(struct device *dev)8 z8 x  X) k* i  F
{
( w; n( }7 N  d! g) Z+ ]0 L};2 b/ \% ^4 ?' ^" O; D4 `

6 a, p* \1 \3 q& {static struct platform_device da850_evm_tl_leds_device = {$ Q3 f; d( r" o7 c
        .name                = "leds-gpio",
7 M4 L1 X' V( U4 W        .id                = 1,
! r% _7 Z. w' g2 U) n2 C( ?% G! K        .dev = {
; m8 ]/ ?! W! |* b6 u                .platform_data = &da850_evm_tl_leds_pdata,
( p% \* d0 M5 g  d( z                .release = led_dev_release,
: M% C1 q  ?$ v( n& R& R  D        }
2 @( M; A2 E9 ^. q};
7 m9 [- ?, y- s$ q, u# P( K- v7 y+ [$ _% v* Y' S
static int __init led_platform_init(void)
, r" j, O+ j6 }# j8 M- ^{8 A* W. y* j1 i" |% D
        int ret;
! N3 D5 `' H  e#if 0
  S2 [0 V! l: W: i) D        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
( W2 K7 A' c# A. T        if (ret)
2 w/ v! j( c8 q- p0 F5 F0 X                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
3 G; ~* a; G  f9 ?% j9 X( S) _                                "%d\n", ret);. f  u- Q$ b  U4 j3 Y
#endif) I* Q6 ?2 Z$ A; P/ e6 b
        ret = platform_device_register(&da850_evm_tl_leds_device);: H$ V. D& S, s5 J( P( B7 n# e* O
        if (ret)0 l4 B2 k. n8 W
                pr_warning("Could not register som GPIO expander LEDS");
7 y( V: ]; O3 t# K9 h1 F/ L( D        else
9 o) W" o. N* n$ W* X                printk(KERN_INFO "LED register sucessful!\n");* O2 j: I% }: ~0 ^9 [
! W$ w! k, H& c( b8 G% G
        return ret;
/ i3 F( R' m8 N2 x: A6 }1 p4 l}
4 ]( k% ^. k' x! q
0 T* \9 N5 l% h- J3 B0 [static void __exit led_platform_exit(void)
* Y- t9 C# j5 S! p( P7 D{7 \/ Q. O- X7 C+ E4 n! K& z' t' \
        platform_device_unregister(&da850_evm_tl_leds_device);! {7 T+ |2 T* k3 Z+ X3 z

5 u) X& h9 n) N% |" q: _% M. H        printk(KERN_INFO "LED unregister!\n");
0 J8 m6 I) ^; O. Y& t}
3 j; `( |$ m* r- u1 |
- V& c2 \% j/ m8 dmodule_init(led_platform_init);0 G- ~. C1 x' ^* [2 _
module_exit(led_platform_exit);
" L  X8 a: P3 |4 V# c8 s
8 n0 G3 |) w. T0 w0 f& B  `: }/ sMODULE_DESCRIPTION("Led platform driver");
( V0 b. k1 s8 d# [3 ~MODULE_AUTHOR("Tronlong");5 C1 Z9 ?- Z( a% w2 q* i5 {/ n
MODULE_LICENSE("GPL");" e# ~6 q/ P# ^- p

4 g3 {* {$ @6 {6 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 23:30 , Processed in 0.064314 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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