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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。8 F0 }, b; `% s" X: A/ t. B% E
#include <linux/init.h>: g# m* |# p3 s7 B% X8 c7 R
#include <linux/module.h>
& ]$ q" N& K+ Z. O6 b* t" c#include <linux/kernel.h>8 }; k- s) Z8 T4 z4 x. c& O2 S
#include <linux/types.h>4 }' E7 D- j. L3 H% G
#include <linux/gpio.h>4 \. E) p5 \3 `' M7 q
#include <linux/leds.h>! v8 k* C! L) X$ k3 v5 S& ^
#include <linux/platform_device.h>1 I4 y; q# Q& V
( N8 J3 ?  t# u& J% C
#include <asm/mach-types.h>
# ]1 Z4 s& `2 A#include <asm/mach/arch.h>1 \# l6 |; [& I& q4 E
#include <mach/da8xx.h>
4 P* Z1 I4 h& s  L! G2 Z5 Q4 b#include <mach/mux.h>3 i0 o& d2 v7 q; N
0 ^+ ?: E# w; y0 |- a/ M( O
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)# }7 d* S$ F  T& p3 X0 b
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
+ ]& s4 I/ r, c9 F5 [#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
1 g% \0 c* g$ \* Q* ~: d9 f$ p#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)9 N; {4 K+ W# ], W
" e( {/ u1 ?- a7 w5 D# N1 e
/* assign the tl som board LED-GPIOs*/# v; S. f0 m+ x) {- g
static const short da850_evm_tl_user_led_pins[] = {
6 T: \; q9 X* e        /* These pins are definition at <mach/mux.h> file */& C# w/ S- n* d3 K# c
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,. g5 F$ `4 i$ S4 {  a8 Y
        -1
! s* B5 [+ e7 g% |};. A1 _3 i7 Y2 T% O1 u5 r
0 V4 b$ i* B; ^8 C* C$ C
static struct gpio_led da850_evm_tl_leds[] = {$ r0 ?$ s! U; g8 {5 t6 T
        {
6 a, S/ M0 H* N3 B6 Q                .active_low = 0,/ I  Z! N$ z( Y5 P7 N- k* a% T0 ?
                .gpio = DA850_USER_LED0,0 h, M( j- @( N$ U
                .name = "user_led0",
9 G4 _/ u  D# ]$ V                .default_trigger = "default-on",
6 e& q9 M. t4 V( \) _/ s        },
) [3 t: I& d2 ?) ]# X3 ]        {
' x3 \9 n$ Y' c8 k9 s+ S. j, @" _4 }                .active_low = 0,/ c4 f& h6 V* s" t( i) p# }
                .gpio = DA850_USER_LED1,
  U( }1 w; X' w# g1 H. T                .name = "user_led1",
9 ^+ P6 G3 l9 I9 g; ?) [, i                .default_trigger = "default-on",7 h& r- Z* f" Y/ g2 Y
        },5 H! x/ ^4 f) i; F+ G3 L2 {. p
        {2 d# b, N, G6 L1 Z
                .active_low = 0,. f) w5 p: U1 J" T. t2 t
                .gpio = DA850_USER_LED2,% z/ \+ V  g% L
                .name = "user_led2",% q5 g3 q: T0 \! ], V# t& o; t
                .default_trigger = "default-on",( t+ y8 w" k. A
        },
% |, ]7 j( t% s" H7 B  f        {; g& K; v+ C# Z9 p' c
                .active_low = 0,- r: ~; q9 |; D1 m( o$ o) t
                .gpio = DA850_USER_LED3,
4 v& \0 x; V& P7 \9 X& S7 b  o                .name = "user_led3",
" d8 r/ E. R0 W4 ]/ M5 z' {* W                .default_trigger = "default-on",
* U- l# e3 I: y        },
3 ^: p$ Q, I1 B' Z( L! v$ o) e& r};
1 S, k# w# Y* V6 J3 P3 {: b6 }4 q4 r( h2 e4 }: t. Z
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {) R& x; \8 H$ n2 J( s+ E9 ^$ @' k
        .leds = da850_evm_tl_leds,
# O2 s* o7 N% g; t        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
3 |; K. ~) i& j( V" s. Z};2 S8 s7 L6 x  E

7 C5 S( k- \+ }9 J2 `; {7 U' Estatic void led_dev_release(struct device *dev)
: P' M9 W1 H$ T. K' ?4 G7 h{0 r2 b+ j% ?8 d9 |3 W, Y* b5 J
};
: S* D% t0 I% \& I) F7 r6 \, Z$ Y" H. f5 y* H
static struct platform_device da850_evm_tl_leds_device = {
; |2 ~* c$ ?( D7 z        .name                = "leds-gpio",
. f8 z; p0 R% L( [8 g( b* X        .id                = 1,
0 e. v/ g% E$ ^        .dev = {! U& A5 A% M  j
                .platform_data = &da850_evm_tl_leds_pdata,
" U8 k9 a! j- W( t/ o+ D, F                .release = led_dev_release,
' B2 e% {) E; H3 x! P        }
/ v4 B" E* K+ h8 l* W  P+ K};$ Z; B, ^2 C0 X/ |
4 }8 S0 Y% a% p' {
static int __init led_platform_init(void)
' H: B( _* N7 `" s4 D{
. m7 |" d' q8 d7 U. I        int ret;$ }- b" I$ D% P
#if 09 o2 R+ a$ n) m5 P8 F$ y, @7 F
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
" _0 j. S& {  {: P9 p! }        if (ret)
, d% _2 E6 @) G" l4 i' Q3 s                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"6 R6 E) z& U) W
                                "%d\n", ret);6 ~) r, w5 [, q: h. }7 Z/ u
#endif
% o. b& f% `# a- v+ u/ s        ret = platform_device_register(&da850_evm_tl_leds_device);
8 K3 D0 ?# y! w        if (ret)
8 _$ j( Q/ N# l. `3 Y) f5 r: [3 p# B                pr_warning("Could not register som GPIO expander LEDS");
% F, h1 _- ~+ G: U% L        else% x/ I& g0 |! [0 W
                printk(KERN_INFO "LED register sucessful!\n");
7 ~$ \  N. Z& Q
; y+ L+ v+ A2 Q( I* H! Y% d1 V0 ?  a        return ret;
  t2 a% v9 b: D2 D1 @7 ?$ I/ l}- S2 r8 r( C$ I1 c

4 q# r& p* {+ T3 F, W. ~, c- ~/ Q/ `static void __exit led_platform_exit(void)6 N0 Q3 f' l5 B3 h
{
/ \' \* U- E3 _0 U  w        platform_device_unregister(&da850_evm_tl_leds_device);4 H1 K; d! W" }$ `" [% F

% t7 i9 G2 _) K9 [" n: E$ E        printk(KERN_INFO "LED unregister!\n");) m& a7 [+ \+ |) u1 Y* _) R
}
$ v9 W" R- `2 s, J) {1 u# J0 k! f! `( h
module_init(led_platform_init);& [* {7 F3 `/ g, R" A
module_exit(led_platform_exit);
' V+ E- |0 g/ {3 N1 s: }3 \+ N6 t  j/ w: Q* M( _2 A. D
MODULE_DESCRIPTION("Led platform driver");
4 o- E3 s- d6 Y# I9 V8 v# i" ?8 aMODULE_AUTHOR("Tronlong");# d6 M( P5 _1 G6 E2 u5 ?, ]
MODULE_LICENSE("GPL");
" a8 j/ I5 W& p5 H7 B9 Y( J! z* @
: t) @: U; Z( }  p+ O5 A! _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 00:31 , Processed in 0.043901 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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