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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
/ u- N- h% [1 u0 b1 x1 s8 W5 Y#include <linux/init.h>8 Z0 |: g6 s( O
#include <linux/module.h>! {, ^+ b9 l% U0 t0 a  i" i/ q
#include <linux/kernel.h>! v+ f- s4 A1 m" z( L
#include <linux/types.h>
" E$ Z8 L" \5 X#include <linux/gpio.h>
# E5 ]! b) e! a3 c8 P- c$ n0 L% z#include <linux/leds.h>
5 m* G: U1 c6 t( y* W4 s#include <linux/platform_device.h>
3 O/ D8 w+ x! p% W! s9 Q  ^' h! K7 D) |
#include <asm/mach-types.h>; t, x& ?0 v# S+ X
#include <asm/mach/arch.h>. I. L# v) ]' ~2 v  n6 X
#include <mach/da8xx.h>4 r# c7 n9 e2 z9 N+ m1 x8 d
#include <mach/mux.h>$ I* l. F$ B8 o

# H) v$ P6 \' L; m! I6 g+ |, t( n+ t#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
! E& z; G. q8 U) ]! a5 @* t#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)& {; L0 L1 o- S3 F/ g% d
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)& h* B0 I9 Z$ U) v1 H8 ?
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)6 n. ^) D3 X1 d6 i9 ^2 _

9 H3 C7 A9 {; ?/ A4 P/* assign the tl som board LED-GPIOs*/
2 d3 l$ q" I  L/ _- Fstatic const short da850_evm_tl_user_led_pins[] = {. `8 X  ]0 m2 k0 d5 r& f
        /* These pins are definition at <mach/mux.h> file */
( \; q* S* l/ [3 g7 ?0 e) t& [        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,6 V. U% V8 x4 z; m. x0 B! w
        -17 H4 t6 A4 Y* y1 z( M  e
};
# O6 }8 `5 h8 l& |; L, W3 R
* K. x, l+ Y) H& \static struct gpio_led da850_evm_tl_leds[] = {
, h2 n; P; F' r: _        {1 |$ L8 O+ J5 a/ Q/ _1 h6 E
                .active_low = 0,
3 L% f( c( C+ C, G; F  b  T                .gpio = DA850_USER_LED0,
2 q" Q* \% V; J5 z$ c2 A                .name = "user_led0",
" ?6 K; r4 Q0 K* X  R/ y* V                .default_trigger = "default-on",# n2 e) Y% ]- ^- ~$ L/ |7 Y
        },
& l9 Q. [" D% X5 d        {
/ ?' l2 x9 |7 Y5 N3 p                .active_low = 0,
) B+ g9 ?. s, I9 k; E& ]  B* W                .gpio = DA850_USER_LED1,
" Z  y( F, p3 T$ }                .name = "user_led1",
( f6 N  n* @9 C$ S' S, A  [5 ~1 U& s                .default_trigger = "default-on",- l3 D- T. H9 l" B( w; s2 K
        },: W, {# ?9 G5 w9 K. i* G! F
        {0 }% R1 m0 R# ~! D+ o& b$ i+ @& ^
                .active_low = 0,
: ^/ e) H, n  f3 @- i" r                .gpio = DA850_USER_LED2,; e. A- N* m' l$ M9 O2 }5 ]* N
                .name = "user_led2",
1 |' F. U  S* O                .default_trigger = "default-on",: J$ |7 k( `6 I, E* J
        },+ D# q) H0 I. X- I% w4 u1 z- f+ y
        {
- M# P) \" [; W$ _1 G                .active_low = 0," a7 b+ p8 U  f8 i+ O
                .gpio = DA850_USER_LED3,
$ t) z& P- P  _) L" ~$ J                .name = "user_led3",7 m) B7 N* D: K  h& L2 I
                .default_trigger = "default-on",7 Q% p) t; v7 A" I
        },; V9 Z2 R8 M0 S; w: D
};
4 [6 Z5 d) y: E, `8 G) ^4 f% O3 i7 j& d! w  y
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {" o0 F, N2 I9 r4 Z' x& w# g
        .leds = da850_evm_tl_leds,4 L% v3 K8 `2 G3 Q9 l3 B
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),) Y. I  l; Y* ^  e. J
};' ~; j7 `' \# q3 R  f

! U0 m$ X1 j5 q/ @6 n7 G+ Ystatic void led_dev_release(struct device *dev). ?0 v# M; ~7 |  k# }3 M) ?
{% Q& V1 d# h. n, ~% t
};2 N% `! z; f" ?5 S

0 i+ m+ A- l  y7 Fstatic struct platform_device da850_evm_tl_leds_device = {6 Y2 J  [7 L3 U4 l6 v$ @) N  d
        .name                = "leds-gpio",3 y) _& A/ `1 U/ L0 ]( i
        .id                = 1,
0 G2 f6 U. O- a0 C; p, f        .dev = {
, \0 T3 M0 N! `8 K2 b1 g                .platform_data = &da850_evm_tl_leds_pdata,
- ~3 J% x/ P5 }0 g' v# `; ?: u                .release = led_dev_release,# E7 t+ h% Y7 A2 _4 Z4 t6 u! s
        }
3 K  s6 v+ A* C; m# w};
/ t6 I3 b3 N' r% U& ~/ F7 X
% U& z' q. l' j: X0 C8 A9 A& {& `static int __init led_platform_init(void)
9 H$ L& a9 H$ s* L- w9 V{/ {  [; R$ v% y7 S' I
        int ret;* c# o6 l& y. v+ Z! r( Q/ C( y6 X
#if 0
& ^) n4 i& o1 n; Q. y  r        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);) {7 f- L( T+ N3 D
        if (ret): i7 W' ~) d  u8 W
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"- y" _& o2 q3 G
                                "%d\n", ret);
2 z8 f0 P! `% C5 |#endif
: C( [& [8 M- {+ P0 e& u" v" r        ret = platform_device_register(&da850_evm_tl_leds_device);
1 J. B/ p7 F8 u) p! z" `, x5 I# p        if (ret)
8 P3 A' ~# _# A                pr_warning("Could not register som GPIO expander LEDS");
0 k! O+ t) h5 \% ^' @3 m; a: X        else* f, }9 n$ A9 q( W0 Z
                printk(KERN_INFO "LED register sucessful!\n");
& P: `* ?5 f- g6 N6 C" L" T
' h' \$ ~0 i) q9 b% m        return ret;! |- B8 \0 u3 H, o2 K6 K
}* S1 ~2 `9 y/ Q: O- `
$ q6 y' [# Z6 t! M
static void __exit led_platform_exit(void)
  V# L$ s6 b1 Y3 R1 V: @8 e! W6 t{
/ z' V' t0 Z+ {: g- {        platform_device_unregister(&da850_evm_tl_leds_device);% l5 c; ~& X3 Y8 \" p

( T6 j- T8 F3 R7 K' l* Y        printk(KERN_INFO "LED unregister!\n");7 l) ]& l7 P$ l0 }  J: g
}' `, k9 [2 e( m- \' H

9 g; D- R5 B+ M; [. amodule_init(led_platform_init);- D+ d$ @9 e; H, f; ^
module_exit(led_platform_exit);
# |" q1 b+ }) C( {. k3 x) ]5 b9 n- R. D; \3 g* q# z
MODULE_DESCRIPTION("Led platform driver");; x0 G& S; }2 l5 Q( t
MODULE_AUTHOR("Tronlong");
+ L7 ?1 w$ M! n# C9 {7 \, s- lMODULE_LICENSE("GPL");
- [) c9 A0 p- l- }
* R. |+ F3 [/ j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 13:13 , Processed in 0.040806 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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