程序注解 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。& z8 }2 g$ b+ x: I& r; W) P
#include <linux/init.h>
! o  R% t$ U$ p#include <linux/module.h>" c3 |. R" u4 B- c* M: {3 g/ y8 g) c
#include <linux/kernel.h>. q( d' o. Y  L
#include <linux/types.h>
1 [8 D/ B5 F) _* R& p7 |, `#include <linux/gpio.h>9 N" A. @6 I- @( D
#include <linux/leds.h>) S; q, [* n( x  S
#include <linux/platform_device.h>
8 \; U1 Z. r9 P) V" H# W  |: x( R7 O
#include <asm/mach-types.h>$ i9 J" q8 z  x! b
#include <asm/mach/arch.h>
: w8 n& v! E/ ?; l3 y% T#include <mach/da8xx.h>$ [( J) o5 M3 L0 y
#include <mach/mux.h>1 ~0 y+ c5 F. `7 l/ @$ W+ {* e
8 d+ L- |- j2 Z2 n! B0 Z! z
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0); p! n% O* Q: y
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)8 w7 P- v( z- W
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)4 m# q" d/ b! l1 J
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)9 ]1 ~  {8 V: g) N& h: f& p" [
( H0 U2 {+ Z# Z. I
/* assign the tl som board LED-GPIOs*/
7 ?" y) K4 r5 x- o% T; g/ ~6 r( H4 mstatic const short da850_evm_tl_user_led_pins[] = {
( M; ~# G1 S; g1 w4 r# H+ X; i& d1 z        /* These pins are definition at <mach/mux.h> file */
) r$ `# S; ?& k        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,, l% ~7 k% N  W' ?
        -1. P5 @$ n8 N  g
};0 b# \; V; O) J" p

  w  {: J+ w/ b' U* Z$ m6 Mstatic struct gpio_led da850_evm_tl_leds[] = {2 }& u9 ?3 d! V) y2 j, U, M
        {) G! P0 b7 X# f
                .active_low = 0,
. @( n, C$ F0 @9 D: U) O& o                .gpio = DA850_USER_LED0,
- X- D# Y& {1 [( h; f# r                .name = "user_led0",& k/ c2 }+ i) O2 z
                .default_trigger = "default-on",
) _( X) [- p; K. B& k- Z        },
* u; k: Q5 o% q+ a/ u        {1 G! I& u$ i/ s
                .active_low = 0,
5 G# `% ]9 R5 r# `2 D" e                .gpio = DA850_USER_LED1,8 Z$ \0 s  `  G
                .name = "user_led1",
/ @7 `9 M( n; x7 W, F                .default_trigger = "default-on",, `) w% N; V; ]
        },
. l+ Y+ [9 a7 R5 z) Y        {! w- Z/ E: B' `; {. T
                .active_low = 0,' Q2 S/ F2 L8 ^& j
                .gpio = DA850_USER_LED2,
$ C8 W) B+ [5 k( C$ I9 n                .name = "user_led2",; L# ~# A1 g+ A+ F4 {
                .default_trigger = "default-on",
! a4 l0 R9 e6 R; I  W* h# |        },
" O; c  i7 y3 I' R& r        {
8 ?' ~5 a  G6 Q/ D, o: a                .active_low = 0,
  F6 q+ O' X$ ?- f                .gpio = DA850_USER_LED3,% X3 N, {, L. e" S8 M% O
                .name = "user_led3",
3 N4 s4 z4 @, h3 r                .default_trigger = "default-on",8 m0 u  e% \7 s6 @5 `0 c
        },9 ^3 L$ x- g" X
};4 N& I! q. M% \' Z
0 e: |! V3 q* ]* m
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {8 {) ~9 G9 @4 o. Y  D: m' T
        .leds = da850_evm_tl_leds,
$ U9 g1 H3 n5 X. h8 z6 h8 Z; a        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
& v4 K  e- @3 F: K};' C5 T) r% b( G  A& ^
  ~. ~+ {/ b4 E
static void led_dev_release(struct device *dev)" l5 d! n( K- d$ A* [5 {
{6 y1 c$ g( T- L; U7 z! \0 t
};7 c' S# r- [) q3 p. t& |: X/ a) `7 _

* Y, ?0 h6 O7 ~5 Q1 |# j8 xstatic struct platform_device da850_evm_tl_leds_device = {
2 k* B! _1 D% G  F5 t% R) Y        .name                = "leds-gpio",: }! U5 b! H1 ^& Q, U( s0 h6 k. l
        .id                = 1,% l2 _. Q) M: J$ f- z8 {+ L) U; x
        .dev = {
: u. }" K+ l3 n; r/ J                .platform_data = &da850_evm_tl_leds_pdata,
& n) H7 t5 ^! d3 z                .release = led_dev_release,
8 c+ z* }+ F$ q6 c3 B        }5 D% X2 P+ w+ o9 R+ p" V+ F
};2 V( Y# C; [) \8 I% P2 S3 P

  |# O4 Z1 Y- \2 h! }  s+ \1 wstatic int __init led_platform_init(void)
5 r  o; s/ N; ^) d- ^{
* ~$ k9 N+ V4 B8 Z        int ret;
* u/ D; G9 n2 [/ H" f9 X& t1 X#if 0
, \4 s; T% ]' f. y        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);% N7 W: h/ S+ L% e
        if (ret)
; t' d; p( K8 s4 }0 e' s3 J8 E8 U7 u                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"6 p: N- E% w6 s, a* E
                                "%d\n", ret);
2 k5 x$ |; E; C8 o#endif) n' p8 n* ~3 C
        ret = platform_device_register(&da850_evm_tl_leds_device);
3 [) V; }, T4 _% E" _4 [        if (ret)
2 ]/ P! i" R' O- Q0 U# y! h$ b                pr_warning("Could not register som GPIO expander LEDS");: A( I7 e1 V  r5 Z  d' Q; N
        else
6 P) _6 F3 o1 u5 k" g, ~9 J                printk(KERN_INFO "LED register sucessful!\n");3 g9 H0 H; M' [3 j/ R
9 R9 B* d5 H! m
        return ret;
6 ^# `6 T3 J! i}
; g1 h, v6 e0 Y! e& G! H* L2 U
( D" X1 D' S+ }2 i! N$ f9 o: mstatic void __exit led_platform_exit(void)
: v  d0 g2 |# s{
9 F" F5 y+ m$ N& t$ o/ X" T$ q        platform_device_unregister(&da850_evm_tl_leds_device);3 T3 g" @' b2 E$ H& ?& i
& K) M( Y$ W2 P+ }- P6 i: k. x$ R4 n
        printk(KERN_INFO "LED unregister!\n");
7 P) c. q# M/ f- W9 o" p, r}5 L$ M" U) Y5 K7 H+ l
! S4 Y2 N# l. {7 R" N' J+ P! T7 a& a
module_init(led_platform_init);
8 R, W/ x; h2 Q+ F& K) ]module_exit(led_platform_exit);
) i$ V3 N& o* S$ K/ A" N: i& N  ~& q: P" `( r; G
MODULE_DESCRIPTION("Led platform driver");0 M* [0 D3 k, Q9 u$ B
MODULE_AUTHOR("Tronlong");
9 j+ c' R1 ^( o( d- VMODULE_LICENSE("GPL");$ h* S5 m/ G. |( }, [8 M
/ ]5 P% R' l0 H; H2 s6 j1 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-3 07:07 , Processed in 0.035399 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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