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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
1 ]  d, O3 ~1 ?. O( D8 T#include <linux/init.h>+ {! C) T( _2 X" b
#include <linux/module.h>
' O1 i9 X7 f; @) \7 s#include <linux/kernel.h>+ @, g$ }8 g$ l; t5 h
#include <linux/types.h>
6 O& s" b4 i! ^# S. E( @' p4 e#include <linux/gpio.h>" w- I, y# i7 `, T6 K/ s1 F$ D: J
#include <linux/leds.h>
! v6 G* Q) m+ \#include <linux/platform_device.h>
& w7 F. T" h$ [# s
' M, I6 {4 L  G& {1 U#include <asm/mach-types.h>1 _- t; x. p  x$ Z! b, ?
#include <asm/mach/arch.h>1 Z2 b6 e+ A$ C7 N$ V9 I3 [
#include <mach/da8xx.h>
1 S% H6 d+ E% w* y" b+ J& \#include <mach/mux.h>1 o" w- s# m. r- y) o

" Y! N. ~$ Y/ s4 P#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)' L1 K7 v/ {3 P7 t# N$ h% E6 j
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
  T& k- Z4 V" j+ M0 k#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
$ r5 i  ^0 S4 ^" x0 X( ?#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
  I' c( B( ?9 N- {$ B3 D% c& k8 P) G3 J1 i
/* assign the tl som board LED-GPIOs*/
" r' n1 g' t4 T, {static const short da850_evm_tl_user_led_pins[] = {
- ^# [  Y8 B" l3 g( B        /* These pins are definition at <mach/mux.h> file */
- W) t' ~) W$ N: @  t        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
7 D! i6 D3 x! F9 p% P        -1
) `" b0 t" e% Q; S};
& O# X4 \8 b2 O
9 C! Q/ S9 y& S1 {  Fstatic struct gpio_led da850_evm_tl_leds[] = {$ l. c0 J8 k: P# S3 p! D# J# r
        {
8 ~) D' a( D$ N( o0 U2 l                .active_low = 0,
/ b" j1 L1 [) N  P- A9 g                .gpio = DA850_USER_LED0,0 w5 A$ W- e) q$ ]1 i0 V
                .name = "user_led0",( w# |3 X2 X$ m6 T! {* v3 \
                .default_trigger = "default-on",
% T. ]' u" s9 j& X9 m        },( ]( q8 y+ g. e+ e3 V; Q' O
        {
6 Z2 G( E! w( t. k7 p                .active_low = 0,
" h6 Z* f8 Y; U' P  n                .gpio = DA850_USER_LED1,# ^1 R4 ?( Z/ d4 ~, _) @
                .name = "user_led1",  v: b0 k1 K$ e( `! N
                .default_trigger = "default-on",
7 z! z, o" t" j0 g* k, f        },, i* v9 _5 X2 A' ]6 \2 `# W
        {+ N$ q, Y( I9 f& X. g
                .active_low = 0,
' N8 M. G6 s, A$ |9 Z0 U                .gpio = DA850_USER_LED2,
: v8 d( O( L3 D$ m, G                .name = "user_led2",
: K/ U! B1 ]; M2 T$ b5 N; w' f, N% K                .default_trigger = "default-on",2 G9 U# D. U$ @/ ^
        },
( `" ^8 |0 k0 G! d1 V: Y        {
: J. \, c0 u5 b! z                .active_low = 0,
' ]5 c9 R4 x: Y6 h' C( f6 ?                .gpio = DA850_USER_LED3,7 P- k" S4 P3 ~- U
                .name = "user_led3",
7 A9 @4 S" B# g; a! @  a                .default_trigger = "default-on",( f) e) D+ n' _
        },% u2 o# Q# E4 ?- u: ?' s
};
# b# d/ w; g  I: w1 `3 _% Q. w
5 V0 C4 P/ O, ~2 j' Y; K( P  bstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
6 N+ ]3 ?6 t4 _; Q% N4 |/ t        .leds = da850_evm_tl_leds,
8 i2 {( p9 ?* \" c5 `        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),8 A8 U" Y7 |  m8 D' J
};" O3 m& u% z. Z6 l  G

3 K( w+ d3 M, p3 zstatic void led_dev_release(struct device *dev)8 F2 |2 x$ k* F9 w& s$ X
{
) Z& [9 s: N0 L1 A' W/ R2 w: k};
1 Z0 g+ ?+ |+ T$ k
4 o/ t2 P3 i8 Y7 r5 ^static struct platform_device da850_evm_tl_leds_device = {
& B3 l. ^( s& W; W        .name                = "leds-gpio",
7 Y( Y* A8 U3 M2 N# ?        .id                = 1,2 i* i& x! o' \) {5 N+ D8 U( G/ Y
        .dev = {
$ K$ F# W. |( J1 R- J! a9 \/ y                .platform_data = &da850_evm_tl_leds_pdata,3 p1 [+ \2 O, b
                .release = led_dev_release,
% d8 y; N, M0 M2 q1 T8 z$ ?/ Y) e        }
* C/ V# N1 ?& }9 @};
7 ~7 Q# r& Q& S$ M, J* c4 G/ x  \
  f! G6 |3 ]$ n. h; k* `static int __init led_platform_init(void)
/ R  J' N; i( A& S" X1 _{5 E0 _9 P" _5 y; U
        int ret;# ^2 G4 F9 `5 v* o8 t
#if 00 Q4 t) \0 n# C5 Y! y1 c
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);* B; n: h& `' [; \9 ?1 ]
        if (ret)& S# j8 D! l* s: {5 F& Z2 @6 W% ]
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
7 l9 }3 \& r8 R: M, L( e* \                                "%d\n", ret);2 _0 U4 Z( \/ g, s6 Q3 |7 ]
#endif
, _2 G/ p- V/ h6 n& T3 g; U        ret = platform_device_register(&da850_evm_tl_leds_device);* B: C( D! m* n5 T( H
        if (ret)
' `6 ^# S4 B. H/ B$ a                pr_warning("Could not register som GPIO expander LEDS");
- N+ g$ D3 _6 }5 N# C        else: M/ n7 z( b2 p7 b
                printk(KERN_INFO "LED register sucessful!\n");" l/ }/ c- F/ ?

9 h* d- x* Q, x+ f6 {- e        return ret;2 ]( k6 y  b9 u+ M5 q8 k
}
1 I- w1 x! M- h- D9 q3 b% I
5 L8 z1 Z6 o8 [: ~( Ostatic void __exit led_platform_exit(void)
) E0 V1 S9 {( _& e: I{8 q- _3 h/ C; T; ~
        platform_device_unregister(&da850_evm_tl_leds_device);  t' A# F) P- `! L$ V

5 Q5 |' ~/ m- Q9 Q- q9 `$ B# H        printk(KERN_INFO "LED unregister!\n");: l2 h. y$ T: p/ s" M
}) W& F( _; Q2 |( i! V" n) d

; U6 {  n/ ]; _; cmodule_init(led_platform_init);
4 ^, \6 ~9 s; ]' X/ ^module_exit(led_platform_exit);) ~( h0 H$ ^- x( m( ~6 i- X" Z
% [* c; c( k5 {/ F6 I& P% l/ X
MODULE_DESCRIPTION("Led platform driver");1 h9 a0 Y- ^7 P1 r$ n
MODULE_AUTHOR("Tronlong");
( e. r) I$ ]8 j/ f0 [) SMODULE_LICENSE("GPL");' K. a) a8 H% y! o! t' g: w

6 o% d. l* b$ x" x. U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 19:23 , Processed in 0.044270 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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