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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
1 G! K* T0 Z; G: r#include <linux/init.h>  w* S: a% W8 G6 d$ C! [
#include <linux/module.h>, o, ~( L$ `6 A9 v' ?0 w0 y- I/ W% Q, B6 u
#include <linux/kernel.h>
: j% t4 d( J# g* E& E/ D$ f5 R3 {#include <linux/types.h>& I( X% ~/ v1 T) @: H
#include <linux/gpio.h>6 V# C9 Y/ m4 }0 b: u5 l
#include <linux/leds.h>4 F( t; W$ j( `' ~( X
#include <linux/platform_device.h>
8 b' N3 P3 r) b7 {* i2 j) W) U0 _0 }1 T+ C5 V5 A
#include <asm/mach-types.h>; P% E: ]$ \7 G8 e3 z1 U
#include <asm/mach/arch.h>
: p" J5 t. p  _  i#include <mach/da8xx.h>
0 g9 Z2 W! z5 T" {#include <mach/mux.h>
7 I- o# V' o- Y/ u% h) h* Z& v, P' y/ Z4 p- n5 M
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0); o/ x; N7 B+ a. e7 j. S  t
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
9 t, [$ @7 b: V  g/ j#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)( U; N* Z! k0 C' O
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
0 \+ I, ~% l: d+ g
; h: l8 J0 d+ q9 r/* assign the tl som board LED-GPIOs*// Y2 X0 _. ~% ]0 K! f+ I9 L
static const short da850_evm_tl_user_led_pins[] = {
3 [) p8 F1 {7 J5 o* [9 q        /* These pins are definition at <mach/mux.h> file */" K: u: _9 q7 x9 s1 ]: ]; x
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
1 T1 k, l; [  h' e2 y( x$ @4 }8 g        -1
) ^7 L' p" V- j' e# l7 x0 n};; e: L9 x+ l; O' F; D2 Z* }/ K$ X

8 T  B8 Q5 x+ I* D3 Xstatic struct gpio_led da850_evm_tl_leds[] = {0 F- |4 x/ ?- U
        {1 S, w# Z5 M( v1 Z
                .active_low = 0,( d8 V8 A) A$ a9 K; ~
                .gpio = DA850_USER_LED0,
1 P& t4 H. Z5 D0 C/ x7 N; r                .name = "user_led0",/ K' f2 [. }! g0 Y) f
                .default_trigger = "default-on",
, Q% t' h* F. {* v0 B( w        },% `9 b  \' Y. K% U, Y
        {
& o: f) K; d- w9 m8 T! z+ Z% \- w                .active_low = 0,
' ^4 l  a' f$ I3 B                .gpio = DA850_USER_LED1,8 [7 `! p; h. _! V3 q
                .name = "user_led1",
6 f/ @1 Q7 n! l, o                .default_trigger = "default-on",3 D/ A6 ^7 k7 `2 R! J
        },
/ M: l  }9 e3 l2 ?( s. J7 b        {
; r: H( P0 f( l! C6 w2 T* T" ]: j                .active_low = 0,4 Q3 g+ @4 g) c) ]( t3 R; a
                .gpio = DA850_USER_LED2,
9 j  n$ X6 T% |" h8 |" r" K$ _2 K! t                .name = "user_led2",
: ]& D0 t  a8 s- x" |                .default_trigger = "default-on",
9 U9 Q! \8 ?* }& H        },
" }; ~& c; m' }, W. w2 x% Y* L        {
8 n# h0 l+ @0 K3 I' i7 T                .active_low = 0,
7 B4 A4 W! c# Z/ ^* B, Q                .gpio = DA850_USER_LED3,# T# [" V6 d! r0 x% t7 s) ?
                .name = "user_led3",/ T/ ]; N! C; s4 b- T! _
                .default_trigger = "default-on",' R* E& Q& F$ M. v; A5 m9 K
        },/ c) G- K) W) F$ k
};6 `1 `& n$ e' @. F

' x* G; Y. \! g1 zstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {  V  ]4 N4 x4 v* i" B1 b
        .leds = da850_evm_tl_leds,2 ]: r1 L/ {- x% Q5 [
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
' T# X- A5 y% R0 a6 }$ A7 p8 I};
. N+ }; ?5 f- W1 X' l, d3 D. q; p# T, \7 @, L3 K- Q: K" z
static void led_dev_release(struct device *dev). B' d0 D, v! G0 L- Y7 X
{6 X2 i8 o: b% K$ f3 {; I) V# h0 |
};7 ^4 a& j) {4 c) B

4 K, X* x" V! k0 q3 g9 I. Pstatic struct platform_device da850_evm_tl_leds_device = {6 e/ Q: k, Z' L# M  f
        .name                = "leds-gpio",
; \# }& t( Z- c, Z9 ]& t% \        .id                = 1,
) @# k1 ?# R+ q  R1 H        .dev = {' p  ?5 }8 }$ D% Y3 o) y
                .platform_data = &da850_evm_tl_leds_pdata,
8 K) v! T* r" K- A3 {4 T1 m7 J                .release = led_dev_release,
1 R1 [/ |. f+ q6 U; A( e        }  S0 |6 N5 U9 e! {: Q: L3 j
};$ q& n9 R, l) r9 {" d8 p1 |8 s

; ^, K+ A( {9 M5 lstatic int __init led_platform_init(void)- f5 [- N: V3 o% K/ I7 h/ l
{/ }9 K1 P" W' ^
        int ret;! u: F+ Z% r3 |/ Q
#if 0
  x' W% e1 B* L2 ~$ w$ X        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);8 r4 Q+ A8 O( r
        if (ret). i3 y0 e5 P2 x/ r4 F( ?0 ?: I7 O3 {
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :": {6 P8 z: J! u; \. f8 U1 [
                                "%d\n", ret);
: I/ i4 y# {" q  y/ a#endif( c+ z* N0 Z( g! a/ T' {
        ret = platform_device_register(&da850_evm_tl_leds_device);
& U. u& I/ H& [& H        if (ret)
6 t6 B: C) X4 H1 a' C7 H9 z- l                pr_warning("Could not register som GPIO expander LEDS");" `# _% L$ ?( r3 R) K
        else
5 p! ^& {* a7 g                printk(KERN_INFO "LED register sucessful!\n");8 k& t/ ^' C. \$ Y9 A9 Z8 ], s

( C( C) k* L9 ^( a        return ret;
3 `: Q* _/ s) I) y}
: i% [: R4 N4 a  _
- A; d! m: C5 D8 i+ S; ~& {static void __exit led_platform_exit(void)
+ o# s) P5 o& i# J% L4 R{# d* h) S/ e6 j: L
        platform_device_unregister(&da850_evm_tl_leds_device);7 Z8 T/ R2 J* Y% W3 L
& r2 H& d/ H0 X3 ~+ f/ m' }
        printk(KERN_INFO "LED unregister!\n");
6 ]( o" @$ n8 ~8 p! |: |) l- ^, k7 a}: L' [& ]: |* J" s# B

1 L; M7 q( r8 D( w% _7 Z" dmodule_init(led_platform_init);
' S0 A! J, R8 amodule_exit(led_platform_exit);
6 U7 A" i$ e1 a6 a3 C! r3 E( ?; ^) `( z. }5 ?  B% k+ k. R2 ?5 ~
MODULE_DESCRIPTION("Led platform driver");
2 c. U9 [( j" {2 z* N+ V& OMODULE_AUTHOR("Tronlong");; ~- n6 P9 p4 e  C+ @$ V/ I/ O
MODULE_LICENSE("GPL");
6 M/ K8 \$ R' ?# A2 _5 f0 w9 ^( ~9 W7 l8 X- m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 15:23 , Processed in 0.039047 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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