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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。7 a& w" A4 X6 p% t7 h5 J) ^; ~& K
#include <linux/init.h>( [4 q$ W- y. ^% D
#include <linux/module.h>9 R2 K& i6 E8 c7 Z
#include <linux/kernel.h>% V5 p' F' S. [: e6 `( y0 \
#include <linux/types.h>7 O/ U7 y6 r- m+ }
#include <linux/gpio.h>
9 ?* y7 x5 p& [) _- P#include <linux/leds.h>( _# ?9 X2 f) a* @
#include <linux/platform_device.h>
; p% t: e( E4 T3 D* Q1 |6 ?4 o3 ~6 p
" S* A* M. C# L- V# }#include <asm/mach-types.h>
/ z1 I8 o" w6 i& T#include <asm/mach/arch.h>
4 Q, Z; B( i# g8 _#include <mach/da8xx.h>- Y$ R& X7 f* l9 [
#include <mach/mux.h>1 p! ^1 V# O9 _1 _( R6 k' ~7 z" Y6 N
% f7 [2 }# ]+ d- w$ |" y
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
, m/ Z5 @6 z; q#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)& k* @9 O- t" G6 ]4 G! o( _1 m
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1), Z: r# P" F& h7 V+ n  G
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)7 \6 }) I& {: ?  D0 V2 I4 i, D

  z, j: a* f3 K0 H3 l9 J' b) M" _( p. o/* assign the tl som board LED-GPIOs*/
0 D- T8 V# t- }3 lstatic const short da850_evm_tl_user_led_pins[] = {9 F( R1 K: ]  F8 y
        /* These pins are definition at <mach/mux.h> file */
& s& w# r) C& r; E" I4 U& }& L        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
! S9 r- a) D0 D: ~2 p  A6 C) p$ b        -16 x: C0 l- H- X" t6 t
};
5 z2 s/ F8 t9 t- w4 q7 R/ X. i+ f/ Z1 o; Y$ Q" i
static struct gpio_led da850_evm_tl_leds[] = {; ?, u9 f& x, Q8 E
        {
, c6 m6 U: J: N                .active_low = 0,
) H/ j* `' n1 o6 W. O                .gpio = DA850_USER_LED0,
" p" @! m) ~. J  \9 L& R2 x                .name = "user_led0",
  v& J+ L, q% z& z) h) t4 Z8 u                .default_trigger = "default-on",
* z& |1 x4 T5 C. S& Q+ m8 N$ f        },4 u# I/ S5 H/ i/ m8 h
        {
, s- g8 l' H2 g1 z                .active_low = 0,; P3 Q1 U9 c1 T6 Q) l9 `' L+ F
                .gpio = DA850_USER_LED1,; S: }' `/ g+ z* ?* K5 ~
                .name = "user_led1",8 l/ c# R  j: d8 I; I7 M- R) Z0 t
                .default_trigger = "default-on",/ p& {$ s9 t$ l# g7 g" ^7 u( b4 q
        },
0 o. U0 O* Z* s, {8 q' ?$ g        {5 g" T. c5 m2 W7 R+ B! [
                .active_low = 0,
4 {* h* V  p  S" {4 L: R2 U7 y                .gpio = DA850_USER_LED2,
7 E5 K; S* V* p6 D4 \1 e( [) D                .name = "user_led2",
. t* n9 W& b5 c; X! T% f                .default_trigger = "default-on",% }. x! ~% D& b
        },
( N4 s6 A" W, ~0 U" X1 {2 o        {* d+ S1 q$ `: _/ V; B
                .active_low = 0,+ o( j9 Q8 J- C6 B* Y+ p- E; _
                .gpio = DA850_USER_LED3,
& T0 ^3 F- T* y9 H- y                .name = "user_led3",
8 \. d' {# R* B% D- l2 J' W                .default_trigger = "default-on",
' f9 h! ^: \; Y8 e% r2 M        },
5 K5 y- s& _) J, D4 B/ X};
5 _- ?7 x8 u( x4 L+ L& l; X3 Q4 |- `1 p, L
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
2 a! V& p- V/ u3 D, c        .leds = da850_evm_tl_leds,& I, W$ F! b0 N- ?% C
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
) m" q. j3 @# e. m. c' X9 ?};$ a3 Z2 f' B; [3 a

# {7 @6 A6 I+ U3 M! Y& w4 Sstatic void led_dev_release(struct device *dev)
- W; F! ]) `( g. j7 i; `{! y+ @: P' V5 c0 T2 A
};/ D' f! H7 b) U7 }0 G6 A7 R" G

4 x0 ]% g, Q9 t/ }6 v. ]3 P3 estatic struct platform_device da850_evm_tl_leds_device = {8 B/ I0 F# G) T, r: l$ `
        .name                = "leds-gpio",
" k# X! X" Y% m        .id                = 1,7 Y( [9 D8 J/ D1 [
        .dev = {3 l$ u1 F6 b1 N5 ^' u1 c4 ~
                .platform_data = &da850_evm_tl_leds_pdata,9 D# b- q. v% {' Y, ^7 _
                .release = led_dev_release,* g. B6 X3 C6 Z# F, t) F2 {
        }5 w" V6 A3 ?. p7 j
};
. W2 m* y: b: b0 ~9 c
7 }% l2 B" U& v9 I3 n) c- \. ^static int __init led_platform_init(void)
6 U  P9 r6 W/ V- N) U* E* f( j# e{8 I' \6 J4 C( v  C4 W6 g
        int ret;
7 }1 e; s+ J/ h; a4 N7 K8 a1 R#if 0; e( F0 Z* C" T
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
3 ^0 ~- E1 `& s7 M% l" O8 K        if (ret): R- f6 i) Y* w- s: A' f
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"# B4 X' u( _0 i, k* V8 h
                                "%d\n", ret);9 r" `1 e1 o& e% O$ u7 [! n, H' b: T
#endif
( N4 D+ b- h1 ~) b2 L/ w# N% @2 w        ret = platform_device_register(&da850_evm_tl_leds_device);" u6 P; E# T7 V0 @( v( U
        if (ret)0 \$ X# ]! n1 k9 u) h  N
                pr_warning("Could not register som GPIO expander LEDS");
8 o, b* v. o, q        else
# a+ }: `! g+ ]& E1 Z7 C                printk(KERN_INFO "LED register sucessful!\n");  N- R& z% d. b" A

8 t$ K% R, A! C& q        return ret;8 J9 c  p/ a3 N; `' _# ]* S. ^
}
0 K! w$ F7 c7 e
" ?# q$ @. ]- P6 s$ jstatic void __exit led_platform_exit(void)
/ d: j. U! B# Y( [# C3 l" N{
0 _/ ?! @) x( M6 C! }& h, q0 p  c        platform_device_unregister(&da850_evm_tl_leds_device);
9 Z5 P, d8 E9 O8 t: {) ?. J1 {; _7 v3 I2 X1 R* F2 _6 v. x: {
        printk(KERN_INFO "LED unregister!\n");
3 [/ w$ {  F8 @- r3 e}* O( \. x: A# [! `

# N5 z) }6 }/ ^  Imodule_init(led_platform_init);" M# c0 I  n& m9 ^% K" ?
module_exit(led_platform_exit);% k! l( v% {5 E! [( R1 N% z
- i$ A& \* c3 [
MODULE_DESCRIPTION("Led platform driver");& x. z& T" a( W3 w* [' e' ?, I' c
MODULE_AUTHOR("Tronlong");9 O6 Y6 y, A0 \2 A4 F9 \
MODULE_LICENSE("GPL");
% b! s! J+ i0 g. e/ ?
( I) O* u* ~" v0 n' `' B; `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 12:46 , Processed in 0.041777 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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