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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。; a4 C& L* F0 e6 {, f- \$ s
#include <linux/init.h>
7 {* j9 X3 L$ @( H+ V0 H: ?# W#include <linux/module.h>
* K! |% K% {; U0 W: |#include <linux/kernel.h>
3 w! {/ G9 j9 k" U+ X" {# D# t#include <linux/types.h># c2 d) c: V# k/ H; L
#include <linux/gpio.h>
. [- [+ @4 c7 n8 H9 u- n#include <linux/leds.h>! Y5 X5 k# n3 `; A& E4 G- u
#include <linux/platform_device.h>
, E2 q' p6 Q/ I/ Y4 t3 B' W
3 x# V$ s- f% y$ X* S#include <asm/mach-types.h>" u. Q" o' N- O8 G& M% F0 }
#include <asm/mach/arch.h>
; m1 R5 K8 n( o5 f6 T, F" C#include <mach/da8xx.h>3 G6 L0 c, S' k8 D. N( M7 k
#include <mach/mux.h>! e6 ], c6 R5 @( ~

, K4 M: s2 m0 d0 t; z2 c#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
- u, T6 M# B" D#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
1 v2 R; C8 @. k0 W: @4 @7 ^$ Q#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
! b1 O9 J  M' g6 U$ N) u#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)/ H! _% F* e3 u+ N! p

$ V" F& n' I2 h! |/* assign the tl som board LED-GPIOs*/, ?2 _- X  ]( N# M, y3 f$ s
static const short da850_evm_tl_user_led_pins[] = {3 K. M; T7 M- [6 t; e, f! d+ |
        /* These pins are definition at <mach/mux.h> file */
, p& H% O6 a/ _5 K+ T, e( j# h        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,* J+ W- ]4 D4 H- t9 Y
        -14 \  N5 g* c  [  P: ?) C
};
( V8 i" |6 @) N( [9 b; ^4 a4 R! P3 b# w$ Y- F1 a) o* f8 E
static struct gpio_led da850_evm_tl_leds[] = {# e' I  x' @' p' l
        {
1 D. M) {& W* K% h' c                .active_low = 0,
% l7 q7 g7 u9 y. b2 Y9 r. z                .gpio = DA850_USER_LED0,
) k3 t* p1 J1 C. J                .name = "user_led0",
$ F1 V0 O3 D) A( t8 S( F                .default_trigger = "default-on",* C9 S) v; g2 E2 g
        },
% m' {% j+ B" F  Y# x1 z$ G% u% B        {) ~5 [" O) P" B! f4 a
                .active_low = 0,
4 g" t! d* [7 b  a                .gpio = DA850_USER_LED1,
' `, I( t% d; \5 H1 Q                .name = "user_led1",% D: D# u; D/ ?# }& z
                .default_trigger = "default-on",  _( O8 \+ R6 J0 K& l+ ~+ }) c4 K* X1 K
        },5 ?$ l5 ^2 s/ k( l$ S- G+ m
        {9 r1 ?. g* v( i+ [- C- l/ S' u
                .active_low = 0,
# O- V+ K: y: `* L8 R# i* X, n  O  `3 L                .gpio = DA850_USER_LED2,5 s" n, @8 h$ C) ^
                .name = "user_led2",
# ~- @! M& Z* p* B( F9 Q4 K  }                .default_trigger = "default-on",& O, B% j) g+ x: b
        },
+ N6 t8 H0 A7 Q( Q& M) L        {; E6 S9 b3 R' t2 a1 V
                .active_low = 0,  Q1 A, N. J# O
                .gpio = DA850_USER_LED3,
  W$ [/ M# D# c5 P                .name = "user_led3",7 Y/ R3 k4 w8 i; R/ r- a& g
                .default_trigger = "default-on",
6 X% s: m' l/ |. H        },
# |) @1 ~9 r$ F( ^7 x};
$ t# N" f5 z. c, r  l
1 }7 v3 B+ X8 G' ^static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {+ B" R/ ]3 d2 J: Y9 D1 n2 r
        .leds = da850_evm_tl_leds,
. c. p7 F+ K* }& O) h4 X        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
+ G# y  t; l  D) B/ b};7 w) S5 y7 c- J: v. v
0 R" g" Q( ?4 y% ?) C' M: }
static void led_dev_release(struct device *dev)
1 g# ]  J% ?" ~1 y( u! G{" P+ C, Z$ c& Z' n
};
4 Q3 g$ u( w' Z! g; m" v4 K4 Q8 l; ~9 r) ~7 W/ B$ @
static struct platform_device da850_evm_tl_leds_device = {, g* F- p  V6 _' d! W
        .name                = "leds-gpio",) X# N0 B  y2 c# u' m; P
        .id                = 1," l# k+ E7 ^  {! K% |8 k; g/ Y- \
        .dev = {7 ]  b% J$ I1 M* I; A
                .platform_data = &da850_evm_tl_leds_pdata,
( ~; l* s# E" B) D                .release = led_dev_release,% `) R% h: Z9 R) r; {
        }
6 a9 ~3 Q) S, h; R};4 g9 M+ t+ |' q9 S
. P' V* e. Z; i6 s) R
static int __init led_platform_init(void)4 n# X; N7 f3 ?- h' l
{$ Y6 f' Q' L% N, N
        int ret;
8 F" `) C4 H: k#if 0' @' ]1 q' R' g$ o6 ^
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);/ J# E% T  l% G% A% ]; p0 g
        if (ret)
7 \* z( Y: _2 ^& Z. `" P! m                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
$ q: ~* O! h/ s) w( K6 g  V                                "%d\n", ret);
4 j& S' n! r3 X# o% Y#endif
2 U1 n( @' e! i# a) I( x% I# t        ret = platform_device_register(&da850_evm_tl_leds_device);) e  g; M2 o( h8 k5 ~: ?& W5 \
        if (ret)8 l: b6 X" x  Y9 ~4 z
                pr_warning("Could not register som GPIO expander LEDS");
1 b6 m8 ^0 \3 f1 F" R+ q        else
9 \- C  l, g8 f  n                printk(KERN_INFO "LED register sucessful!\n");% W: v8 [3 K6 C7 k# ^: |$ W

/ d/ t7 U0 [8 A; p        return ret;! N5 w: e- v  q3 z6 B
}1 J% W; y! ]( V/ u. ~
) i# @9 H1 V9 [8 Z3 {% Z$ \; \
static void __exit led_platform_exit(void)
/ ]' E5 W& h6 f0 }3 }; n9 A{8 F* d1 O1 z) l3 d
        platform_device_unregister(&da850_evm_tl_leds_device);
: |* L& u9 g+ U% Z. S: f  f, p9 ?0 b
        printk(KERN_INFO "LED unregister!\n");
9 t; z, t! {4 O}0 N, O5 v; U" D( M3 K: Q4 c

, O: D/ u0 P6 m$ @' Pmodule_init(led_platform_init);
( P/ }+ g, H( d" i; L; c7 _. s- ~module_exit(led_platform_exit);$ I% i/ P3 m/ a  M

" p) L/ x8 u6 w" n( J6 Y2 z8 AMODULE_DESCRIPTION("Led platform driver");
: m, T; G0 Q( m( F( P& @; v: [MODULE_AUTHOR("Tronlong");
; n! t, b- [6 Q% k0 y3 H. f; w: ?0 jMODULE_LICENSE("GPL");
( ~  m* k2 f; o. e9 D: @0 }& G8 x' Z/ j9 H9 Y5 H& ]2 e' w& E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-8 13:33 , Processed in 0.045084 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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