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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
! J, m& [  }! S7 p# T* O, |#include <linux/init.h>
/ Y  {5 D, G: I4 k* v9 \#include <linux/module.h>
8 g$ X' O. A; E& X#include <linux/kernel.h>. ~0 x" i& n$ g/ t3 O0 B7 Q9 o' y
#include <linux/types.h>
7 L; `! L0 t5 z' v' @/ b9 Y  ^- n#include <linux/gpio.h>: p- P$ `2 p; X: P! a' t' U
#include <linux/leds.h>3 q% f4 [  ^) j, B) Y( n
#include <linux/platform_device.h>
( B7 `. s1 G# g( L" C
" f& H: ]7 S: `! t  \" l#include <asm/mach-types.h>
0 @6 G% A' A/ f4 T#include <asm/mach/arch.h>
7 H7 S) b- t' m3 U( S4 }$ `6 w  x#include <mach/da8xx.h>4 o7 n" p/ Z# x9 f
#include <mach/mux.h>
1 t3 i* Q3 N6 {* N5 f% x- }: q4 h& J  a! r, g
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)0 w9 k) C0 L* Y) t0 w
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)& [8 T; [3 V  }2 H9 ]
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)2 M3 [3 r' Q; S! i
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)6 W, D" \' ?+ X, W7 D8 n$ J1 ^

9 ]6 Z( Q; P) \# O4 V* m1 D9 L/* assign the tl som board LED-GPIOs*/( ?% }& N2 ?( k7 L% j$ Q1 V
static const short da850_evm_tl_user_led_pins[] = {
& ~2 A. X% k1 g' R        /* These pins are definition at <mach/mux.h> file */* \. f4 U2 i% g% r1 ~2 U8 E" e
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,4 ^5 x; m% m$ a
        -10 D$ h6 C! H2 z- O9 X
};7 m) ?- H2 Z1 ?5 l; {2 a7 |' w5 d% f
# x5 S, Q6 W& m, C" |" }
static struct gpio_led da850_evm_tl_leds[] = {( x( S. O: S& F. F. B
        {; D4 E# D8 E3 O# v# v* w
                .active_low = 0,
1 s% u" X* k, P  s8 P/ r* b                .gpio = DA850_USER_LED0,
+ F/ r8 h' M+ V. g4 E# ?; J                .name = "user_led0",  D# q. b1 D" h5 g
                .default_trigger = "default-on",' q2 A8 L2 Y" {& l
        },
6 v0 l  N6 q- D' u# Y        {
! p6 V, G3 D% ?% p- Q# A" t                .active_low = 0,7 O" {' a5 x" h4 l; K
                .gpio = DA850_USER_LED1,; ]0 e6 K. {& v
                .name = "user_led1",
' ^/ K  r& w1 H, s2 ]! @6 I" b                .default_trigger = "default-on",+ ?* o+ |: W9 D9 |
        },! [+ v; U5 M4 t  b/ q+ C; V. N# B
        {. b/ @# {: d2 p  c) O
                .active_low = 0,  e) ~5 N1 E- X0 ?
                .gpio = DA850_USER_LED2,* W, `% T" O  Q0 Y/ |% V4 K$ q( F
                .name = "user_led2",. }' Q  k$ [) f* h. L" j
                .default_trigger = "default-on",' u/ y4 v* A" O0 S2 e( O
        },
" ~+ {; }, n: ^( f" e        {: W1 u2 d8 E) X# w
                .active_low = 0,
6 ]& Z% F% [/ B$ g7 G0 S7 p/ U                .gpio = DA850_USER_LED3,
! T8 U$ n, c) }- H  q                .name = "user_led3",. J0 S; ?3 _$ F# a+ _8 [
                .default_trigger = "default-on",( t- O$ T' j/ H8 `
        },3 E. Y) U  N3 m+ }# }0 E+ R
};
& E7 c0 s1 x$ I* n$ n2 y- u  O& U( H. n; u! B
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {" Y5 n( q% A/ A7 L5 Y
        .leds = da850_evm_tl_leds,
* ^! d: g- T# f  B/ u        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
  A& U5 F' ~8 `' G3 s# Q};! N/ U6 ?4 z  r) M5 S
+ P5 T& g' N# i& C) e( U: m
static void led_dev_release(struct device *dev)$ I* D! l: x- T$ ]0 N; Z4 Y4 X
{( a3 G$ i6 Y' j6 l+ o
};
1 S9 l  ~7 x9 T0 V: l* F, n& F6 B! |( p. i" T
static struct platform_device da850_evm_tl_leds_device = {# g, x) i( j' V( ]
        .name                = "leds-gpio",
" H' Y+ g2 N* \) k& Z' i        .id                = 1,
% ?% b* m" B. T) @, Z7 a        .dev = {0 J5 j* D$ w% U/ ~/ V& }2 u' f
                .platform_data = &da850_evm_tl_leds_pdata,
, X/ p% e9 J1 F1 i                .release = led_dev_release,3 U7 B* J% E. F$ }' P5 s# |
        }
3 L- f* X4 S4 P! N3 x" \) O2 m};; g4 y7 n+ v% o5 ]) n- }+ r
# I# o$ p  q, a7 [, s: e! A
static int __init led_platform_init(void)* h  _* I) X6 S# G0 x$ @5 Q
{$ ?/ S# e1 [1 ]6 c- x( I, ~
        int ret;& E) V6 x5 m# z4 x, `0 [) r. l
#if 0
+ L/ p4 z* K1 }        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);' C. {2 o( P' q6 g" j
        if (ret)
, A" D9 n* H3 y. Q7 l3 f                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"" m4 r# h( K4 ]0 F9 ~" @
                                "%d\n", ret);. a) ?, |; Y0 p7 b$ R" n, \( d# d/ L
#endif
0 S; S' R: V8 _0 _. O; H        ret = platform_device_register(&da850_evm_tl_leds_device);
1 @9 C4 x) D2 i9 z$ J6 M        if (ret)
% M# K+ E, N" u6 }' m1 c/ p                pr_warning("Could not register som GPIO expander LEDS");% j$ H0 s7 O: Q1 ^0 {5 @/ q
        else9 y- [; ]& L/ I# C1 G2 K1 q) z
                printk(KERN_INFO "LED register sucessful!\n");
* J( e: h7 m9 v7 P% A9 ]) A# ?  a" P  V
        return ret;
% D0 w3 V; q8 J, y8 C# G) t/ ^}
2 ~+ [! |4 W0 Q  c' ?2 ^% i$ K* [: l: l
static void __exit led_platform_exit(void)
- {9 X- q$ r3 @$ `. z& x{
- F6 ?6 n* h" r, L' B1 ^        platform_device_unregister(&da850_evm_tl_leds_device);. n! K* e( H* R$ e5 p  y" m

. z/ p6 [0 y# D3 }. r8 U, u        printk(KERN_INFO "LED unregister!\n");, R8 ]- Z! F6 Z  X2 F
}' U5 _2 O# k7 f' r4 _/ K2 C1 K) ^/ d

7 w# `& [7 s: q7 S: Y, G& umodule_init(led_platform_init);; Q8 }" J8 m% d8 t
module_exit(led_platform_exit);
- ]$ b! g" W& `7 \* \+ A6 g0 J: p0 j% D5 z" \4 e3 ?
MODULE_DESCRIPTION("Led platform driver");4 Y3 v0 e9 |# R2 g( I7 L- m
MODULE_AUTHOR("Tronlong");
  R6 [' G7 e: h! t5 XMODULE_LICENSE("GPL");
1 U; [+ h$ q# U" u; A- G% s4 O4 {/ i# k" n# H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 06:01 , Processed in 0.039463 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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