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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
+ F& P) M- n4 A8 ?: ~+ o( I7 H* q#include <linux/init.h>
2 I; G0 g( d, m8 B/ ~: _#include <linux/module.h>
9 r% e4 p% r- O# _#include <linux/kernel.h>; H+ N- ^/ H7 n( s
#include <linux/types.h>7 {2 i' [5 ~* H8 A2 Y
#include <linux/gpio.h>  x% }0 i4 i) w2 H6 U3 H' ^  V+ e
#include <linux/leds.h>
3 V1 Z9 W. K! g9 q( a" W1 R#include <linux/platform_device.h>
( g' _# g3 l" t  P  }% v6 D" L8 g1 u2 k7 W) u2 Y
#include <asm/mach-types.h>
2 t3 ~. h0 ~9 }$ X3 W6 W#include <asm/mach/arch.h>1 r0 V5 F8 `/ r8 d, N9 M
#include <mach/da8xx.h>
2 T7 S+ J3 I, f& ?4 n, K$ h% D- i#include <mach/mux.h>7 k: s6 R. o7 G2 }4 ]4 K( X. k8 ^

5 j. @2 T: k9 z2 ~2 I#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)7 V, T$ ~: A( _6 G
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)! k/ B6 M9 v( V& ]7 U( S
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1), d3 B, l0 ~$ K6 `; v8 s/ H
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
: M3 |. B( f1 D2 b" p' f. }( T* n" I4 a! g
/* assign the tl som board LED-GPIOs*/
' t7 R/ F: C0 D2 ]static const short da850_evm_tl_user_led_pins[] = {
: S$ o6 p0 f5 t+ U3 ]6 T        /* These pins are definition at <mach/mux.h> file */
- g. ?: i2 |2 C+ |% `        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,, b. `/ Y7 E% P$ R5 P% N/ ]! Q
        -1
% C' u9 z" D6 R- v0 s" ?* ^/ [; y};' M, s4 u8 A: f3 ]/ O

9 Z2 W6 L0 m! ~2 zstatic struct gpio_led da850_evm_tl_leds[] = {3 T  l, W" B0 h7 |
        {
6 E4 P6 i! A) {* g) x0 G+ R                .active_low = 0,
, a/ _  E, M5 _1 R                .gpio = DA850_USER_LED0,
1 C- ?" |7 ^: p) I& u. t, X/ n% ]                .name = "user_led0",( \$ A/ y6 n2 @, b  {: M+ {
                .default_trigger = "default-on",
& t- I, l# Y' G& b$ Y! X        },
& G0 v4 o& L( K7 k* r: H! n0 h        {
* a, {/ |: S/ C. {  ~                .active_low = 0,: l6 d; w/ q8 n% b4 d% S
                .gpio = DA850_USER_LED1,
( f6 P8 {- Y0 e  \% U4 z. V5 R                .name = "user_led1",' m. }0 m0 N3 @2 w9 H, l$ X
                .default_trigger = "default-on",5 }2 s+ b/ j$ X: a3 C  ]" ^& |( i
        },
0 u6 i8 q, b% A. v# X$ G        {& Y* L1 K/ s0 i) N2 p0 l! @
                .active_low = 0,
8 i' g/ ~% R& ]. R# }8 ]                .gpio = DA850_USER_LED2,) l1 m% y6 N$ d1 [
                .name = "user_led2",/ }, ]' q+ {8 s
                .default_trigger = "default-on",7 o$ r; Y  [, l# I& f
        },5 T. A( Z1 w& _* |( H
        {
/ h! F, j. T+ t7 S3 `                .active_low = 0,# q6 V, W& e% f' X
                .gpio = DA850_USER_LED3,! q1 O' E2 W  e. u# T
                .name = "user_led3",
' v7 ]0 p; C6 r1 P) c                .default_trigger = "default-on",5 U4 |* f9 c; T5 M8 \7 B# t& [7 f7 R
        },
2 p5 B: u8 `; {9 ~5 z* N' H( C: f};
; P' e- g7 ]( o% C" u& _" R
& d6 R: Q2 B: M  t' N2 `static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {4 w8 P2 c9 D- J/ N) i/ F6 Z0 o# J. X
        .leds = da850_evm_tl_leds,4 l7 k& ]8 v; r* y  J0 T
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),$ \4 Y0 l# f* ?9 D
};! @& A* j/ P5 D( W1 }' S8 y
4 K. z! ~( G+ B9 f
static void led_dev_release(struct device *dev)
* e, Y5 z7 f& h3 \& }{
; c  }" `& T9 u# h: I};3 Q. \% s7 H6 f) B+ J! `/ C! S

0 A6 j  Z6 s* P- e2 w% q$ Tstatic struct platform_device da850_evm_tl_leds_device = {
# B& l4 _9 |/ Y        .name                = "leds-gpio"," P9 ^3 G9 q# M; L$ t
        .id                = 1,
* W% h0 V( |3 D, @  I; i        .dev = {8 c( }% J! v( C  Z. E" X) F4 x
                .platform_data = &da850_evm_tl_leds_pdata,
7 c: G0 p: N( w# m1 G7 n, b                .release = led_dev_release,
4 k& P, v! P$ `  R' S9 d2 ]- P        }
( s1 z9 J# f9 e) ]4 f6 s, `};2 ?* d/ x' K% H2 P: |' Q& E; s0 f

) t) W) U" D  h3 xstatic int __init led_platform_init(void)
. r" o# q( ?8 H8 I0 w/ c{
$ l3 O. `/ `9 ?0 u  }        int ret;
$ u) `& U0 K3 z& H#if 0
7 O) w2 E5 h2 ]6 }, ]# ?, `" u        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);8 a. h. F" V  `3 L6 y( q" {- A
        if (ret)
8 {! }+ d/ h! w5 I/ A( |8 c3 `                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
# N/ s: k- k2 _                                "%d\n", ret);7 w7 \1 w/ d& E( m% a
#endif
5 Y9 W8 b# Q; n. S        ret = platform_device_register(&da850_evm_tl_leds_device);
* U+ N4 w) f! W* l! f' r# l        if (ret)
0 d$ P/ u8 \" O! ?4 u! [                pr_warning("Could not register som GPIO expander LEDS");: O, |0 ^% V5 O) Q
        else
+ ]" N. S& o. [# ^4 T5 T: }" t/ @                printk(KERN_INFO "LED register sucessful!\n");
+ [" R# {* `5 F3 `' n  V6 e+ i) n' @7 W/ A  k/ |) h* M, R
        return ret;
$ ^$ \+ ~$ j' ?4 _5 n( r}
1 T9 V: I+ U0 [) X
- j) g$ P0 ?/ X3 Y# x/ ostatic void __exit led_platform_exit(void)) @' D! R& K, i( V6 I; N
{- H7 {) F* e* M% x# y3 g
        platform_device_unregister(&da850_evm_tl_leds_device);
  w, |. p1 o- |. z) N+ b4 U+ p( C  {3 G. S2 n/ l
        printk(KERN_INFO "LED unregister!\n");) F$ d; I. O) f/ e, E7 y8 a
}
9 L. u( Y; l1 F/ N1 K$ d2 [$ _! o& j; e+ r: _$ U$ o
module_init(led_platform_init);3 K! Z, V& T: M+ a
module_exit(led_platform_exit);
% {  J7 ^! L( z9 x+ g1 {3 n& G, H! y
MODULE_DESCRIPTION("Led platform driver");
3 ?! V/ q0 C0 F# f. a9 u% _# cMODULE_AUTHOR("Tronlong");$ G8 R5 b: h" H+ J0 |1 g
MODULE_LICENSE("GPL");+ U; F5 d3 @# _, x) R

6 g2 v3 x% ?- l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 03:50 , Processed in 0.038586 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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