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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。0 H2 p2 ?1 \* E+ N6 m% j5 w
#include <linux/init.h>) x5 N0 a7 s& u' p  s- W7 P1 d1 ~
#include <linux/module.h>, b/ n& ?9 n' h6 y* s4 a
#include <linux/kernel.h>% \# H3 U) {+ P/ R3 `* V
#include <linux/types.h>$ g* t! Z+ c: _% o+ s9 n
#include <linux/gpio.h>( x5 I8 J( |# s+ W  \% I# E# J& c
#include <linux/leds.h>
: b& N; Q1 s3 ^9 g1 q2 `#include <linux/platform_device.h>
* X- P' S* ^* D) a8 S  f7 s
1 g" i, e5 t4 }" S3 j/ n% x#include <asm/mach-types.h>- _' R+ u7 N$ G) E0 z4 A2 W
#include <asm/mach/arch.h>
2 n- ~; r7 k( C#include <mach/da8xx.h>
! {1 _7 E/ ^8 {0 L#include <mach/mux.h>
' Z: c* j+ c6 D! x) J7 w3 y
, r% V3 }) y0 G' |- r#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
. z: j4 J: E: r7 }9 O#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
2 t8 S- F7 D: r2 M: V- n# u#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)& G* j- f% L# ]4 x+ n2 F
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)' `8 N; ]+ V+ y0 `( Q5 ^; C9 g
8 j8 g1 l5 \5 [1 {! ^
/* assign the tl som board LED-GPIOs*/
, T8 ]" I5 F: R9 N- F- zstatic const short da850_evm_tl_user_led_pins[] = {  q, n( b0 N* }2 [- [( K/ s) ?
        /* These pins are definition at <mach/mux.h> file */7 b4 D) r' w1 K- A' q
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
* L( x4 {( I+ c; u# m$ x5 ^1 a        -15 B; l) X) `$ ]  V) R' G
};) M% H* q! v4 T8 N2 v
! E' [3 S8 V( A4 h* v
static struct gpio_led da850_evm_tl_leds[] = {
8 x2 C7 S- b* s, Q& y; M) S7 J        {/ n- Z& g8 p. J% H! [; q
                .active_low = 0,
" O* v9 m6 D9 D3 v4 B4 Y                .gpio = DA850_USER_LED0,
1 Q7 ^' ]3 f( B* I8 @+ A, j                .name = "user_led0",
$ u: W2 P8 Z' p: w  w3 ~6 g. ~2 l                .default_trigger = "default-on",
$ a0 @2 z3 V) C" m: s        },$ ^: A( ]' p( a' S0 c
        {
* \0 P, v' t: `% A0 F" t                .active_low = 0,# C# P0 g8 ^. l4 K! k+ k* \$ r
                .gpio = DA850_USER_LED1,& X  t$ @# l  I7 _
                .name = "user_led1",2 o9 Y. ^$ B) A( @# Z  |( g( w. G6 @/ Z
                .default_trigger = "default-on",* V9 m. U" ~4 ^. Y7 w
        },! B% l7 _& a- F4 h, C
        {2 u8 C! X2 U/ e: N# h' D* S% j7 o
                .active_low = 0,( O7 E% ]+ |; g& V. m) ]* C6 f' [
                .gpio = DA850_USER_LED2,
% Z; O1 f8 `- ]+ f) I0 N+ I                .name = "user_led2",6 _; C8 p1 t: o" i; V* b
                .default_trigger = "default-on",0 Y: r8 r6 w: K  i
        },5 A) k# g& A: m1 o+ O5 S
        {& T; H7 q- w( D' J1 e5 ~( v
                .active_low = 0,
, t0 O0 s/ y: X4 Q' ^                .gpio = DA850_USER_LED3,5 w" k; e. g7 h- s' j1 a
                .name = "user_led3",
! t. V  r% O0 x- o                .default_trigger = "default-on",
' H$ l" V, s. v5 s        },3 b% ^5 M) Q: G, U( s# `: K
};; U+ O+ ^. Y. H

2 _' ]' u  R+ |. \static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
7 {8 e0 G; y: B: H0 H. x. l* X        .leds = da850_evm_tl_leds,2 Q1 k6 n6 F. @+ e& n6 K$ W
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
! U* Z7 n  t, \6 Z; q: c};
# q: C- c8 P. G" b& [" X/ O" t  n7 a, [; q2 z# }# h
static void led_dev_release(struct device *dev)7 D, z) O: A" r) v+ D- f5 `
{
2 }# l; ~( P* e0 g1 V3 N};. K: z7 y) q# O/ A# q, ]
6 `. m/ |7 K" L2 L# t
static struct platform_device da850_evm_tl_leds_device = {  {+ m/ l! V. ?8 L/ |5 O
        .name                = "leds-gpio",
& J1 s& c9 k. f2 X( ~* o        .id                = 1,
& L+ D/ X4 ~* u% t/ U+ C, m        .dev = {& R& g. Z% h) Y% e4 e
                .platform_data = &da850_evm_tl_leds_pdata,
" X# k6 C) q& K( C, D: B4 s* `                .release = led_dev_release,
( f+ Y! N4 ~9 L" [        }. i. B' J+ N6 p! m$ B- h8 \/ j/ k$ C
};
* E6 J( N0 e  h4 A) \9 I
. K9 a/ k% X& K2 d5 a$ Y, xstatic int __init led_platform_init(void)
2 }% [7 C7 g& ?{
- F- G  q! s- x5 e        int ret;
( A" K% \  S( @* y+ H+ ]* i#if 0
. s5 A7 q0 n2 F; D4 h2 C; e        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);5 d# W* g/ o: d* N, f0 Q: L8 V0 c
        if (ret)
( h1 R8 k! j: x4 Z& i: K* i                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"- b9 A' r; s, G6 S) h! t3 p' n+ ?
                                "%d\n", ret);6 z; n! G+ l% h2 E' l
#endif
2 z. ?% Z. [; y& @7 Z$ J        ret = platform_device_register(&da850_evm_tl_leds_device);
! ?% {( v" @& I4 ?0 @6 b        if (ret)
' }' w, ]. o  N' E% X                pr_warning("Could not register som GPIO expander LEDS");4 a( U' Y  l& C% {, [. u
        else
  T5 D* W, p  a% f/ a                printk(KERN_INFO "LED register sucessful!\n");
  x1 A7 r- h4 A# m5 a3 E* \0 b" {0 d. A2 k
        return ret;
7 l6 s2 f, Z" U% m7 ]0 p+ ~}
# ?2 C: h, K6 G' M$ h/ p0 B: r' \/ S5 S
static void __exit led_platform_exit(void)
; W/ L; ]  G( ]& v; a; i5 Q; E{6 e7 A3 Z% \9 ]8 D# D( O* h
        platform_device_unregister(&da850_evm_tl_leds_device);. b" c9 y  i2 W* H) d

- U, I3 t9 B+ }0 r% X) u+ U% _        printk(KERN_INFO "LED unregister!\n");
& N8 Y. f) z2 ~6 p}5 `- t7 k/ k6 h( k( @" K
$ g" c4 N+ K6 O' b+ D/ B% w; x* a( t
module_init(led_platform_init);* z/ O4 |# r. i& x5 l! }
module_exit(led_platform_exit);: g. ^8 [5 s3 t/ a1 R1 ^7 B2 z
2 E0 ~, ~$ b7 Z  I/ R4 p% e7 b
MODULE_DESCRIPTION("Led platform driver");. M. b, ?( F% D! ?( b4 N
MODULE_AUTHOR("Tronlong");4 `- U3 N& ^) }
MODULE_LICENSE("GPL");
5 h9 r7 @* l+ ^: _( i) Z+ Q
2 e4 Q1 B4 t3 Y$ O* w1 C0 x: I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 11:37 , Processed in 0.044502 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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