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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
6 x  W9 y: p, a7 a2 j) C% ]#include <linux/init.h>
' n7 H/ a, n* g! R#include <linux/module.h>" r  {6 G" Q" X& A
#include <linux/kernel.h>
3 F8 a5 V% X# ^1 f0 o8 ]$ h+ H% ?( K4 C#include <linux/types.h>2 E. d  k* F: B' h8 w8 }, m
#include <linux/gpio.h>* t: y4 V9 ]- O# D/ r
#include <linux/leds.h>
# X6 ~# n$ O: ]  o- \  N& V#include <linux/platform_device.h>+ ?+ N# U- ^# {: ?
" A; \9 ]8 s2 x! `- v* z) @
#include <asm/mach-types.h>0 ^" v) s/ W7 N" b2 [9 R9 `
#include <asm/mach/arch.h>, U7 h% W2 Z* [6 t) Z
#include <mach/da8xx.h>7 n; E7 F8 g! Y9 x" Q2 S& B
#include <mach/mux.h>
$ z, g: p* l' O+ ?" W- E. H9 A& a3 R, A- _/ X
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
3 G1 s6 ~+ V$ c( H2 [4 p#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
) U9 F3 n8 t- m1 S: |#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)0 y. T" `# B( B+ D
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
: \" e3 _4 u+ w' W  B- W0 Q7 x8 V! R9 E: Q7 j
/* assign the tl som board LED-GPIOs*/& {0 T1 k1 J* \$ Q5 t: ^0 A. ]
static const short da850_evm_tl_user_led_pins[] = {
: m& h$ h: D- I' N' ?. m3 M% ], G: e        /* These pins are definition at <mach/mux.h> file */0 H1 |9 ^3 a  J2 U  S0 [. v' G8 v
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,6 p9 c9 T5 g* e# m8 m
        -1
  r$ j  f; S1 @' ~7 x" k# e% ~+ i};
! a* ?9 [* D# X- P0 _9 E& q  x- g3 o
static struct gpio_led da850_evm_tl_leds[] = {( g6 V: q2 R" ~) B" W, d
        {% I. |5 {9 u# A" C$ c
                .active_low = 0,
$ j5 q) O' o8 |" R2 h* s                .gpio = DA850_USER_LED0,0 e  s5 ]1 n; S3 K1 K8 A! j
                .name = "user_led0",: [& v1 K# t$ f. @& T
                .default_trigger = "default-on",
8 B8 b' b, j# X0 E. s- ?; v( w        },
3 F1 q! n* N& e        {
0 Z; O# e4 G: ?1 U9 n                .active_low = 0,
; ]4 ?# U7 [* f5 n* u. E6 K  m                .gpio = DA850_USER_LED1,, m  `3 y7 k( F$ s4 J
                .name = "user_led1",: {/ \& U+ Z7 b1 l
                .default_trigger = "default-on",/ Y9 k2 j: h8 w: ]
        },
, w, H% B9 |- V  o) V: n1 V7 F' [        {2 n! W; y% w2 ~* n; L' ]" ?" z
                .active_low = 0,
' e  J- A: j, {! b& T7 d                .gpio = DA850_USER_LED2,! ]7 x, E; j: z
                .name = "user_led2",5 _4 g8 l0 H. k
                .default_trigger = "default-on",
3 n/ n8 ?& o1 z( E' n. X        },
, _$ c8 @0 i/ k: P7 n/ y" v& e        {
* d; p0 O5 i6 b) U                .active_low = 0,8 T7 |8 f; ?  Z" \  `" B
                .gpio = DA850_USER_LED3,
2 \7 T% }$ f$ B/ `1 k" t4 r                .name = "user_led3",) [9 `7 M% B" g  v, k7 e
                .default_trigger = "default-on",% p+ W7 |3 n) K, u* p, N
        },
- E8 u8 i7 S4 t2 `};
& N8 L& M& R# ?3 \8 x
+ G" M  x8 c% `2 }static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {5 X6 u! |  e: a0 |- S7 y1 E# W8 }
        .leds = da850_evm_tl_leds,/ P2 W/ f  z* {, U5 m; A
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
4 M5 d* h! t* {& S) B};0 i* K3 p% r7 U, @
. {" o9 |1 K+ Q8 [" M# T3 G; k
static void led_dev_release(struct device *dev)9 C  m7 Q9 G, u1 U) e
{+ k7 l+ I* X( }6 h( E
};  G" f: G! ^6 @/ a: I" d3 A  R

  u9 L( A! t1 P6 y8 @8 `static struct platform_device da850_evm_tl_leds_device = {7 d) l) [: y. `+ }! G! Y' f
        .name                = "leds-gpio",
" ^; r4 N, v! J' ?# g8 l. A        .id                = 1,# F  ]/ G- [1 E: Y
        .dev = {
, u5 Q/ G3 R. @, g2 L, T0 O                .platform_data = &da850_evm_tl_leds_pdata,0 G* w5 r% e( R7 s9 f# L, O
                .release = led_dev_release,
1 h$ @6 ], A% O3 x  @        }
4 H( |+ x0 x" U4 E6 [};
6 T/ E# @" g4 I
4 X& e+ H! {% {% \+ W. j" xstatic int __init led_platform_init(void)0 I$ X# f4 P( t
{! e# o4 J" }9 F
        int ret;
- @4 `7 F- k3 r+ a#if 0
& H+ \' `( t, p' K1 B        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);3 M- b) j$ i% m
        if (ret), q* d- g0 @7 w5 \- L
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"7 G6 D$ N! c5 F' J
                                "%d\n", ret);/ t3 m7 b& p  v, @' {
#endif
8 F0 J" u6 g7 T, B, L- N        ret = platform_device_register(&da850_evm_tl_leds_device);  R. `0 U* g0 a
        if (ret)
( u: ]  M1 R" G+ k5 g% d                pr_warning("Could not register som GPIO expander LEDS");6 F# g# C6 r8 _- }- b$ ]1 I& e
        else
5 b. r# N' S. t  l                printk(KERN_INFO "LED register sucessful!\n");1 t# C! F5 V: E4 d% {" E5 t

& o! ~# O5 R4 _# b2 d2 u3 B: Q        return ret;
2 i! f  {6 h) r5 |}
% u- ~) ~9 Q- E5 ^1 n4 ~
# I( _2 j; t0 d- c2 ]static void __exit led_platform_exit(void)
; Y3 B  K! O# A1 S# T{' f7 Z2 H& D% ~8 n; V3 R  c$ f
        platform_device_unregister(&da850_evm_tl_leds_device);) \6 y6 }9 x5 |2 f! o

2 p- o" D7 b0 p' J4 R        printk(KERN_INFO "LED unregister!\n");' J% [# B& Y  y
}, k& o8 L. I+ ]  d1 C/ U% X

# ]* [: o2 Q7 S* Y$ i/ Y% dmodule_init(led_platform_init);
6 C. p) a8 k* |, g" [' Ymodule_exit(led_platform_exit);0 E& s$ x; R- ^2 \$ R; a+ @
; F  Q$ T# h3 j
MODULE_DESCRIPTION("Led platform driver");1 W% {2 n& p+ F# h0 G" J3 n
MODULE_AUTHOR("Tronlong");% T3 W& `. [9 X: o3 Z: }2 K
MODULE_LICENSE("GPL");
3 I$ L7 u# @7 k9 O; V
" t" A  X/ r2 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 07:38 , Processed in 0.040432 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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