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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
: w5 C  ]& Z% v/ M4 m# N. `' p#include <linux/init.h>
0 B* @/ O6 b6 Z. r! \#include <linux/module.h>
1 a0 s7 x/ l/ K. w5 B#include <linux/kernel.h>0 P* r$ V+ b9 G" @
#include <linux/types.h>
2 a2 e" s  R5 g# [#include <linux/gpio.h>, }+ M" y; }" }2 g
#include <linux/leds.h>
  d' e) z5 H; u$ l- c3 E) s' z, F#include <linux/platform_device.h>
- [6 P" K; R# H" {0 ?
8 y2 T0 P2 z5 @+ Q+ |* I* H) b4 @#include <asm/mach-types.h>
4 Z* b* Q6 `7 w$ W) `. O#include <asm/mach/arch.h>$ k2 {6 @" c2 R+ K0 Q
#include <mach/da8xx.h>4 K$ u0 T$ D0 k5 |
#include <mach/mux.h>  J. N6 d2 {+ c$ Z! H: v2 K

4 [6 p9 f8 j$ e#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)! Q8 v$ [! A0 a% j0 Z7 S" ?
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)% a9 `; g" r3 G6 G) R: S
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)+ B  f; K9 C8 G/ ]- {$ S
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)7 V5 C6 g! A' H- A: d& @

3 M. D" C% W7 ?9 c" n/* assign the tl som board LED-GPIOs*/. C; ?. G; X0 K. [; d0 }
static const short da850_evm_tl_user_led_pins[] = {
' ?. c5 c' A$ ~        /* These pins are definition at <mach/mux.h> file */
( |2 L7 l4 {1 j6 {0 V        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,
( w! s6 W- C0 C, d        -1& x; m' Y9 H8 F9 X/ W! g
};
& y! m, h- S0 [  B. ^4 K$ P
; [1 d  S: K) ?static struct gpio_led da850_evm_tl_leds[] = {
* j  C. t! v" w' q1 [/ f: L* Q        {
. R$ }7 z$ {% e. p" O                .active_low = 0,
- |; Z+ _- b' `7 |5 B7 Q                .gpio = DA850_USER_LED0,
8 Z2 u2 V  P0 Z                .name = "user_led0",9 n( n2 J9 w1 A9 a6 V
                .default_trigger = "default-on",
% U4 i) ~5 [) o$ D$ q7 s        },
& O2 `' g' O, r3 Q5 w        {; S) @" m/ ?/ Y( S) l4 d  }6 m
                .active_low = 0,. `* z# `% Z6 n; e" |
                .gpio = DA850_USER_LED1,- k) a  c6 e# D5 I; s& I, [
                .name = "user_led1",$ |! O6 T' y. a: k& U- Z: T; W6 \
                .default_trigger = "default-on"," H! }; V% K5 z8 J4 q* U
        },
+ O+ ]3 e/ l5 |# O$ _' S, r        {+ d9 [3 x# a; g3 j
                .active_low = 0,+ u4 \6 j# G' q# I/ N' [
                .gpio = DA850_USER_LED2,7 |6 p' Q' t0 H
                .name = "user_led2",3 \5 q. a  ~- @* [: C; }, b
                .default_trigger = "default-on",
* o' T" D$ A' x7 \& h        },- ]* H* @; P- R$ d& Q+ F$ i) L: I6 ]
        {& R9 M9 M* q) K5 e0 R3 s+ y
                .active_low = 0,4 y" w0 F5 v( J" `( s& C
                .gpio = DA850_USER_LED3,$ |, j2 R# C! g7 d' P& h1 D2 u$ f
                .name = "user_led3",
0 c& ^# v# n9 |( |" ?3 W. }                .default_trigger = "default-on",% V& T$ k' S. @
        },  M% E3 j1 h9 w) [" ?* ]6 s: H. E
};$ ^9 y0 V4 @( t1 {! [% a

' {* G( A4 |3 J/ M5 p  |static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {+ d& i/ c- p5 {* Y
        .leds = da850_evm_tl_leds,
9 _: _* {8 [: x& i6 v# ]# j        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),
5 T; u) e5 p$ t8 @9 e9 F};1 k1 y  v1 l- T* K8 O: d

& ~; O5 X( G& c2 b- Y0 E* b0 Mstatic void led_dev_release(struct device *dev)" u3 l! c8 G, J( i
{. ]$ v% b9 Z' M$ K
};2 q. A- f/ `; A0 W! M
+ o4 u' Y2 W1 M) H+ G
static struct platform_device da850_evm_tl_leds_device = {
$ W- q4 O. n) A7 M6 L        .name                = "leds-gpio",
5 |% M4 H4 G) T. f# B0 `        .id                = 1,
: _6 @2 A9 A) F9 Z8 g$ j- g        .dev = {, P! F! P# I1 T* c
                .platform_data = &da850_evm_tl_leds_pdata,5 O% K# y3 X0 h' K
                .release = led_dev_release,4 A; O  z  z' Q
        }$ e: R# U8 A0 d4 Y1 s
};+ c$ U  t( v2 s- H

/ l) f' n2 @5 p7 \1 }# bstatic int __init led_platform_init(void), j8 g7 P* Z& i# ^0 s' Q
{
9 |/ Q; W) @) S& I* j; ]        int ret;
, M+ _$ Z9 @# Q& \#if 0  D2 a6 b5 R  i! C) `
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);
5 {; P2 I2 x3 z  L  \5 e        if (ret)
% c9 Y, Y& ]$ u5 K5 H                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
0 l# e8 ?' U5 p& K* X                                "%d\n", ret);
8 g$ [$ v1 x4 @$ _#endif# E7 N; C. y0 [7 I2 ~' j
        ret = platform_device_register(&da850_evm_tl_leds_device);! V8 ?' @0 ~0 M
        if (ret)
3 b) y; Q+ B! R                pr_warning("Could not register som GPIO expander LEDS");- v5 t5 V- o1 E( D( R, n
        else: l  P1 M4 a5 s' r
                printk(KERN_INFO "LED register sucessful!\n");' |7 c0 M! O$ I* C! n5 h& S

% }5 n6 T& g. }. s. Q9 x* B; w        return ret;
* i8 G# @6 A* j( a. ~$ }2 T( W5 M}
% a, k+ ^- W( E% N3 u3 r  ^2 B& c. G# A: t; u0 I2 G4 \
static void __exit led_platform_exit(void)$ y9 m0 G, N1 d
{6 k! g" g+ U4 w9 K0 b8 G
        platform_device_unregister(&da850_evm_tl_leds_device);
3 y5 A, C& E$ G0 t4 v& R  l( X8 O2 E: j3 l' r2 ?( [
        printk(KERN_INFO "LED unregister!\n");; S4 i' g" A- P4 S1 h: r
}
2 }/ V' C9 o  h
' S; I. U8 X; Jmodule_init(led_platform_init);+ N) w3 c9 _9 g/ Y
module_exit(led_platform_exit);
$ k5 s/ x1 O  f; f% R8 C/ b  ]/ U7 A
1 P: F# X9 I2 Z% ~MODULE_DESCRIPTION("Led platform driver");8 e4 r  x" ~: R
MODULE_AUTHOR("Tronlong");0 F' ]  m  i7 [# Q/ Y3 `
MODULE_LICENSE("GPL");
' M8 m; p/ d: X/ {, L
: G" Z6 ~9 ?' U1 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 06:18 , Processed in 0.038752 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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