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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
/ F( t+ ~7 y+ q8 p) p" M#include <linux/init.h>
* N2 U4 z% M6 J- _4 ^4 |) E- Z#include <linux/module.h>. `. j, ]# Y) w( _
#include <linux/kernel.h>- t7 x+ {9 a; A- @5 v- @
#include <linux/types.h>9 X( s) R7 O: m6 O" f
#include <linux/gpio.h>9 d( ~- }% }) ~+ s9 Q
#include <linux/leds.h>
" i. D8 b& V& N9 Y- T# c#include <linux/platform_device.h>
% `, r. n/ i# A# E( |  K( o
) B6 Z5 s& p( ^% ?1 U* g#include <asm/mach-types.h>, P" z# b. h* [$ j+ N4 T
#include <asm/mach/arch.h>
% ^! u" t" u, X4 ^#include <mach/da8xx.h>$ l" q  z2 _$ W( `# i$ I4 B1 ]7 x: `
#include <mach/mux.h>
$ i! g5 }& a' P5 E. X  J8 ~
) N7 p2 z8 W8 }$ T8 J#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
- z! N* B) r* [( y% ~3 o#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)" L2 l, |$ s2 o( y; B( d, ]
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)
* p4 q& v" ~! W, y#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)
( C2 D5 B- U* E) d  k: D
  {, j" Y& X( o3 \( X- {% z/* assign the tl som board LED-GPIOs*/; A% {# f0 T, O; V
static const short da850_evm_tl_user_led_pins[] = {6 D5 O3 S8 ~; c
        /* These pins are definition at <mach/mux.h> file */
: }* D, D; ^  Q' z5 S' I! T        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
0 b. e5 q! M9 L! t$ C        -1. r, V, }  _3 ]3 x% I
};: {" v3 b( I. g$ ]1 [+ p4 _+ q

$ W5 w+ ?* b  f/ _1 }4 `static struct gpio_led da850_evm_tl_leds[] = {3 X& B6 U4 Z# O# U7 w5 \# q
        {
5 v3 [1 `0 r8 T2 i4 u: C' `5 J                .active_low = 0,
! c! d8 u4 A$ a4 M3 b/ p                .gpio = DA850_USER_LED0,( F+ D- P- a! R/ R: N0 u5 f2 {
                .name = "user_led0",
1 e) V7 a; H) i* G' C8 U                .default_trigger = "default-on",
5 [* z( o* f0 f! ^9 i        },& G( M8 b2 P+ E7 T
        {, K* f$ C, ?" _- U, o9 s
                .active_low = 0,
. a+ z6 @: F$ b4 j; F                .gpio = DA850_USER_LED1,+ A# q# c& P4 @- I; F: h& C% g
                .name = "user_led1",' X, n* z3 F3 t5 h3 m
                .default_trigger = "default-on",& N. x, L% O) @
        },8 ?3 i# W: Y. L8 Z' D( v7 `
        {* V+ m1 A% P+ l7 U( O
                .active_low = 0,
: o" F6 K  V! k, K& Q                .gpio = DA850_USER_LED2,
: y" t9 c/ ]* F* o- g, A                .name = "user_led2",. _5 V& Q& o" P
                .default_trigger = "default-on",
+ S* l$ w) W1 _5 b1 U        },
7 I8 s8 N& J0 J2 ~8 W        {
" E$ d# d4 j; ^4 |                .active_low = 0,; W, [4 `1 \; _. F% w. w
                .gpio = DA850_USER_LED3,# k* n5 {! p- S- {
                .name = "user_led3",
. ]! ^4 ?7 j" d2 n, E" V                .default_trigger = "default-on",
3 Q" |1 A9 `5 w' I# E        },5 W1 [8 X5 L/ {5 U
};$ D2 D- ?2 N* q" }7 y/ |

2 k2 M& y! }8 X  Ustatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {0 n, c& p  l/ o; `
        .leds = da850_evm_tl_leds,2 q# ?7 V" t* N
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
6 e% I4 h) Q* Z; P2 S( s};
' I3 _- M- m% J
5 y: m4 u. c2 l* wstatic void led_dev_release(struct device *dev)8 q6 o% r% A& R0 o0 P3 t
{
+ |5 y4 h  X9 ~8 ~: N* A};
! d/ [6 A: C+ z+ ^0 z% X( h6 z1 D( I/ e; t' R& }: y
static struct platform_device da850_evm_tl_leds_device = {: G; `5 ]' W4 ~
        .name                = "leds-gpio",
& H- d! Z9 l0 x3 Q$ s        .id                = 1,
1 [7 [. p8 n9 G) }) I8 y6 B/ F        .dev = {5 L; D( f$ h0 i: q- r
                .platform_data = &da850_evm_tl_leds_pdata,
! Z! ]3 P0 h3 m& e                .release = led_dev_release,
; a3 H2 d, T: Q        }/ Z  c# L/ @4 G5 u9 |2 Y5 P
};
1 [& A" p3 ?* \- b
9 K! j  E" u$ D8 W, pstatic int __init led_platform_init(void)
. {: W% ]6 A3 P( t/ Q* M2 U{3 F& s5 o3 b! M  y5 o, E
        int ret;' V) ?$ n; l8 i
#if 00 a7 X  k2 h" C- {- H- h
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
6 X0 E# N, `* J2 a        if (ret)0 U/ W% w& F9 O2 W# }0 F
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"* S1 Y) I  T6 Q3 N$ {4 |
                                "%d\n", ret);$ {* x# j4 @" }% q1 v6 v1 b, y  i5 ^
#endif
& s. s" b, M8 E) }, Q0 R& d9 m        ret = platform_device_register(&da850_evm_tl_leds_device);
4 b7 ~, @" C% G5 g% a        if (ret)% _1 r7 {& _! x% y1 s: q6 m
                pr_warning("Could not register som GPIO expander LEDS");6 \5 O) S* b' I1 S- l1 V) ]9 l; z
        else: g" X# t) _$ L7 j  J
                printk(KERN_INFO "LED register sucessful!\n");9 V4 x  U8 U: i7 W* r0 a

' ]& t( Q9 k0 Q' W; B! J* a" @        return ret;
  Z; z+ n" ~9 o& W+ u}
' @2 ~1 [0 F& q4 h* E! }& h  t2 G
static void __exit led_platform_exit(void), X8 |$ ?9 ?- B
{
( I+ y$ e& Q0 W( T5 P- T' d; N        platform_device_unregister(&da850_evm_tl_leds_device);# \) f& k' [$ z2 X' |0 z2 W

0 J+ B! h. n5 X0 q        printk(KERN_INFO "LED unregister!\n");, m, H1 A3 s5 S
}
& R+ S3 y( V' @$ m( E
- c/ ?; ]# Q0 n) ~7 pmodule_init(led_platform_init);
* E" P; `% X* H1 W  }: fmodule_exit(led_platform_exit);
" l) _" [  [' `  l  E
9 k& o+ f) _/ Z6 b, J% ]MODULE_DESCRIPTION("Led platform driver");( w/ W* }- I2 B7 q, A/ @
MODULE_AUTHOR("Tronlong");# Y+ w2 \1 X6 n/ h0 h  I! H
MODULE_LICENSE("GPL");
3 y* X8 d5 r7 Z$ v
0 _3 b0 o( j0 \, G% [3 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 06:17 , Processed in 0.041544 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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