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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
1 d; H( ?) x  d, }$ `0 E" Q* f8 P#include <linux/init.h>4 H' D) g( K. R- X& o
#include <linux/module.h>
  Q" {7 H$ l& W#include <linux/kernel.h>& R2 C/ q* O5 H& X/ h
#include <linux/types.h>" d  b* |7 P  N0 |" R) H
#include <linux/gpio.h>7 r% H0 U1 K* a3 d' c( Y( f
#include <linux/leds.h>5 i" J0 `3 S" i9 t( s
#include <linux/platform_device.h>. R- l; H% P2 p6 t6 g5 B) W

6 ?9 s/ h9 @5 D0 y, V- W+ k#include <asm/mach-types.h>
0 L2 I5 V0 S. b3 C, O/ {* X#include <asm/mach/arch.h>
+ @$ Q% B) O+ k  z7 v9 n1 z5 V#include <mach/da8xx.h>+ s9 k0 d2 \/ D1 D$ I4 \
#include <mach/mux.h>& L- M9 \+ S% J% I# W7 ^

, o$ T- e7 K3 |" N5 j# r9 @#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
- r3 l/ H( }( M- O4 @#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
4 s- z' U/ l3 p% L$ ?% N$ Z#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
1 U* q5 \* V6 o* |0 G. j6 @#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)' X6 }$ L# k( f4 C, @

* W8 U: w4 Q$ ]/* assign the tl som board LED-GPIOs*/
, d6 _: b+ \, x9 X7 hstatic const short da850_evm_tl_user_led_pins[] = {+ A6 K' N" _# N6 u
        /* These pins are definition at <mach/mux.h> file */, j9 C: u8 |) K# j4 y5 v
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,) r2 f( C8 |5 e/ @
        -1' Z! s2 D$ Q+ C7 h: g
};! J4 w( n9 A. B5 j: j5 t# i

1 w- c! i1 n2 b- C8 mstatic struct gpio_led da850_evm_tl_leds[] = {; v- p2 U3 V4 n- e/ W
        {7 S  `  `6 Y- s/ c7 @" h$ j# @
                .active_low = 0,1 ]0 p' u% u2 f( ^
                .gpio = DA850_USER_LED0,
" N6 u" h8 t8 T* u. t* i5 o                .name = "user_led0",/ j7 I# L8 [$ m3 _3 r7 p; D+ j
                .default_trigger = "default-on",+ Y' q0 G- q4 K* K  B. l
        },
, j! W$ ?7 ?4 z$ K% f# K  }) s        {
& j; w3 B8 w6 m8 I4 ~                .active_low = 0,4 b" O) L# t# e; i
                .gpio = DA850_USER_LED1,
$ y; \" }6 v  d% P: M                .name = "user_led1",
& W! l& @/ `; \( p0 T; U                .default_trigger = "default-on",0 t! b$ I9 `! w# ~! g5 k
        },$ }3 i2 z8 n0 m$ }5 H+ J5 i
        {
9 {* P& |. F" N6 u                .active_low = 0,: a6 [6 n( t6 x& q3 P' S6 w
                .gpio = DA850_USER_LED2,2 x% C. ]- f: I) s! m8 K( B- `0 N
                .name = "user_led2",8 b  ]7 V7 }; |( K
                .default_trigger = "default-on",
& `9 [4 m0 T$ n        },
9 u$ u5 _9 r: o8 L. B        {
0 i0 _8 j! F2 M# `- f8 h0 \$ G                .active_low = 0,
  f4 l) u" t0 S: |2 J. W" @) L  @                .gpio = DA850_USER_LED3,
& _$ `+ w! v& B2 R0 C3 R; Q& F                .name = "user_led3",/ A* S3 v: [7 ?
                .default_trigger = "default-on",
4 G: j6 y' Z% k        },
/ |; M9 {1 c) e9 F4 [& e5 ?};
* Q1 Y' e% R" E, \3 _$ t/ \3 H$ K# L
5 w; |" j3 H+ m) C3 g. [. o$ C# qstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {1 g5 @# |2 E5 h9 ?' O  v
        .leds = da850_evm_tl_leds,4 @' M& E0 j9 A" ]8 H8 S# ?' M
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
9 [, S% E% e  ~/ @6 A8 f) [, F, j- y};
' g, m6 s: `$ b9 }! L  Y/ `
9 c1 ?* E3 Z3 P% Sstatic void led_dev_release(struct device *dev)
+ J( R, k: J* q+ |7 u+ ?& S{2 R* v! {/ w$ h, Q' ]* G: j
};
  l5 Y6 \1 _: I0 d  u  J" D" f
/ S) m8 M+ G4 w* M  _' [static struct platform_device da850_evm_tl_leds_device = {
+ \1 w- `$ u5 T5 a4 W7 y" I8 u        .name                = "leds-gpio",% \' P" i  u7 F& R9 ^5 k# W& C; O
        .id                = 1,
' r$ t3 E, M; E: ]% J/ G! u        .dev = {/ [: e! n. _- @: t) Y1 G! l
                .platform_data = &da850_evm_tl_leds_pdata,
; c1 S" L( p, p3 Y+ x" Y3 _                .release = led_dev_release,0 ]" w% Y, C: Z
        }0 O6 O2 ]! A3 K( X
};9 e+ p/ p; K" Q6 c; x: c9 |( A8 Z
$ a8 c; V( Y) N. ?! U! U
static int __init led_platform_init(void)
2 r& L: l3 ^! K- W+ s- A{
' K8 z" b$ L5 f- z! u        int ret;0 s! H2 a# c/ n  z
#if 0
: Y8 G7 c# l4 j  n        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);" j  n6 U' b8 x% H) @  K
        if (ret)
! P6 p. h) m, U  S( c                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
; l' N7 n8 J! A) \: N) Q                                "%d\n", ret);! f$ l* l) i2 ^8 J* X6 O
#endif  l, p) a8 B) k- |8 l2 R
        ret = platform_device_register(&da850_evm_tl_leds_device);) _; L& T5 x% c! n4 j
        if (ret)
9 L% Q$ H+ v# B3 F( V; p                pr_warning("Could not register som GPIO expander LEDS");
2 y" f% c& H8 Y. Q+ H        else1 W: ~7 u" F. j! A. Q. X
                printk(KERN_INFO "LED register sucessful!\n");
) i( F. |2 h$ d; W( D/ T- d) ~' D: ]- {2 t: n1 I( [
        return ret;
8 I; D' X9 S% j- `0 Y}% Q8 ~2 a, I# T. c7 L9 x
* S( h4 V" @$ z4 P, M2 c* y1 @: X
static void __exit led_platform_exit(void)
9 O  T. k5 u& p9 p3 D- ?7 l  E" j  Y{1 V- D8 a& ]3 L- m: M
        platform_device_unregister(&da850_evm_tl_leds_device);5 t1 E+ s7 F1 T/ o: x
. ~+ G& \! M& w
        printk(KERN_INFO "LED unregister!\n");
" ?5 ?; @6 S2 v  [) q% I; u}
' d5 n0 Q( x$ F# \7 J; @$ h; u. Y' z0 f- z  q! P* n! e4 @
module_init(led_platform_init);# i, y( K3 B8 C2 `* s8 c7 L
module_exit(led_platform_exit);
  o- L! v6 h+ Y9 d* f
3 o  _8 z. _2 s" x/ bMODULE_DESCRIPTION("Led platform driver");
3 `6 Q, \4 Z0 Q, IMODULE_AUTHOR("Tronlong");
9 g. c" U' r$ KMODULE_LICENSE("GPL");
- T4 e, C+ f! u  [+ F$ ]* Y! Y6 N8 b6 \8 {& }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-20 02:45 , Processed in 0.044670 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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