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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
4 E) M% ]* R$ {( |) K7 d#include <linux/init.h>9 ]/ q4 n% d% L. _
#include <linux/module.h>  M# b/ O4 ~8 s2 o% ~( n
#include <linux/kernel.h>3 E; E" N. @4 Y2 b
#include <linux/types.h>5 Q3 ?  v/ ?! D
#include <linux/gpio.h>% s0 C! U& i& I+ b* r
#include <linux/leds.h>0 E/ @. r- L- }  T3 B
#include <linux/platform_device.h>; \- B' m4 V/ o) u
7 r, ^" w2 f5 Q6 D3 @; q# q: S: E
#include <asm/mach-types.h>
+ I$ B0 I" A: l/ g# b& q' x#include <asm/mach/arch.h>
$ X& H# P/ w; g, h#include <mach/da8xx.h>  {5 P1 I& I, T
#include <mach/mux.h>' a8 ~# a# m) k0 Q3 Z: [

3 N% e6 u( [7 E7 h- c- \7 D#define DA850_USER_LED0        GPIO_TO_PIN(0, 0), B! t* b- v! a; a3 K% m" l, F
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)& d! S* [( l! B! J$ g
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)& l* L! |- x6 _# G, g% X8 L
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)/ Q) ^4 V3 k8 N! [, U: Y

* {" o- ?* c. k& u' q/* assign the tl som board LED-GPIOs*// K% A# E& A% P( I6 c/ \
static const short da850_evm_tl_user_led_pins[] = {, i, `3 y8 Q% \9 h3 p
        /* These pins are definition at <mach/mux.h> file */  k- I% b! N3 [& Y" z
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,, C0 \4 }% q3 B( \7 a2 R5 \
        -1: Q9 g. O/ A, L
};
4 c; M, u. c' f
* z% {+ J& u3 @+ L8 hstatic struct gpio_led da850_evm_tl_leds[] = {
- Q6 ~! M( {0 w' ^, T        {
, Q7 G  ]( d1 D, C9 X, w                .active_low = 0,3 C. X- c. \! S9 o
                .gpio = DA850_USER_LED0,8 |2 l% m( \9 M. C
                .name = "user_led0",
0 ?( V6 \3 `+ P9 L                .default_trigger = "default-on",
$ I1 R4 }+ l! b8 ^& ]        },
% o0 Q+ U& A) ], L6 P        {7 ]' e# i$ D: y  p; e( Z( k, ?
                .active_low = 0,
5 j* q, S* `/ D& U                .gpio = DA850_USER_LED1,, P9 B  _9 r/ {  X( z! Z. D. {
                .name = "user_led1",3 L# ?' R1 x5 x1 z# l! n
                .default_trigger = "default-on",( y1 M$ B: {+ B4 d
        },7 s& T# H8 U" a* `) q/ A
        {: J" t! I$ m5 d: p/ l, K; |$ w
                .active_low = 0,
, R4 ]: \; J" q6 ~- `" D% ~$ _                .gpio = DA850_USER_LED2,
+ u. P5 E5 i# T0 A- c6 `( B) E                .name = "user_led2",6 r( N0 s5 B# S# Y0 ]
                .default_trigger = "default-on",
' a3 w' d: \/ _0 E( I  a        },# v- Z0 {' ?0 B) U
        {
% ?  `: h6 x1 t( Y! ~- l- T8 g                .active_low = 0,: j" `) _; b' Q" R0 [
                .gpio = DA850_USER_LED3,; ^% i/ R$ n# y) `' I+ H. R
                .name = "user_led3",1 Y2 ~. j* y3 H2 ?% j' K2 D
                .default_trigger = "default-on",1 J. {; M$ e2 L. Q! }& S5 k/ P9 B# a
        },+ K! n5 n% Y$ y% f6 A. x
};
0 l- p1 Z7 |7 a0 `! |: P. t( V2 w6 d5 d0 b8 f
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
: V* B" I9 ]' u$ J% t% Q, N" a        .leds = da850_evm_tl_leds,1 E$ U# S! _) Z; `* N# b2 ^/ k0 F
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),  t3 v( v' N. s( g% p
};! v; g# z/ {* \/ i+ m( p

( t! |& j2 e/ A  y! Istatic void led_dev_release(struct device *dev)8 F0 y1 A7 k& X- N7 P
{
2 R' ]7 j& f2 ?! X8 p% _};$ V6 b1 }7 {, D' `3 a

2 K4 X3 E9 y0 [  ?0 u# Z/ D: jstatic struct platform_device da850_evm_tl_leds_device = {& ^8 @. U* X+ R" B
        .name                = "leds-gpio",
% e  I) y, o8 f        .id                = 1,( B3 {% H: L$ ?6 k, x6 p4 |
        .dev = {
- h8 l, t$ ~! t6 [, W2 k                .platform_data = &da850_evm_tl_leds_pdata,
$ E% ^: N1 K/ ]- N6 J                .release = led_dev_release,
& M/ f( V' C5 \6 _+ V        }
8 l# a$ Z# E% J' N. H0 B; f};& X. |, a6 _' Q

+ t5 |: u$ P0 Y# a1 P  Tstatic int __init led_platform_init(void)
0 w( `7 ^- {7 U9 V8 f8 @{# ~6 y+ z2 |6 Y. P0 F6 R
        int ret;. {( Q: y3 ~6 s* r( d- j. F6 D
#if 0  G8 K1 H9 Z0 A1 h
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);' f4 ~; T6 e7 X4 P9 G3 F% w# r8 A
        if (ret)0 N) v' y% J0 L% L: f( c
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"3 a. j3 ^; \3 n
                                "%d\n", ret);1 p( d# ^- h/ J5 ?
#endif
8 I2 }/ i0 U8 I9 B2 i4 P4 s7 D        ret = platform_device_register(&da850_evm_tl_leds_device);
1 |2 X3 q5 j6 O' z0 p, {        if (ret)+ ?0 \2 Q1 Y( H
                pr_warning("Could not register som GPIO expander LEDS");
; q! p: G: B7 G+ C6 V        else
5 a3 k1 G( F/ \+ j6 G9 Y                printk(KERN_INFO "LED register sucessful!\n");
/ ]- S1 H9 I- @0 @& c3 l/ S/ f; I7 B, I/ x& X- q
        return ret;" ^: h) a  S- p+ I3 M% P
}( n& n5 o" M  H  ~4 `4 |  w
/ S+ T: J* ?* N! R# L* i
static void __exit led_platform_exit(void)
+ z1 Z( [5 m  S, L9 o{
" ~! x( ?/ X3 B3 m        platform_device_unregister(&da850_evm_tl_leds_device);
8 R2 c2 Y; d' m; {+ D% F  K4 ^
! p8 P% u: e( G& w        printk(KERN_INFO "LED unregister!\n");
. h9 y% `) f, D+ B2 O& t}
; n$ J+ T9 C0 `9 m8 a' ~2 Q6 X$ v( ~! m
module_init(led_platform_init);) w. {- N. _# W$ z
module_exit(led_platform_exit);
# b' d- T3 i3 _& v/ C- Y; t! n
MODULE_DESCRIPTION("Led platform driver");
9 ~$ }6 O! V: @! I6 SMODULE_AUTHOR("Tronlong");
/ X  m7 I; [9 u& u+ dMODULE_LICENSE("GPL");
' i& x/ N* l# L2 Y+ q! L6 {+ O/ q6 r- h8 X/ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 01:26 , Processed in 0.039909 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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