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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。; v( ^( c, a. E, w4 N# {7 R
#include <linux/init.h>% I- K8 D: C( J* X5 F* g" ^0 E) D2 ]! u
#include <linux/module.h>
5 ^0 ^% t3 c. C  W4 M% R#include <linux/kernel.h>- `% W8 U' W+ ]5 l( |4 d
#include <linux/types.h>& ]- p) K4 r3 v6 |$ A" ~/ L& b
#include <linux/gpio.h>5 a* `/ W! s7 h# A2 W) {
#include <linux/leds.h>2 ?- N% V! J6 M0 K9 F  h3 c
#include <linux/platform_device.h>
' J. ]5 ]$ }* w, x8 l  }
" L6 X& y3 N' y6 ]8 ]#include <asm/mach-types.h>
& W! H; l4 O+ p; ]#include <asm/mach/arch.h>
, g( Q, A: l8 T) |) n#include <mach/da8xx.h>2 j" P& b$ ]# F, u
#include <mach/mux.h>6 K( P- Q1 [) H' ]- b) w! Y, K
5 m' c, R# F# L& b
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)0 J  }! a( ]( i2 A6 U
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
" y' m' d8 y# k" g/ x  w#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
1 t" c. @$ Q9 t6 }#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
  n' _( g- V9 O- N. t
1 V3 T. q9 Z4 i8 R% {2 S, j/ G/* assign the tl som board LED-GPIOs*/) m2 T; r* Z. Z5 E4 B$ r! V' S
static const short da850_evm_tl_user_led_pins[] = {6 {6 J: S# r2 m1 K; G
        /* These pins are definition at <mach/mux.h> file */# N( b  |8 E& Y! k) c( K$ ]6 ?; y
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,8 W' \. z2 g. K7 D
        -1
3 s% x* t; n- D};, A: u' s1 z8 D) e+ h4 e
3 k( A, q  `( g) {# e  s
static struct gpio_led da850_evm_tl_leds[] = {
0 f* U* }, O! o7 N        {9 |0 y0 C' Y+ O9 r2 {9 V) o
                .active_low = 0,
3 Y/ j6 [. |* Z# y+ U                .gpio = DA850_USER_LED0,
/ {, o( @1 Z# v, N% F                .name = "user_led0",! c1 F9 P( F1 r: S8 I/ X
                .default_trigger = "default-on",) S, C. h" K! @+ t6 A
        },
% x, }3 T0 n3 |7 k        {: _+ h& L, i- k' S# q, K
                .active_low = 0,
- c+ j5 {% e# V" r; A$ M                .gpio = DA850_USER_LED1,' u- N3 h) O. z4 ]0 g1 W' |& K
                .name = "user_led1",
! w+ @9 q6 ?. V. g7 G6 d                .default_trigger = "default-on",# e; n( O+ S- A6 k1 R
        },
$ x3 F4 }; h/ \3 t$ d$ S% J0 J        {' ~8 v1 l1 m& m1 |0 V( [8 G! e& ?
                .active_low = 0,
9 k$ j% j! _* T- S                .gpio = DA850_USER_LED2,4 U: p& ^; u+ a
                .name = "user_led2"," I7 K3 N6 z, H3 C! ~
                .default_trigger = "default-on",- i3 I( L: m3 o% M" Z% G
        },2 k# e9 U7 n6 w) {8 A' T" U+ [  B
        {
! A( k9 c; |4 @                .active_low = 0,+ q: r. b, f, x4 f
                .gpio = DA850_USER_LED3,
2 j. H+ M* j# j, U+ ]/ W2 x. s$ {                .name = "user_led3",
+ j: v" \& {3 _4 h                .default_trigger = "default-on",
% |$ X9 N4 A- Q; j/ l+ C4 G' Q+ X" y        },
! g/ E+ }& A, s0 y};
) J3 ]6 Z% D, A) M2 x, ^6 F2 K8 x! ]4 @; y  V( l
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {4 {- n  V$ D9 V* E$ R- Z
        .leds = da850_evm_tl_leds,
. O) n2 k5 a  w4 P        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
& a; k. b. ?7 D( A0 B* @2 y};1 a- r0 |; C; z; g0 G/ ~

8 S5 j. m' P) e# B3 ystatic void led_dev_release(struct device *dev)
  w7 ]/ M3 ~  o. i2 D* W4 `{
! _, A3 |, V% O# _' M9 R};
; p1 b( z6 F  \6 {! R0 |; ?; }- O6 {" ^- v9 t
static struct platform_device da850_evm_tl_leds_device = {
6 l) E. @$ v* @% ?' \        .name                = "leds-gpio",! [6 D- a. o" H8 q
        .id                = 1,
( J% s' b; C- f: r        .dev = {
9 _4 X+ s1 T1 V! J& {                .platform_data = &da850_evm_tl_leds_pdata,
( Y0 W$ B, v1 S6 |; d* v' ?                .release = led_dev_release,
- A/ [2 O# _3 i1 `        }
9 F' ~4 V& V& `8 l7 g/ Z. P& [};! E3 P8 c" R6 j
9 N, z  n* ?& t: j
static int __init led_platform_init(void)
+ [8 N( ?; |4 ~, w{" B0 _' `: |8 ^$ s4 U0 m9 i- l
        int ret;( N: l4 O# p8 |* I
#if 0* T, U7 o2 j2 B& F2 |* F! F( Z
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
& U5 W5 E* H% r1 C        if (ret)/ e% b9 g, u& U
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"' Y) s9 S2 ^! S  ^
                                "%d\n", ret);
" i. y( A+ \6 M, t) o1 G#endif
+ L( r3 [, D0 A8 Q! p        ret = platform_device_register(&da850_evm_tl_leds_device);
( l  M5 [( S  }" {  O& U        if (ret)
, }' r7 l8 |. [  B* [/ V3 Y                pr_warning("Could not register som GPIO expander LEDS");
0 A, I7 @  E& e+ X5 S3 @; I9 l/ y        else! e2 O! x9 [* `3 @
                printk(KERN_INFO "LED register sucessful!\n");
3 Z( f+ T8 Z: V
/ i, Y6 f* A, z; H0 {4 s( K        return ret;% `) s1 G1 d4 B1 R- d$ L1 Y
}2 j. W5 b' H) N( k- e% [* G5 h; W, @
% w6 b% A5 }5 `* H& F& c1 t
static void __exit led_platform_exit(void)0 e2 T) N7 X7 \0 p/ j
{
1 U, I% E, A# ?8 X        platform_device_unregister(&da850_evm_tl_leds_device);7 U, p6 |+ `8 w2 r

. e/ b0 {) I9 d        printk(KERN_INFO "LED unregister!\n");/ [# P& I! Y% @/ m0 M0 i
}
* {) L7 v$ r% d6 Z5 _7 }% a) ~9 l& V( A# v5 g- |; r! z3 U$ R
module_init(led_platform_init);: K( k& j  w' F2 I
module_exit(led_platform_exit);" o; Q* V" h, L9 d# T7 u

" U7 G: i7 \5 f2 EMODULE_DESCRIPTION("Led platform driver");, Z2 y7 }; Y$ w
MODULE_AUTHOR("Tronlong");5 s/ B! `% }5 u- q, q! v$ K. J
MODULE_LICENSE("GPL");
5 O  {8 W% Y( a1 L& Z) ?
% |7 {; w0 \" z0 S. {" ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 21:17 , Processed in 0.040543 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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