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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
$ P8 x8 L- c- c7 p* e- {0 w0 n, n; t#include <linux/init.h>) n: n) E- l  M
#include <linux/module.h>! @. z1 `' c+ ~* g5 r0 v
#include <linux/kernel.h>$ _: B) k; q# H% Y7 V2 M" c( [
#include <linux/types.h>! d! V( v. L: N5 _3 _3 S% I
#include <linux/gpio.h>& |6 v6 E2 Q$ R( w# n+ ^5 `+ r
#include <linux/leds.h>
! l* N- c7 _0 Z. t$ ~" e4 a#include <linux/platform_device.h>
# e5 p: Q$ x! p6 i; h/ X7 ~0 A& q: y" b
#include <asm/mach-types.h>& i% w* A* X) ~; D. F3 j
#include <asm/mach/arch.h>
6 e7 a) W/ H7 `& C3 E! x+ `: k/ A#include <mach/da8xx.h>1 q7 z$ S+ t& |: I! u5 Z
#include <mach/mux.h>
8 D5 E$ J5 {" b5 G3 p$ t9 l) N' h8 h& y0 {, v
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)
: h. T7 b5 ^( z; k8 q) @% t#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)6 @9 f7 n, A: I# ]
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)4 u6 D2 v+ D3 f: m) h! N/ X
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)$ G$ S3 [: ?) d9 R' J
/ v1 u) U1 k2 `0 t
/* assign the tl som board LED-GPIOs*/& {1 @# f5 }- b+ V8 I
static const short da850_evm_tl_user_led_pins[] = {
# i, N- E! n; O; L  |        /* These pins are definition at <mach/mux.h> file */+ K, O) G- ^1 E
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,+ p' t% d  s: |7 l  ~$ X
        -1
; q, H+ H: ~9 q8 P1 I* _* {};
' l) x+ p  f4 o7 N2 o" V5 `' d+ A# K1 P6 g
static struct gpio_led da850_evm_tl_leds[] = {
2 n7 j. m5 j2 A* X2 q        {
7 n/ K7 `% j8 s$ Q' h8 ]6 P                .active_low = 0,
( a3 H; E! s* A% |- M                .gpio = DA850_USER_LED0,: a- d9 G+ ?8 h; S3 ^% x
                .name = "user_led0",$ M* L" c/ ^' g' S2 @6 x) x7 _/ N, m
                .default_trigger = "default-on",9 m/ A5 j9 S+ P, L: {7 u3 P$ q
        },  A* M$ u& j  I' X& Y+ d+ w+ [8 H$ [
        {! T. G8 K" `- Z) f
                .active_low = 0,
2 n& m& @- |% {- }/ S1 z! }3 ]                .gpio = DA850_USER_LED1,
+ c- ?4 ?# @/ {6 ^5 S1 m                .name = "user_led1",
! X6 w. z' R' ?8 c: r3 _5 C. k, `                .default_trigger = "default-on",  K9 |8 B, V4 }8 Q0 j$ I0 c
        },
- B  Z( H" h$ ~/ c( h' m9 Q$ X# K  ?% r        {
, ~0 `4 ~( `7 j* |8 X9 m  b                .active_low = 0,
1 K4 ]$ f1 ^& Z5 n% ?- P                .gpio = DA850_USER_LED2,! S, o) \  W, `+ n: Z  U
                .name = "user_led2",; c1 X# J% e  P: k' t# N
                .default_trigger = "default-on",5 Y$ q0 U% R& W. r/ ^
        },
, H' J. d' ]  j9 O7 S        {
2 t  Y$ g  S# S2 P) Z                .active_low = 0,3 i  B) i2 U8 W4 V& a4 P, r
                .gpio = DA850_USER_LED3," u1 G3 u0 C& `% _
                .name = "user_led3",
6 v$ d& b) {2 A& U2 z* K1 Z8 g                .default_trigger = "default-on",
1 s$ O+ n) _% [1 t$ ^7 v        },
$ X3 N/ e9 \% t};
1 r0 q8 S5 _2 U3 U1 G
* j0 f% W6 K; n  Fstatic struct gpio_led_platform_data da850_evm_tl_leds_pdata = {: S+ V6 ^4 }( _# }# Y& m" `4 {
        .leds = da850_evm_tl_leds,* n9 j4 o! S( a0 p6 a( U* j5 @
        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),7 `8 P9 z" P! d' i+ c6 @+ H) n
};8 G! t  S& A' N; f
" h+ W6 R3 u+ C/ ?' X4 w& t
static void led_dev_release(struct device *dev)
( H: [: C& P7 [: h: j{
8 a$ _$ [/ T: z% x( C7 j};
( m5 p% {6 s/ c$ N* ?* ?4 w3 |
  p" `0 r" |# ~static struct platform_device da850_evm_tl_leds_device = {8 K: f) e+ W" b/ t# y9 Z
        .name                = "leds-gpio",9 x' e, S9 j# I
        .id                = 1,6 ^- r2 d: r5 ^2 t4 P$ K! U; K. K& B
        .dev = {' n9 w/ j/ R* `0 \" h9 ~
                .platform_data = &da850_evm_tl_leds_pdata,
( U. Z3 O  M0 V                .release = led_dev_release,0 m+ N- {4 _9 W6 i1 E
        }
: w0 Q# Q/ z4 l3 L' |};3 z5 u' u+ C3 L2 W6 ^+ w% E; N

8 k6 Z+ [  y4 Y! |! j$ jstatic int __init led_platform_init(void)
% N: W. B7 `, c* D{. u! \$ N1 B3 Q! {4 d
        int ret;
+ E) a) X; e* m% s" s#if 0' W; B. Z! H% w" t
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);" ~; T3 }3 B1 |) l6 f9 Q5 n+ _% M% {
        if (ret)
/ ~8 \/ x* F2 a                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"0 q) d( W# r" c1 ], J2 K; y
                                "%d\n", ret);
; ~# M' N# `+ A. N#endif
' Z6 b6 `2 O; G2 h7 S        ret = platform_device_register(&da850_evm_tl_leds_device);0 n; H3 F6 h& S7 _* f; h! F
        if (ret)
9 u! G; y! n+ a+ n                pr_warning("Could not register som GPIO expander LEDS");# U5 ]2 R$ f* o0 [
        else) i+ @2 w9 j. a& H" c" t
                printk(KERN_INFO "LED register sucessful!\n");
  n! ^, v' D; h: f; f) }: D: K/ A, \: r0 M+ R* S* \
        return ret;) a& q0 @/ c5 S( ?2 O$ y2 R
}
$ Z- h- M& \" l; X" `  j# I1 v, @; k& Y( T0 X
static void __exit led_platform_exit(void)
+ P7 L# D- R! U5 I{# c7 V3 ^0 j1 O( {2 L7 Z$ R
        platform_device_unregister(&da850_evm_tl_leds_device);
( T- I, E, o/ f$ C/ {4 z" _( B2 B- Y# j3 a3 L9 u" k
        printk(KERN_INFO "LED unregister!\n");" F9 D( {) e  L/ t2 o
}
( z5 R9 K8 G. u0 j+ q! ]
- q# ?& a* x- A, Mmodule_init(led_platform_init);
- y4 I, Y1 C  @0 I0 F; Nmodule_exit(led_platform_exit);
/ g# L: a2 z8 I
; P- }7 d2 R  Z7 D  o4 T. SMODULE_DESCRIPTION("Led platform driver");0 j$ L& ?5 N( b* k* x- m
MODULE_AUTHOR("Tronlong");" R* e+ H8 J, O, J% |' [: i
MODULE_LICENSE("GPL");+ D5 I0 W7 _, i- L. u8 c

& j" ~) _' J: [! o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 00:28 , Processed in 0.040630 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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