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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。% v" }2 G6 V$ i3 C$ z: D0 G: `
#include <linux/init.h>
4 [5 H! _6 n' U# E#include <linux/module.h>
" r4 D, j; N7 D#include <linux/kernel.h>* ^* }9 Q5 `' S) G
#include <linux/types.h>
& q6 f7 Y" u( ]2 ~0 s; J. }- {9 k#include <linux/gpio.h>' O3 z: Y& ~' h; N+ u# w
#include <linux/leds.h>" m8 K, M* N) Z8 l& J& h
#include <linux/platform_device.h>4 ]: N4 I! O3 R' O  c+ h; _

5 z# \% R# C: f: c- n! u- e( S5 N# }#include <asm/mach-types.h>
% b2 Q: A, h2 |#include <asm/mach/arch.h>
$ z$ U% l' q. ?2 r#include <mach/da8xx.h>5 }/ ?+ Z& m9 I" X; x, ^1 U" M2 n
#include <mach/mux.h>
7 ^1 E/ p- O% p
! n, S% Y* \. O. e5 S9 v#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
5 j! y) T  p" K& }+ j" K$ v6 l#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)* s' M0 @9 i5 x9 S
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)7 z+ c* A8 ~& u
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
; F% y# e- X( D5 F1 S1 k) l  p
/* assign the tl som board LED-GPIOs*/5 r' e# l! i- t" u
static const short da850_evm_tl_user_led_pins[] = {% E4 ?- H" m% L& p4 }( q5 }
        /* These pins are definition at <mach/mux.h> file */
2 k, [8 d' @. P3 M" N+ \        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
( t4 S1 U% J% o) m) z        -1
; X- A! o, G8 O( S};* _; Y  _! X$ w

6 C2 F: Y5 @" W/ W5 f  Wstatic struct gpio_led da850_evm_tl_leds[] = {" w( N$ O/ D' y1 U# S3 @% ?
        {
; b  I% |: r6 [6 w1 U  |                .active_low = 0," @& t2 V0 s& d* R
                .gpio = DA850_USER_LED0,; b. o& V6 ^4 Z4 |# o  S2 D" |! @
                .name = "user_led0",0 t: T/ g/ W' }9 B$ e: ^
                .default_trigger = "default-on",9 V7 V6 [$ _" \% b2 j: h  B% F
        },, S& o6 ~9 l* n5 p# b
        {  Z* j, s1 b+ z$ U
                .active_low = 0,+ U7 v6 ~7 R* A) \/ @: V" x
                .gpio = DA850_USER_LED1,2 v- @) `1 \" f, w) Y5 Z" {% L
                .name = "user_led1",; R7 |* D. w# d3 b# U, \0 o; K3 K
                .default_trigger = "default-on",
0 _* F9 X8 j+ m' q  y' v        },9 i0 H: m7 t: c
        {
2 ~8 `0 W  w, e' h5 a2 X* I                .active_low = 0,* c# r  v% w: A1 Z
                .gpio = DA850_USER_LED2,
4 Q, n' f  g6 _) Q' V                .name = "user_led2",$ |3 j1 j, c7 b/ n
                .default_trigger = "default-on",
' d/ e) y7 K$ w: i1 h- n/ n+ h/ {        },
  ]  ^) o: |3 |        {% b* l$ e% f% I6 k* V# I
                .active_low = 0,1 c* n" B. u! |
                .gpio = DA850_USER_LED3,
9 P% _! E. R6 M) c, m7 q- r" {                .name = "user_led3",
. H' L6 {9 k7 N% ?                .default_trigger = "default-on",9 l9 n# p3 E- A" x/ X; d# T
        },
9 T, y9 h' `% |};. m0 j9 `+ G9 N8 u2 Y1 n
) z: E3 D5 e6 G' R) h( @
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
+ u% E! F; u5 n        .leds = da850_evm_tl_leds,9 y  t9 R2 S. K7 T* J, n
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
0 b1 A& |% }/ Q8 g3 _9 G( d" ^};! [- l; l* B5 _; |: s! k

  N, m: n9 X: [" H- z) P" m* Xstatic void led_dev_release(struct device *dev)
6 f+ \$ l, a2 E  W{" h) _( N# G; e2 E9 ~
};
& K! s) }: b  V  O( P
1 }3 [+ |# e7 `static struct platform_device da850_evm_tl_leds_device = {
6 P( ~& N- x5 L$ M" V5 k        .name                = "leds-gpio",
: ]; j+ H, t$ j. b4 e# G) K: ?* v        .id                = 1,
+ X4 `& w! {0 }2 N- G/ {: \        .dev = {
+ o2 `7 H  H, m' c( @- @5 }5 T7 @                .platform_data = &da850_evm_tl_leds_pdata,1 ^2 }, `- s* s) m1 \
                .release = led_dev_release,- d1 s1 N" m1 y
        }% M" s/ v; o1 n( A6 n+ |/ Y
};
- ?; A5 c. c1 e) h: E$ x& M. k  r3 I/ Y
static int __init led_platform_init(void)$ W4 Y% F3 ~" R' y* r) G
{* q" ^4 M7 b, A" Q6 R  a
        int ret;
: u/ h6 {( u" @* M+ L% |5 [, n1 E& s#if 0
" J$ N: l+ [, c/ ~6 x$ C. S        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
& Z* U8 v% g& J# J. q        if (ret), Y0 D8 {1 G# Y" h
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"4 \6 i' c4 W/ z. |- S8 `
                                "%d\n", ret);1 r6 L3 F1 p3 y
#endif
/ H7 V+ u# A7 ~6 F/ O) N9 f+ n        ret = platform_device_register(&da850_evm_tl_leds_device);
6 Y/ i7 t! Y3 s, `        if (ret)
9 v+ ^% {* k# I. w% ?/ W                pr_warning("Could not register som GPIO expander LEDS");
3 h, K# k9 N" K/ K& U        else
; O- O9 |9 U, A                printk(KERN_INFO "LED register sucessful!\n");
7 d4 ^5 L7 M. h7 @( e' b6 G; c1 Q6 u
        return ret;
3 Y3 z4 ]- C8 C6 o  V% ^! N}
& q! U, t; @+ {& q
/ a) n( k) |. u5 {" hstatic void __exit led_platform_exit(void)
- [- Y' K& d/ P1 j  l{
: z" b1 l( @9 }. @# I        platform_device_unregister(&da850_evm_tl_leds_device);
0 U: _" C# R: ]$ `  @$ R2 I& q5 K( u1 H- m# ]
        printk(KERN_INFO "LED unregister!\n");6 m' w3 K1 K* E. g) k
}& \0 o( H& |$ }7 O" E$ q+ Z
5 m% _2 u% l- Z  q
module_init(led_platform_init);
7 O, t) n$ y+ b/ L% U. c( amodule_exit(led_platform_exit);
: B6 z. ?+ ~+ b
; K4 O: H% e% I2 gMODULE_DESCRIPTION("Led platform driver");
* u6 C# F% I+ nMODULE_AUTHOR("Tronlong");8 W9 D5 [4 J0 j
MODULE_LICENSE("GPL");
) q# |  ^7 B5 _8 b2 w% s2 R) n" t  k) V$ ~5 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 17:52 , Processed in 0.039477 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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