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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
/ w5 c, D. J. b  d! _( k3 S#include <linux/init.h>
3 t! @8 u% Z& W. s. C5 K' O! d#include <linux/module.h>7 m7 D. Q0 ]! R5 `% v
#include <linux/kernel.h>
3 y5 R! r$ P/ f9 Q; R* T#include <linux/types.h>% M8 e8 [9 C- q' X
#include <linux/gpio.h>$ P7 L# T7 ?: [1 M5 N* X  T( K
#include <linux/leds.h>
! y* P2 l/ S. {0 w#include <linux/platform_device.h>  M6 @$ R7 p& x& P+ {
# Z% d! z; `, C8 r
#include <asm/mach-types.h>
6 b& c. q6 U: O; k, f: S9 |7 \! H#include <asm/mach/arch.h>
4 Y; F' y; t2 @) U7 c#include <mach/da8xx.h>
, m% I& R7 Z6 _$ }2 d& N#include <mach/mux.h>+ [6 N$ m% [3 e) p
" b* M2 K- b7 H, r& z
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)! }/ T0 n: ?' ?# u
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
, v" o5 Z8 \# ?: O, |! g  f#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
, d1 Z+ L& V& e9 Y* ?, l#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
7 d' S' Q# r; a7 {9 l( \; [4 q! X3 _
  u. w! ]  r) Y/* assign the tl som board LED-GPIOs*/' K9 }  f5 q: m1 `
static const short da850_evm_tl_user_led_pins[] = {
- c% @8 H: O7 |. e        /* These pins are definition at <mach/mux.h> file */
: E, \7 x4 e! f4 y" J        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
" S2 K$ g5 k1 q# ^* a        -11 _  Y! s% S) B3 l
};5 X! \. o) q$ D9 L- r0 ?' y) j
; E* D2 S! b  `( d8 `
static struct gpio_led da850_evm_tl_leds[] = {6 }2 R% L' h. j/ y0 e7 J$ T
        {! P5 O9 [2 Y( Y$ H* f+ j5 i$ L0 v9 b- W$ h& m
                .active_low = 0,
: K  K+ ?  a* {8 ?( x$ {) F+ v                .gpio = DA850_USER_LED0,& T& F$ _; c9 f# p, }
                .name = "user_led0",; E# V+ g7 W! u( N, w7 d  A& N) v
                .default_trigger = "default-on",9 `( n& e( y# F1 Q( a' |* @+ s
        },* o% Q" J# t% e
        {
- F- s. x& [! p( ?                .active_low = 0,. `  z0 H1 ^! C, c9 r
                .gpio = DA850_USER_LED1,! n* A* j5 ?) ^' n
                .name = "user_led1",8 ^" @' }' g7 X$ `
                .default_trigger = "default-on",3 g$ w) ]6 {/ A; `& B, {, i
        },
" t1 Z7 I+ T% l7 W9 Z5 n8 q4 M, V/ Z        {
  Y6 |  B0 O& N4 G                .active_low = 0,$ ~4 x, `* O; `+ \' v
                .gpio = DA850_USER_LED2,+ }" Z9 J& i) O4 }
                .name = "user_led2",
3 z7 w$ ]6 w: X/ l% H                .default_trigger = "default-on",
( @! [( e: ~) O. K        },
$ q1 k# R) ^3 M/ h4 i        {/ T. Y, C/ L; v- R. J5 @
                .active_low = 0,6 g- C4 Y& H3 @1 M2 \1 c
                .gpio = DA850_USER_LED3,
& _3 ?2 d5 P& b+ X% Q/ w$ h# R                .name = "user_led3",
; t3 f! V  Y2 h& y7 O% q4 j3 Y                .default_trigger = "default-on",* x2 a8 y6 f9 ^) g4 Z8 x+ E, \
        },
' f$ I$ S% S. U- p};
( c" ?; t# p* ?4 g
* s, D+ \! G* ?9 r9 Hstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
4 l9 ~7 E2 _3 T2 z2 l        .leds = da850_evm_tl_leds,
& k1 U4 D( }% d$ Q        .num_leds = ARRAY_SIZE(da850_evm_tl_leds)," J% [' U2 ^% ~5 g4 ~
};  Y, _) L1 X( t/ M
' Z4 p# C' l: b* E3 Y$ y- Y/ R
static void led_dev_release(struct device *dev)
2 L# {  u/ y  L  `" H{
* ~: z0 o& C5 d};
5 H" j" X! i1 ^4 W; p1 e" G5 O. h- i( r% @
static struct platform_device da850_evm_tl_leds_device = {
2 |4 ~" H; B+ U1 p        .name                = "leds-gpio",' i: R5 q3 h$ L
        .id                = 1,, y, R! t7 Q' u, n
        .dev = {9 }& H4 _; y7 M3 j+ ]2 R! M
                .platform_data = &da850_evm_tl_leds_pdata,
0 ~$ J/ ~3 J9 I; ?9 e% j; L  `                .release = led_dev_release,+ W$ |7 \& K! Z
        }5 `% q) F6 \, n$ z/ N# W* V( G
};
, ?1 h) D, f% \, h* i2 [8 y; {5 g3 V
static int __init led_platform_init(void)3 ^$ a6 g9 m" ]0 f
{1 }+ I% C/ p, x4 |
        int ret;5 X2 `8 T5 Z# y9 k# a0 L  L4 a
#if 0
  Z7 g) @  I, Q6 R        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);4 f: U/ `4 t1 q8 @0 c& K; L
        if (ret)
3 N" a7 o/ t& E3 h1 S# z' v, T' D                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"& n/ w( S$ P& Q: V) L* \6 e
                                "%d\n", ret);
# Z) Q& e$ @# z. Z7 p2 N#endif
" k8 T8 L; t$ C7 K  O        ret = platform_device_register(&da850_evm_tl_leds_device);7 Z1 {" G% z0 R( l* }$ \
        if (ret)' E$ ~1 ], s# h) ?" ^) R2 v/ D
                pr_warning("Could not register som GPIO expander LEDS");& }/ E  g/ O* w4 w1 d
        else) b1 ?3 d! O0 Q" N. {0 A; _; f4 `3 Y
                printk(KERN_INFO "LED register sucessful!\n");
: g* a& B6 C4 L
! B' ^# R; `4 r" K5 ]3 r2 w        return ret;) P( Y3 b- w- `$ B0 p7 h; k
}
7 B5 S7 o8 i  Z; r: a; J) J: P
& ?/ Z# n) v/ M% [; c" }* g% jstatic void __exit led_platform_exit(void)
* P% m9 E$ \5 ^; V5 W0 x+ ]{7 v0 N5 o! Z. d, C: U+ w( Z+ H
        platform_device_unregister(&da850_evm_tl_leds_device);
+ T. R" U( C# Q, p+ A9 g' f: c3 A$ ~' V9 o
        printk(KERN_INFO "LED unregister!\n");5 y! T* b- B: V# I  x
}
7 R) s) v- |; O5 x5 D1 v  e
2 m9 B% J2 |) h5 cmodule_init(led_platform_init);
" v9 ]* r8 H. x" R2 E- cmodule_exit(led_platform_exit);
  |8 ?/ v% ]# V, _2 G% t0 b+ n, ^) y+ ^& o' N( V
MODULE_DESCRIPTION("Led platform driver");- v" n  `  D& B# U. t! S
MODULE_AUTHOR("Tronlong");
( r8 }  H+ ^* h. \, oMODULE_LICENSE("GPL");
% L/ K5 `! D/ z# a1 y* d+ @- W, Y: X5 y& _. z& Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 15:49 , Processed in 0.040666 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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