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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
/ [2 Y9 b. W. L: p4 D/ Z#include <linux/init.h>
& X$ c$ d# u/ Q5 n#include <linux/module.h>: S# m/ M8 z2 T2 A2 \/ Z2 J; l8 C
#include <linux/kernel.h>
, q, {9 b: i. {* G  j( `. o#include <linux/types.h>
8 s! ?- N- [% u0 D#include <linux/gpio.h>
1 n$ n( r2 G$ N#include <linux/leds.h>
+ r' U  F$ W1 z: M- H#include <linux/platform_device.h>
+ x/ t6 |' f' q; V1 n4 x( n# y  j  m! [* o
#include <asm/mach-types.h># A: j5 M! t* I+ c: H/ _  x
#include <asm/mach/arch.h>
/ L. t3 c% G$ j+ ~  X5 i#include <mach/da8xx.h>2 A: W' m& `. w% t, x+ D! y3 i6 Q
#include <mach/mux.h>( r: k8 i  k5 T* U3 v" }+ i) E; y

" o9 @+ \0 h3 l#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
) Q0 [4 V; U7 b- y#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)0 ^0 ~, L2 B3 a
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
# N, ^8 B6 v% I5 F* R+ _#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
) T) }, a, v; z9 }
% w+ W+ ^8 ]9 m/* assign the tl som board LED-GPIOs*/
# j5 _3 P- {( lstatic const short da850_evm_tl_user_led_pins[] = {' m# B" M: ~  E
        /* These pins are definition at <mach/mux.h> file */' U2 u0 a% q6 ~; d0 f& N2 U+ k
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,* E2 R. _% P5 u- }9 \5 B
        -1" K2 R: C' N+ `8 K" O) C1 C9 z
};& d, U% D9 n" ]# w: a

1 P$ ]$ S" y5 t" x* `0 w4 V. o6 E( d5 vstatic struct gpio_led da850_evm_tl_leds[] = {
4 u) F# w5 x5 @# n, V- r( z        {$ M/ `6 X4 G/ {3 Y
                .active_low = 0,
$ U' m) x' j5 m/ _$ P# t* O+ ?                .gpio = DA850_USER_LED0,+ T* v$ m8 E% T" I& X) ]" [7 H
                .name = "user_led0",
! d: e/ r' ?7 }                .default_trigger = "default-on",
, }9 h% B' T6 _/ [4 I$ \        }," w; b# g; y& \9 U% E
        {
6 F6 J# x7 j, Y) c: n; Z4 e) W                .active_low = 0,
4 L: P8 N5 G2 k6 |* Z                .gpio = DA850_USER_LED1,
3 y/ X% S2 F9 Y9 X" j                .name = "user_led1",
; ?) d2 R5 ~& ?+ p3 D( l6 R: i                .default_trigger = "default-on",. t: ]% D( l* k) R, v2 o+ U% T  ?
        },
1 Z+ ~9 U" `! @# R7 F: B& }4 ^& \" n        {2 i2 s/ F/ m+ U2 Y
                .active_low = 0,' P9 p0 O7 C# c2 h" A! B+ \
                .gpio = DA850_USER_LED2,# X6 i, x8 I. n9 v
                .name = "user_led2",8 x/ I4 S: ^& }7 ~; \) z8 |
                .default_trigger = "default-on",  s8 w$ ]. ~9 h. H6 P& Y0 [
        },2 W) x) Y& K3 G7 o: N
        {0 Q2 g6 k: ^6 s& r
                .active_low = 0,. B  {3 o' i& ]% H+ r* K
                .gpio = DA850_USER_LED3,  D$ O3 v+ ^9 }  M
                .name = "user_led3",
7 G9 p* d( Z. e: K5 f( @                .default_trigger = "default-on",5 \5 U; Z; e. n8 i
        },
% F- R  l( b# `8 q0 n, {};
  \5 s) N# o( {$ B' y& n# p  ?% V$ ^" ?6 e6 }( E% c
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {) N) J/ z1 N! d$ l
        .leds = da850_evm_tl_leds,8 x+ K! b: w3 F8 v& X$ G
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),! I2 t1 S4 b; I0 I, Q: S
};2 a- t) u. x- u2 X  }% v$ _
0 m& @/ d0 C7 U8 _% T
static void led_dev_release(struct device *dev)
5 t, _  q, y! G. g$ P& E- k- V{
/ w& K! B5 E) U+ m6 v};9 u0 M  W6 g; P5 T3 B
7 a  ?* ?1 G6 }. I0 ~5 I$ N3 _7 R7 x+ J
static struct platform_device da850_evm_tl_leds_device = {
( Z9 Y) Z6 C8 \1 b        .name                = "leds-gpio",
* i3 ?3 U2 e- S! y" ]  z# g        .id                = 1,
( v! ?1 O( `5 l  W        .dev = {
- |3 d0 `/ F0 ?, @& L6 H. V0 @                .platform_data = &da850_evm_tl_leds_pdata,
8 s8 u( |3 S$ R0 m5 a/ C6 X                .release = led_dev_release,) P  {& N1 V: I' w4 k5 r) E
        }
, @; S, Y% M/ j& f1 w2 i- E};3 v2 G8 ^- n2 G" g  N1 s1 V

- s" K2 q! C& N: Ystatic int __init led_platform_init(void)
# G4 S$ K+ M" r) Q{4 G9 v- M5 X' L/ b
        int ret;: \& U1 @! m9 J0 u1 J9 k
#if 0
& |6 }7 p& R% B5 z8 w- K. q" k        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);2 X3 V/ j+ |! C
        if (ret)
/ v6 f: u; P7 J; l3 n: {/ h1 ^                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"4 ~) l: v! W2 V8 @" U- D9 v0 ?
                                "%d\n", ret);
6 A# q' W7 K0 ]* \  I, ?! Q#endif
3 c: _7 c/ [, [3 g) h) h3 S        ret = platform_device_register(&da850_evm_tl_leds_device);
7 L. N- ^) y4 W: E        if (ret)
* a0 G: Y" ?4 \8 K+ ^6 w                pr_warning("Could not register som GPIO expander LEDS");0 S* b# U# y1 O# p  A
        else  z4 G7 s5 e, P' o: y5 D% O2 z3 D
                printk(KERN_INFO "LED register sucessful!\n");9 P8 i  g) n4 G* H0 D% `) R

$ S0 I/ q: {! K# g        return ret;
1 y- v* t7 `; A  E. D}6 H- b+ q8 T" X7 O% L3 @9 N; e

, S& f/ K4 |0 }static void __exit led_platform_exit(void)
( I9 o9 q2 W" o{
+ [: ^  l) z/ Z        platform_device_unregister(&da850_evm_tl_leds_device);( G8 f( z3 _4 G2 O
. y2 I. ^6 C* w6 K9 I! A$ \
        printk(KERN_INFO "LED unregister!\n");
4 k$ p1 k7 j) u1 L  z& C}
0 U- ~. a: p7 }$ A
  d: x+ s8 m1 omodule_init(led_platform_init);6 x* b- r' c" r1 T& U0 o
module_exit(led_platform_exit);0 z( {5 l7 ]9 q5 J5 \

9 H6 [0 Y* K/ _* a: ^MODULE_DESCRIPTION("Led platform driver");2 h9 M4 W. t6 l0 u
MODULE_AUTHOR("Tronlong");
3 P) Y2 H1 Y: }MODULE_LICENSE("GPL");+ P  Z! _: [- [9 H8 x( _, c* f
9 u9 r( h" [; K0 w6 C, e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 04:56 , Processed in 0.050441 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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