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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。) _8 ~' k2 [/ B6 c# D3 O
#include <linux/init.h>
" c/ ?% D  q7 Q4 o#include <linux/module.h>
2 x: X3 }& i: k5 s9 A6 ^5 b#include <linux/kernel.h>3 ]. }* v# q+ c+ E: q7 c
#include <linux/types.h>- C. R; p0 [, m- l
#include <linux/gpio.h>/ M2 O7 j4 V2 d/ x4 r
#include <linux/leds.h>
# p: p) |1 J$ u' J# c; d% Q#include <linux/platform_device.h>
$ m2 U: x. F' \) {2 t
+ Y0 V$ X9 ?: _8 Y# @. `#include <asm/mach-types.h>
4 z  b: g5 a3 F8 S4 P5 E, b% {' {#include <asm/mach/arch.h>
' N0 K( f' n5 w' ]+ e#include <mach/da8xx.h>
8 V2 e2 p* {0 X% C8 l  M& [#include <mach/mux.h>
0 Z& ?, ]) w8 O  Q, D# U7 W- `3 f- S
, _% h! U9 J8 q) x3 k  E#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
/ q9 p  n/ b! Q" _7 [/ @* C#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
; i, q* n! K" N/ h  t4 g#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
; ^/ y' e/ y' f#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)$ p. }5 \8 U. w, P8 O) b# j
5 _: O; r6 ^% z( c: z; _
/* assign the tl som board LED-GPIOs*/
7 y. Z; s0 a+ f  @% ?' c0 V+ Lstatic const short da850_evm_tl_user_led_pins[] = {
+ G1 r% m9 H0 ~& r( O: `/ m5 ^" e  U        /* These pins are definition at <mach/mux.h> file */
) ]% k' E) V; t; e9 I        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,/ o, Z$ y0 D! l, X  }4 S/ n. [
        -1
9 V. r. D8 X2 f" Z8 y9 ^* Q};
$ h6 R9 P- F0 M$ e  K9 f5 r6 {: i  W. L6 `: }
static struct gpio_led da850_evm_tl_leds[] = {8 o3 o5 |% M6 N; g3 E4 t
        {
: E' I/ z( I- x. K  e                .active_low = 0,0 F2 U$ u0 ^- S/ O
                .gpio = DA850_USER_LED0,
+ \2 R% C. U" j0 ~, Z/ o  h                .name = "user_led0",
% g0 w! v& O7 `7 D9 M                .default_trigger = "default-on",! r6 m( x3 p( m& w9 ]7 ~  c, |
        },/ w5 Y2 n  v$ C4 R- J; R" B, ]
        {
1 m2 @4 U/ o5 w7 |8 p, U' J1 L                .active_low = 0,' N9 i2 D* _- k4 O% C
                .gpio = DA850_USER_LED1,! T$ p! E( {7 I- T) _5 F; Y5 T
                .name = "user_led1",* a' _: p, v( v3 u' F/ ^3 A0 X
                .default_trigger = "default-on",
, B/ Z- V) ]" \1 w5 |. F        },9 i& z8 J, K+ H/ A- C! o
        {
6 h' j2 c. `) a" M. A                .active_low = 0,6 q4 F  g: M) G7 }, a2 D# i
                .gpio = DA850_USER_LED2,
  j1 @& U- D  I& A8 m                .name = "user_led2",
" T9 e4 T9 ^" k                .default_trigger = "default-on",8 w% P( j; q! _
        },0 I& r2 c- Z8 r
        {
! a0 G7 g7 N( E5 L# C  Z0 [                .active_low = 0,& T0 g) Z& y7 _7 S
                .gpio = DA850_USER_LED3,$ e; {: O/ e4 h: S# H$ o
                .name = "user_led3",
' @+ N# U$ T0 a0 C                .default_trigger = "default-on",* |5 d3 D2 C1 O( D; U
        },- g7 S; L0 x7 q
};! u. o: s- l7 d2 M0 |. G- Z/ U

1 r0 \, P2 F& b( u" ystatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
- \+ Z! `1 p! ~* [6 U        .leds = da850_evm_tl_leds,. T, e. K) H% C. s# L) q
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),1 w8 L: q0 W9 C; Z
};
( ?+ Q4 B- [  d1 g
2 r" _" F0 F, f% {" {, @$ {8 n( \static void led_dev_release(struct device *dev)
: B& m  f( `& H% y/ [3 g{$ H& u2 D0 p( I0 l8 T' v: U% V
};
: j# D! E  A8 t7 g- A( D
! w5 d. ]- S- y+ v; |& W, \* fstatic struct platform_device da850_evm_tl_leds_device = {
& w) G5 L: u1 L0 M0 C        .name                = "leds-gpio",
! W& u$ l7 W( b8 t        .id                = 1,+ I6 l3 K/ M3 z4 w, }
        .dev = {
% W# _1 _/ G0 `0 J                .platform_data = &da850_evm_tl_leds_pdata,
$ T7 K9 L/ N! `3 m% s/ {3 d                .release = led_dev_release,
+ E5 ^, s0 v, s  t/ W* {* E; K" m        }& P# T5 D- P0 f# J
};
+ @4 I8 ~/ P$ D- Y/ v1 a
# Y, l) O" o6 i0 T$ H4 fstatic int __init led_platform_init(void); P& b# K" ^! ?
{
- N) G  [# Q3 f5 K        int ret;
/ N$ z+ q0 c- r6 {4 `$ G#if 0
, H+ ~  l% s7 c9 r" U+ y        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
7 a7 ^: @( N/ x9 X! ]) \" d        if (ret), _( r+ x% q. [' H
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"$ b8 a& g$ z5 c  x; O3 D
                                "%d\n", ret);
8 A3 d4 M5 a8 W- d#endif: a; i% C, `% x
        ret = platform_device_register(&da850_evm_tl_leds_device);/ _. k2 f; n- q4 f+ A8 l+ p! ^9 G# ^
        if (ret)) H0 Y6 @( G; A! o
                pr_warning("Could not register som GPIO expander LEDS");
0 b1 ^- n2 O$ g7 o/ s& c& Y& f3 \2 H        else
0 C0 D. h* z; A5 N! P                printk(KERN_INFO "LED register sucessful!\n");
) X2 q4 I8 ~& z* d, y& F6 D+ a: j4 N
- P+ e/ V* n5 X* b- t) P        return ret;: k5 f8 @1 o1 M* U
}1 o2 u6 }& j$ y$ L( g0 ?' f
+ a) q/ ]' K* g  A# r
static void __exit led_platform_exit(void), E% s" e+ ]7 D, \# a: w
{8 o: v" F% @3 W
        platform_device_unregister(&da850_evm_tl_leds_device);
: p0 o% R$ W0 K; d' d+ q3 K+ Y7 l! i+ R" D5 L% L, @8 K
        printk(KERN_INFO "LED unregister!\n");
; ]9 v" C0 a! w, ^/ U}
% Y2 e( u# n$ X$ X2 ^7 ^
- H% }2 I. `0 n* C, Nmodule_init(led_platform_init);
5 C" g) d& O8 W3 v5 ?2 @6 E% kmodule_exit(led_platform_exit);2 W" S; e0 q% o( X9 W! R# i

7 A- q) V! h$ O  `MODULE_DESCRIPTION("Led platform driver");9 R& S4 X8 H7 ]4 e( y, d, C2 e9 k
MODULE_AUTHOR("Tronlong");
7 J: Z. r& r) O  o1 a5 IMODULE_LICENSE("GPL");% @/ D3 e# \% c: T5 ?9 h

9 m% ^. K8 {( z: P! T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 20:50 , Processed in 0.038652 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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