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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
% P# f" }  B% T2 Q, \9 x#include <linux/init.h>* O9 S8 H& u* \: l7 M& b  [: J- _2 p
#include <linux/module.h>
2 j+ X& k8 E; H( }1 f  Z' h9 Q#include <linux/kernel.h># }9 r: A0 \" i2 M4 T
#include <linux/types.h>" u  y5 T& S& g% Q8 g6 J$ Y6 q
#include <linux/gpio.h>
( E% w' }8 e# P. h#include <linux/leds.h>
$ I: O" X& O4 w9 \6 V; ?- U#include <linux/platform_device.h>3 ~( n3 e( W8 d* u1 r' `

* Z2 N" U1 {! c6 P+ r; d1 d#include <asm/mach-types.h>
9 d: Z  S% G  t- H0 o6 T3 `9 }; L0 I#include <asm/mach/arch.h>& a1 d) p* c5 z, H* \
#include <mach/da8xx.h>2 `2 W0 D) E3 k: d& {  j0 h
#include <mach/mux.h>4 a4 F! n) x! s' }/ A( J

5 q$ R$ ~: J+ w5 c3 _6 v#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)1 L& _  T" m( M" e
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
) @0 p# d2 b' s3 w5 {! [/ r#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
7 d& ^' u8 |  v- ]% x  ?#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
: o# a2 c. s/ l# a8 E: ~! l! p$ R* m# f. M' [! \
/* assign the tl som board LED-GPIOs*/. E. ~. F0 d5 Z" v* x
static const short da850_evm_tl_user_led_pins[] = {
" ~( i8 Y! Y% y5 L, A" V        /* These pins are definition at <mach/mux.h> file */
# g/ t! j, m5 [' T: {        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
- D3 G$ D' M) ]. Y6 N; R* D$ g, B9 E        -1! r' D6 w! W" o
};! J; P7 @! R% w1 {0 c
# }9 d5 }% I) Q& e+ J9 W. Z% A4 {
static struct gpio_led da850_evm_tl_leds[] = {( d5 s! S: J/ }6 x+ M  c# t
        {' h8 N1 R; Y$ |- a; b( X. B8 V
                .active_low = 0,+ Q( @, l) v1 T2 Y
                .gpio = DA850_USER_LED0,
2 C7 z! D" Y+ ?, }" l, ~% b5 Z/ ]                .name = "user_led0",
2 A2 m) L9 O5 \: A+ _0 z8 S                .default_trigger = "default-on",5 d( B% B% D. j, r
        },0 [+ C& O8 O' d: {3 q) E3 f# b
        {5 y1 E$ g+ |  @4 y. K& ~& k
                .active_low = 0,+ A/ I/ z8 t- R# ~& D/ i: v
                .gpio = DA850_USER_LED1,
: W  D* ]# a6 I' w# a' Y3 S                .name = "user_led1",2 j9 Y) E6 |( O3 D4 P  D
                .default_trigger = "default-on",4 R" [) l2 K8 |9 C. X  d
        },( U; ~# v; y4 W1 j( b" B$ @
        {. Q* p" s, V% d. X: ?9 {
                .active_low = 0,
7 x8 X( G5 j0 C) y# y) U9 t                .gpio = DA850_USER_LED2,$ P  B' P: R5 ~8 }6 x
                .name = "user_led2"," R% j; S7 `$ L, Y$ t! J4 o. A) J5 T
                .default_trigger = "default-on",. z& `* L$ v: C
        },
( V# k. c  ^8 a        {# W5 w2 y1 Z' K2 V& I
                .active_low = 0,
. M  P% b5 `  W                .gpio = DA850_USER_LED3,
8 t) k: o( R7 p5 f# a! e. D                .name = "user_led3",% q$ E# G& g6 \. G2 F
                .default_trigger = "default-on",
6 N! v/ W3 G- G# X/ c5 y/ O; U* A* [        },/ P9 p/ a; a% a( W" Y1 d( p+ |
};
  J+ j3 \" j( _: b
; _! Z" C" C2 ?9 W4 Estatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {; `% I* S0 M  T3 w
        .leds = da850_evm_tl_leds,& z8 A5 I+ _6 p' ^1 W) R- n
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),2 @' n) m) z8 w/ @
};. ^6 Y8 J6 M) b

0 `& k  c" }6 m. P8 e6 _8 Rstatic void led_dev_release(struct device *dev)
* s5 q: ~9 u7 D& A- P/ B9 B+ ~; B{
- }, `' {1 ?$ j# N};% L2 A4 m3 B1 n# w$ r' D

. [3 l( ]5 r* x: ]( s" Q' `+ Zstatic struct platform_device da850_evm_tl_leds_device = {
! z6 s3 S) m! P' u9 h2 {        .name                = "leds-gpio"," k' t  R$ ]: x/ q& d8 T6 `
        .id                = 1," G5 a, A' }; i7 D# K
        .dev = {
2 m0 R" n0 z- }5 B! b  B8 s                .platform_data = &da850_evm_tl_leds_pdata,( W% M5 f' {2 `( h+ B5 C4 u
                .release = led_dev_release,% L: F9 |. e( Q. g
        }
  c2 }. x1 r; u0 v# t};: b; e5 Y8 V6 h& l& V9 ~2 D( w

0 V& d8 N$ n, |  ?* C( g" c2 {/ Tstatic int __init led_platform_init(void)
& N( y/ n3 J6 w; c- x) @: X1 R{# h8 X0 x# z( z( h' ~+ x" |0 y/ j
        int ret;
' n7 ]6 A$ R" X! E( Y4 m! C#if 0
- K7 l9 Q  G( ^. r% z        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);- T4 \! P# o  t- m
        if (ret)
! P2 t! K0 c; b- @: n                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
+ M% l/ ~0 v# }. l$ u5 J                                "%d\n", ret);
8 E$ o; g3 W: _% a8 H/ I#endif+ Z0 [" a7 |+ A: r
        ret = platform_device_register(&da850_evm_tl_leds_device);; i- Z5 D' G; J) T
        if (ret)
9 F; s( S1 `. x  x  p% a                pr_warning("Could not register som GPIO expander LEDS");& x+ E9 P5 F6 }2 E; p5 f
        else
( a* F$ j# g6 \% D0 X. d                printk(KERN_INFO "LED register sucessful!\n");
1 c) |( N0 Z  T7 u$ G
  @: H) K2 @8 G% Y% T) j' m9 W        return ret;% g% z$ x! X0 S% K8 O; S6 Z
}
  N7 k( m2 v1 i7 H& ~& `+ h  o) ?3 P+ ?0 h' @* p7 V
static void __exit led_platform_exit(void)
& E' W( v' X- H9 u{
  E7 Q) J) }5 ^; K( c( J; m        platform_device_unregister(&da850_evm_tl_leds_device);. g/ G6 q" C9 \6 j

/ m1 ~3 j9 B/ |* ]( L        printk(KERN_INFO "LED unregister!\n");* e% Y" Z7 T( ^2 Y/ @
}
5 C  N4 q+ [* P3 s" ?9 d  O" Y6 M- x1 s4 ]; g8 j
module_init(led_platform_init);
3 ?6 u& s9 C6 @+ ~* t: J& mmodule_exit(led_platform_exit);
/ B, m) t5 v0 T( ]" K
8 ]1 @) f  z  X4 b+ WMODULE_DESCRIPTION("Led platform driver");
: S7 Y/ N8 s. _% LMODULE_AUTHOR("Tronlong");
# i8 k! ]# ?, CMODULE_LICENSE("GPL");" ~& D& g( i# w3 A" Q8 W% @3 n# I

) d# Z" K; j+ A! p+ H7 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 17:37 , Processed in 0.064324 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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