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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
) s$ G5 O# y! _' x#include <linux/init.h>
, T/ C# ~+ m9 B. Q8 s& T#include <linux/module.h>
  I/ M) R# {/ M& I#include <linux/kernel.h>0 k1 g/ P; k% t7 w; t* Q" X
#include <linux/types.h>
6 l7 y. d* J1 k0 s- T1 g% j: Y# u#include <linux/gpio.h>; U: [6 {" d; D6 e# T# Y8 p2 |
#include <linux/leds.h>4 f$ e) b, H  Y7 Y
#include <linux/platform_device.h>
" e, O& u6 T( h" r% ~; t
( H  O2 ]0 q. X3 A+ Q. b. G: F* f/ r#include <asm/mach-types.h>
" W1 [8 w4 t7 _; [6 c#include <asm/mach/arch.h>& Z. e$ O/ r$ o# [4 a/ c7 t) x4 w
#include <mach/da8xx.h>4 a  q/ A) q# s- y! h2 e4 B! i3 h! D* B6 q
#include <mach/mux.h>$ t* K- C& ~/ x9 G

. T- ]  n+ H/ n#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
, k% j1 v# A( g) g& `: r5 b7 E2 N#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
/ E9 a: ]7 T# F- s7 z6 y#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)5 V( A6 R- D9 R7 o) a0 H
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
+ ?' A4 ?' S+ D1 M) G
0 E1 \; q) V. ?% k# J/* assign the tl som board LED-GPIOs*/7 ^1 V6 ?: ?, l! n, ?
static const short da850_evm_tl_user_led_pins[] = {
3 ^' f7 }' t- O* x3 P        /* These pins are definition at <mach/mux.h> file */4 Z5 H3 B" g% I" }; p  a6 ~
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
  v& g3 T" o" ?% X3 k) u        -1
9 s% |2 H9 m& n+ C" y' _+ @};! G! d, f8 Y5 f6 R+ g; i
* U- g- e/ b) Q4 x; K
static struct gpio_led da850_evm_tl_leds[] = {7 N5 g# f1 W: F" K' V0 z% ~4 A" D
        {/ A, P8 o: Y7 i( F! q0 L3 S% m" n$ F
                .active_low = 0,
, l: c( G; q2 |; `                .gpio = DA850_USER_LED0,
7 k/ [: S- M4 K9 ^                .name = "user_led0",
( i4 \% i$ k5 `. `; f& F- g                .default_trigger = "default-on",
% ^3 H3 i; Q" J' U8 y# P        },
  [3 Y. g; v1 m0 Q" V. H3 @        {
+ _8 [- n( _+ P1 x) w0 F3 t% I                .active_low = 0,8 E+ `+ f+ d8 X( f$ x1 _5 I. O
                .gpio = DA850_USER_LED1,
5 Z! R  f$ n; u6 L                .name = "user_led1",
$ E% H7 e8 ^% }* y% e                .default_trigger = "default-on",
0 \0 M1 V4 v; w        },( f, {" j# d9 Q6 e  p
        {3 n3 Q8 A6 k. M( w5 B3 p
                .active_low = 0,
7 J0 E3 v3 T9 n) n; T2 n                .gpio = DA850_USER_LED2,
6 O+ E" W  l4 F& E2 E. e6 @7 y) |, t                .name = "user_led2",
. @" \7 v; B  h8 \4 B8 B+ y( Y                .default_trigger = "default-on",* X# G1 b7 K, y2 q* O) c
        },
8 }% y/ Z  c) t2 N. q        {
+ J9 P  G$ N% z7 ]+ x% v' p2 v* s8 E                .active_low = 0,$ L8 w2 N. A& I% f. j9 C" i# j* k
                .gpio = DA850_USER_LED3,6 F# c. k( i7 A
                .name = "user_led3",
* l1 s& u* s) T9 y5 F6 D                .default_trigger = "default-on",
9 K! d) e( M1 d+ N. f% V        },) A$ S7 ^  g8 L$ h& B
};0 a5 C& p: l6 [

3 Y/ B" ]) i# W' @0 m( Pstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
- N$ V7 h/ k% W* h1 [$ t' O7 g        .leds = da850_evm_tl_leds,5 e3 V) l& e$ k! P2 L+ _. v
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
, T* Z% @: o7 n  _};4 R* {- W+ H: L4 u0 I/ R- a

* b; C; |% S# S. ostatic void led_dev_release(struct device *dev)
+ _% W+ Z5 g* H% A% R7 I0 e( g# v- V{6 w# }8 S5 R/ Y; O* I
};
4 l' c/ m0 n* }& W5 {' w( T8 C* n3 x* O- n2 R) Q  z
static struct platform_device da850_evm_tl_leds_device = {; d1 {; V0 O: L+ c
        .name                = "leds-gpio",
1 Y" q  r6 P  ~5 k( O) R, j        .id                = 1,' z# S) a  m+ u
        .dev = {
% s1 a' S+ V. x3 M2 w                .platform_data = &da850_evm_tl_leds_pdata,( _! V$ r2 E8 G$ ^$ h/ v5 ^0 z
                .release = led_dev_release,, \# L0 A% m9 x' w+ S6 Q- m
        }
$ K# L5 u2 e$ q0 X};
% m1 U& D5 z9 q1 n# l. U6 p
: v; h# S) n  I! ~% i6 z, \; tstatic int __init led_platform_init(void)
2 g1 |9 X  d7 q! H# y{
# b' i  b8 V( L+ x) L# o        int ret;
7 z9 z) f& k' P: m#if 0& H' j1 v0 Z) j6 X4 O" Z4 {
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);! ?. m1 F$ [8 N8 U3 l' o
        if (ret)6 O! X8 C' ?3 Z
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
/ H! L' G0 }- X; ]                                "%d\n", ret);: ^+ |6 ]! h; f
#endif
" L; |: d7 Z8 c+ X6 V' M        ret = platform_device_register(&da850_evm_tl_leds_device);& W! ^/ Z, t5 |' P& E$ x% i- ^/ ~% G" [
        if (ret)
) U; ?+ \4 n) N9 `; `5 T0 D- J                pr_warning("Could not register som GPIO expander LEDS");0 \# R. ^3 ^# @  N6 m3 s
        else+ G8 x4 l$ o( A; k: E4 V
                printk(KERN_INFO "LED register sucessful!\n");
* ]% H+ j$ P! r3 S3 e$ K# c8 v
7 j9 T0 c. Q7 Q: d, V        return ret;7 Z1 }- m8 k/ z; t$ F$ D2 V
}
' {& q& e6 `) a# B7 J8 e3 [9 y- A0 i# m, U
static void __exit led_platform_exit(void)
$ U, F/ z1 o) J% l. c6 \{
5 `# d. c3 a' z8 X6 ]  x        platform_device_unregister(&da850_evm_tl_leds_device);
* Z; b7 O0 W& V" i6 ^* N! A1 R" f. l+ A; \; g
        printk(KERN_INFO "LED unregister!\n");
2 E6 t1 K: k5 P5 w}
& y9 v' }0 `( e/ q7 g3 r* n: A: U6 a
module_init(led_platform_init);
, p& `/ g. Z  I; k. {module_exit(led_platform_exit);
8 M( T! C- R& m. x- R4 {/ L* a. J+ s% C! h! o( J
MODULE_DESCRIPTION("Led platform driver");1 e6 f8 U8 u% p) L9 S" Z
MODULE_AUTHOR("Tronlong");
4 k5 {4 ]& J; \) PMODULE_LICENSE("GPL");
4 M& Z4 P$ J7 ^4 \+ o3 c
  o( ^% S! p! p4 d. V- f1 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 15:01 , Processed in 0.039933 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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