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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
4 a5 v! R1 `) p+ J0 P#include <linux/init.h>
2 c& z, K- T) P) z! o+ R#include <linux/module.h>
2 g! M6 P" f1 v#include <linux/kernel.h>
7 a1 N/ e/ U2 Z( q: F% u#include <linux/types.h>* M5 ]% s, n  S0 {9 i1 ?
#include <linux/gpio.h>1 h3 ~1 S9 i. q$ K7 V0 i
#include <linux/leds.h>
3 c' F: B4 k7 \) ~* n( A- z) m  B8 v#include <linux/platform_device.h>
' x' m& X) i5 k% r9 n' o' d1 X2 O, [8 m: A6 K8 f9 O) c% h
#include <asm/mach-types.h>( y% Y4 a4 D* a3 {0 U9 {3 D; r
#include <asm/mach/arch.h>
7 g. N( j5 v: c/ g) U: F#include <mach/da8xx.h>
4 W9 K+ r6 v& q# p) ^#include <mach/mux.h>
! D* Y2 k3 X# g3 y
0 Y# g0 P; q2 H2 s8 ?4 V$ e" e- g. P#define DA850_USER_LED0        GPIO_TO_PIN(0, 0): f" v# N9 D$ }
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)* v8 \- e+ L' h6 k
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1). f! ^$ s9 S6 e& J
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
! n/ \9 [5 l5 h3 O: _$ q3 {3 _& U! O! v8 {2 ~1 I
/* assign the tl som board LED-GPIOs*/
; j( Z9 O( M5 I9 }  Y0 Bstatic const short da850_evm_tl_user_led_pins[] = {8 C8 ~# A8 Z3 M5 V8 H
        /* These pins are definition at <mach/mux.h> file */3 K7 c4 J" T, R  H
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,6 v8 h, {$ r4 a( W7 a' l: e
        -1
6 d* e; @/ e( ?3 Y8 I0 d};) W' s) l% t! c' Q0 o

% R) F, z; x, [: D2 J$ b$ Z3 ?static struct gpio_led da850_evm_tl_leds[] = {4 }0 t! b2 m& {4 G; ]
        {
) ?' v3 j. o( z6 d/ C! g" H4 n& S                .active_low = 0,  v2 c  ^7 {3 r. S  R
                .gpio = DA850_USER_LED0,
9 f; F& D4 W: b% b* G                .name = "user_led0"," h4 c6 s) y: J# R$ r2 z
                .default_trigger = "default-on",' U- y& M; e6 v* C) D' A
        },
2 R. x  r: P$ i        {
8 @- u5 M* o7 L0 @                .active_low = 0,+ B# X1 @( D6 I% r6 x
                .gpio = DA850_USER_LED1,, @8 q! l1 ^8 o
                .name = "user_led1",
% \  a1 c$ K& j& ^                .default_trigger = "default-on",
( s, B% j' P3 S* D# _4 u' R# F* o        },
' w. V5 D* C4 `" W& w% S2 V        {2 t, v) A/ s+ _7 Z  A5 Q
                .active_low = 0,
9 ~6 E1 O) |* I; W. Z6 \) s                .gpio = DA850_USER_LED2,9 A, K4 O8 i% q: n# w+ S: P: i
                .name = "user_led2",
4 l2 H7 [3 i' J& A# }$ d                .default_trigger = "default-on",7 m% r2 d' i) s% t7 z5 P
        },: @: t5 Y# i0 D
        {0 u# o; C: W0 c/ x8 b
                .active_low = 0,
$ |2 u% \/ B9 d                .gpio = DA850_USER_LED3,
1 x' f* U9 ?: H( T8 {                .name = "user_led3",
- e: }0 m( W. P                .default_trigger = "default-on",7 N* h  F' p1 {3 Q7 ?, Y
        },7 F# Z/ |+ H% Q# w) g$ P; b9 Z8 z
};# X( }# M$ I( g9 w9 q
& b- r4 `" h6 s7 B0 a5 `) N# B; }
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
+ _" _6 l6 U6 e" x$ P2 ]5 _        .leds = da850_evm_tl_leds,8 V9 t8 Q9 Q3 q" r( O: \
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),/ ]% L% y- ?! Y% T
};
- A+ ]+ s! M. k" n$ q* {+ }* V8 C
static void led_dev_release(struct device *dev)- k% Z. U! Z/ |
{
, u% U8 R' M" l};, e3 `% u4 Z6 z- W# j5 [1 [

, F  a% z" ]# I! J; M( H* x/ D0 cstatic struct platform_device da850_evm_tl_leds_device = {
6 V8 E* k4 j$ U! }$ `1 U        .name                = "leds-gpio",
2 Q' m" g) f% E+ I        .id                = 1,) M7 \6 W0 q( e
        .dev = {
! T4 f' }' C4 b& G5 k                .platform_data = &da850_evm_tl_leds_pdata,
8 M6 p& F9 E5 @' i2 i, H                .release = led_dev_release,9 c" M4 H4 m: Y! c) \, N
        }. m% B% ?# r2 r0 J( ~( w' r
};7 v) i0 u; W5 B/ {' L, S

1 M$ e% G& P7 l; T" Z: d6 nstatic int __init led_platform_init(void)% A) r, D2 p: O, k- _! |0 }* P
{/ s' S4 k1 [# A5 F8 e$ M. t3 E
        int ret;
9 X5 i' Y( g- w#if 0& u/ Q' K* `8 z' v7 s+ F
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
' v& h( _& i( x  H1 S8 V        if (ret)# ~7 S# ]: s) z% {/ L
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
1 W( ^8 W' L8 Q. \- V                                "%d\n", ret);
  F- v7 f- Q& F5 e#endif' }) J& F* i: }! _
        ret = platform_device_register(&da850_evm_tl_leds_device);1 l0 @6 q8 A6 X- d' y
        if (ret), x' {3 \9 t" X: R5 Q' j( w" U
                pr_warning("Could not register som GPIO expander LEDS");
: x/ j% n  J, S  X, b* U, f        else2 u$ n3 c0 t4 F8 \( V4 O
                printk(KERN_INFO "LED register sucessful!\n");9 N5 |: e: M5 p/ g7 ]' F. @

7 L! X% B  m0 l1 u4 Z        return ret;5 \+ v- y1 @6 ~5 T/ _0 j
}
: B3 |3 u) V0 Y& i2 }) G- J6 P- S. R# l+ c3 `
static void __exit led_platform_exit(void)
9 y7 n' B2 L8 U& C# G4 B% X  D{
: k+ q2 w, d8 c  @        platform_device_unregister(&da850_evm_tl_leds_device);" N# H  z7 P% X" U7 d+ W! B
1 i3 b1 o7 e" q. h% R+ N5 J
        printk(KERN_INFO "LED unregister!\n");* H$ z2 e5 Y/ q
}
2 M. E, l# x4 @3 b, E# g% r
$ T6 s7 O# z8 A' r; o% Hmodule_init(led_platform_init);
. B9 c  {6 M( q! u# K; d7 Vmodule_exit(led_platform_exit);) _- j" R8 z& B/ c# j- u7 S

7 p2 G! }3 c0 h" f- f& e7 g' PMODULE_DESCRIPTION("Led platform driver");
2 R* X- F0 p( X8 b6 d( e) OMODULE_AUTHOR("Tronlong");% x5 d( w  v0 ?2 p2 }6 n
MODULE_LICENSE("GPL");' D: c! o9 u1 C, o/ L7 v

( W& h- O6 k' e0 a+ Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 19:59 , Processed in 0.040322 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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