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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
2 K$ D( g7 a' F' j$ ~#include <linux/init.h>
! E" U& U8 j9 T8 e* C: b. f#include <linux/module.h>% P5 T+ n) ~- O/ ]8 q4 h, e3 |  x
#include <linux/kernel.h>; r. ]- x. O$ ?" p- O
#include <linux/types.h>& T+ {- u. T% W$ u* j: H- J
#include <linux/gpio.h>
* H  |0 c9 K& L" n- H8 Z#include <linux/leds.h>4 m% G8 H: }+ u# \# p. j, o$ r; Z6 }
#include <linux/platform_device.h>
3 U* r7 ?& I) }6 l: c: E1 P- [, x, `6 k) |# t! x6 Z. G
#include <asm/mach-types.h>& Q* h) [+ B7 x0 i) b
#include <asm/mach/arch.h>
' o1 r7 @$ Q$ B( v* u& d/ A+ c#include <mach/da8xx.h>
. U9 X& z7 X& M* y6 f#include <mach/mux.h>
0 I# E$ A4 l# M) j' x
6 V: @4 ]& {# g, ]1 K) E#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
8 W$ _- N% S/ \  U) u9 T. Q. V& [  C#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)
' M$ o* h- {( X( U0 V% L#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)3 g9 A0 [5 @& F
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
' U+ r# W6 G. v: C* Q% L& v
, c' x0 s! V1 u5 U/* assign the tl som board LED-GPIOs*/" ]; ]' t6 u* p2 y
static const short da850_evm_tl_user_led_pins[] = {
, r- D: k! R- `7 g! }        /* These pins are definition at <mach/mux.h> file */
, f! ?9 I, g3 I        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,6 G( }4 X$ G  i8 n( s( M
        -1
7 b0 ?( o; `1 d};/ K0 k& l  B3 d6 x. W; Z

% P) x6 v; ~, d1 a4 s# s9 l8 _8 sstatic struct gpio_led da850_evm_tl_leds[] = {
" j" o) D' Z: J& o* E        {
; P+ F/ B6 Z; y3 w4 C% x                .active_low = 0,
0 f" n! |! W- u# s                .gpio = DA850_USER_LED0,
/ M) I4 {  Q9 Q; g+ |, X2 f                .name = "user_led0",
+ ?! H+ ^. |- a) [! q5 W  B$ g( p, u                .default_trigger = "default-on",
6 x, B* K! A: S' L) C        },
  Y& k: P' v7 b9 f6 Z  T% a3 j        {; E& L; n) B& ^0 Z; V  F& \
                .active_low = 0,. h. z: @- s; z
                .gpio = DA850_USER_LED1,
  M  c0 o/ d- }* ?, J8 q& ]                .name = "user_led1",
8 {, a8 q9 ~% `# r( N1 w; _                .default_trigger = "default-on",: l( c- t4 Z# j9 s! ~
        },2 A* r; I# w: \8 _& `5 X. b5 I, W
        {
. ]# K1 h: G5 E/ M3 s9 I                .active_low = 0,
. W* ~5 m1 M7 z6 F                .gpio = DA850_USER_LED2,
$ a2 n) Z! \3 e                .name = "user_led2",
# w$ J  t5 G1 P% O& ~                .default_trigger = "default-on",+ x5 I2 z- K$ {4 K& r
        },
& c& {  b, X( X+ y% {* s        {. |7 b: t" o4 C  C! o% G
                .active_low = 0,
9 _# n- u6 J& }4 q$ y                .gpio = DA850_USER_LED3,- n# P* Q5 h! d0 P9 _7 M
                .name = "user_led3",4 x+ ~  Q4 o& c4 U7 I  A/ F
                .default_trigger = "default-on",* a$ r4 M0 t. B) H
        },
3 c4 n, R, C& w! X- j& e5 [};
5 f  p% s$ ~- t
% L  L" {4 w6 v7 R+ kstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
) f4 x- m# F4 w( T        .leds = da850_evm_tl_leds,6 H1 y6 q( K! Y# [( R+ u
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),' R( B8 C# V5 x% n
};* s5 P* Q0 {2 a* N

  Z' z* c( R1 |6 xstatic void led_dev_release(struct device *dev)
+ R, t) _5 E8 w9 _{
( I! E2 N0 a) X};
/ B/ z" b2 k6 a7 i/ A8 L( A) s' R$ P. b* ]( B+ u' t; W; _' u
static struct platform_device da850_evm_tl_leds_device = {9 e2 b5 K7 m0 A( i7 N
        .name                = "leds-gpio",/ x, z6 `6 ~2 J
        .id                = 1,) Y( x4 p  z5 Q. m3 l9 }
        .dev = {! d, ?) E0 i! b5 l0 l, }9 F
                .platform_data = &da850_evm_tl_leds_pdata,# S' W5 B9 d5 X4 D4 @
                .release = led_dev_release,
4 e  H+ `: E& ^2 I3 C6 B1 L        }( |0 T# o7 c- q  J! ^7 t2 [: M
};% O) R3 X4 w+ a: P8 d

0 h5 t% g9 U0 o: J  ostatic int __init led_platform_init(void)7 M0 V+ i9 S' X
{$ k6 h( w& E5 ~- A. K; W# ?
        int ret;! ?8 ~3 L6 F- Z  y6 M4 {* m
#if 0
" x; R2 X- q3 J+ G# L/ q! |        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);8 p) N( h$ Y( z( W% N, D7 c6 r; m
        if (ret)% D3 ~1 j  i  L& m+ ?
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
, @7 U  w2 d8 x5 c8 X+ N: g. W9 i                                "%d\n", ret);- j1 p8 @3 H8 |0 w! c
#endif
8 t8 j9 J1 f& q2 j5 s8 r        ret = platform_device_register(&da850_evm_tl_leds_device);. Y% k  n3 \- d
        if (ret)0 q+ u8 \) ]! c5 n
                pr_warning("Could not register som GPIO expander LEDS");
' G# X. L5 u) V, T# z, ^        else" z5 L* |& S- r* C. Z$ s$ Q
                printk(KERN_INFO "LED register sucessful!\n");
$ {, P1 ?9 V& s& Y' u2 Q3 j5 v+ i5 E( x4 G
        return ret;
1 Y9 p: Q0 t. z/ |; e# H: q9 X& Z}. ?; P  b' V* q2 i6 U3 v; k

7 U1 C1 k; r5 \7 Y# J$ C- J, Kstatic void __exit led_platform_exit(void)
" X3 H/ i7 M3 R7 ^{
8 B: L$ ?7 \/ [        platform_device_unregister(&da850_evm_tl_leds_device);
. I* |' Y! B( }$ Q/ [% Q$ {1 q" h2 O3 h2 @$ n
        printk(KERN_INFO "LED unregister!\n");
" }6 v! f6 E8 g}1 j2 `- E6 M2 d$ z

1 A. a# o( h3 ]2 Rmodule_init(led_platform_init);
: B* Y! p/ `2 N& d7 U, pmodule_exit(led_platform_exit);
9 Q; [" S8 O$ m6 B  m. \
, O1 k- T% ?; L5 p2 u9 |. T2 ?MODULE_DESCRIPTION("Led platform driver");
( ]% I; n- D- X* k: ^5 rMODULE_AUTHOR("Tronlong");
0 R, n  k: _0 `MODULE_LICENSE("GPL");
2 X; s$ W3 \7 W6 B2 ]/ k8 B' \" f* c: G8 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 15:31 , Processed in 0.040047 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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