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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

[未解决] 程序注解

[复制链接]

5

主题

8

帖子

53

积分

注册会员

Rank: 2

积分
53
跳转到指定楼层
楼主
发表于 2018-1-19 19:02:07 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
求大神给下面的程序做注解,请稍详细些,谢谢。
: ?0 d1 U0 z# F( M#include <linux/init.h>
, d2 V0 U+ J: |#include <linux/module.h>
6 N! a; ~1 z& X8 j#include <linux/kernel.h>$ b# D& H  N) I$ n0 A9 T+ _
#include <linux/types.h>; `: }( _' P0 I  ?! f0 Q
#include <linux/gpio.h>
; }$ V3 l& }- Y; a/ K1 j#include <linux/leds.h>* Y2 a3 D) q8 t6 w/ m* c
#include <linux/platform_device.h>! S9 G& P, C% X3 B; q/ R1 G. n
* t0 p! q2 d# L. A& A* Y
#include <asm/mach-types.h>
! B+ k- ?; |$ o#include <asm/mach/arch.h>
2 f0 L# t! H9 G) {4 [9 J#include <mach/da8xx.h>
! ^. G; E( g) }' T* ~0 z#include <mach/mux.h>( I# R  `( D0 P  S1 U; i6 q
- B, H# E% z  b: A3 d) L1 o
#define DA850_USER_LED0        GPIO_TO_PIN(0, 0)+ ~7 A6 p" i$ K; Q
#define DA850_USER_LED1        GPIO_TO_PIN(0, 5)$ v$ U/ b5 |; B$ \' @
#define DA850_USER_LED2        GPIO_TO_PIN(0, 1)7 r( g- c6 \: h) h
#define DA850_USER_LED3        GPIO_TO_PIN(0, 2)  r& V2 B* y" J9 I0 d
- [& x9 V) \: ^: E. J" c; r
/* assign the tl som board LED-GPIOs*/
0 M3 T% ]& S" C/ W5 _- Estatic const short da850_evm_tl_user_led_pins[] = {
" g% M# a- Q7 b/ x3 E        /* These pins are definition at <mach/mux.h> file */3 K4 Z3 I  Q" B% z9 y6 O
        DA850_GPIO0_0, DA850_GPIO0_1, DA850_GPIO0_2, DA850_GPIO0_5,3 I0 v" i9 a- |/ \" q5 N8 M
        -1
) E* p$ e4 ?5 q+ r- E1 P, r};' a9 o! J5 R) k* X' ~

- O/ S% P! M8 G9 `' Q, f. y6 Ystatic struct gpio_led da850_evm_tl_leds[] = {& X  G- l7 i+ p% G
        {
' z) D* {6 i# }* d- i                .active_low = 0,7 r& c( r2 i" X. b$ I0 A
                .gpio = DA850_USER_LED0,
0 e/ @/ f7 K0 K7 e6 S1 Z                .name = "user_led0",
! a0 O: G* A6 D7 L0 V$ }7 K% n7 a                .default_trigger = "default-on",
$ O  i. T% _; g        },! D9 i: ^3 y# h7 ], C
        {7 @+ J2 O8 B9 ~! `6 p. L
                .active_low = 0,$ D& Z- `4 N4 ?# P* ^; t
                .gpio = DA850_USER_LED1,! _) h9 \% @2 C
                .name = "user_led1",: n4 q& |) I) }( k
                .default_trigger = "default-on",
! o. l2 c, x, n, e        },) g1 {9 U8 `" x+ x$ G
        {
5 A) t, y1 I( ^! U) k                .active_low = 0,
* Z7 D/ `2 p1 c% ]2 R                .gpio = DA850_USER_LED2,( o# }: T7 {6 M1 z) p* b
                .name = "user_led2",
1 c$ b/ ?7 v/ }1 J8 ?& b                .default_trigger = "default-on",6 ^& t- l5 N, A7 ^
        },
: m  l2 }' x. ]9 ?- E$ K        {
4 J3 m* M6 ^- A% P# `7 @3 m                .active_low = 0,
$ k: p& [8 m1 l; @+ w6 l. f& W0 z                .gpio = DA850_USER_LED3,; t5 ?: R4 }1 ?$ z: h- {# [
                .name = "user_led3",  L1 K9 Q. o: K
                .default_trigger = "default-on",9 e; h6 x, @8 O! q. Q" `. C; B5 B9 p8 d
        },( [8 S; F# X, z  A
};
4 E% i7 p5 \% r/ h# x, M7 w. U! f# q+ A9 K, l; D2 ^2 F
static struct gpio_led_platform_data da850_evm_tl_leds_pdata = {
" e' X/ O8 a0 k" U( w% q3 |        .leds = da850_evm_tl_leds,
8 ?# b0 |, g6 Z/ ]        .num_leds = ARRAY_SIZE(da850_evm_tl_leds),# P$ T  d' o& v. a* [. z) t
};" D2 F9 j& t  R; A3 p3 |
5 d0 ]3 E, w2 ~  t& m/ }  p5 a
static void led_dev_release(struct device *dev)
6 d6 B+ P2 \8 [3 w) b  w{8 R' E/ W3 ~: k7 I  l7 S( j( Z
};
8 ?6 K6 j# U& [$ H4 D9 h- {
% f$ Q! z  Y/ }/ Z/ }1 Ystatic struct platform_device da850_evm_tl_leds_device = {0 |/ S7 a. J5 q0 M+ V
        .name                = "leds-gpio",
5 Z( [/ J* [( d% `9 D& l        .id                = 1,; Y' I% i3 {; d2 I3 f( R; b
        .dev = {: [( j8 K) P% z! o1 l4 B' Q
                .platform_data = &da850_evm_tl_leds_pdata,( J' ^( T+ Y% Q
                .release = led_dev_release,
2 W1 H) U5 ^1 l* k        }
$ ~4 A+ ?# u5 N" I* Q5 `};
3 N! X8 o: k/ D0 O4 w  D; Q5 J% K# j! H: D, ~) b  Y6 J" q% u8 P
static int __init led_platform_init(void)
7 T! w) l. t) B2 f! l& M# j# J" J{9 i1 c" F) r" e" X
        int ret;  L) v8 p% n2 U. W
#if 0) [2 Q9 G  Z1 W
        ret = davinci_cfg_reg_list(da850_evm_tl_user_led_pins);5 s, S3 [+ X- a1 p
        if (ret). T# c% A6 e/ I  J+ {- {
                pr_warning("da850_evm_tl_leds_init : User LED mux failed :"
' Y6 @7 c2 \" r% i% j                                "%d\n", ret);& m6 m4 y& p7 t' l
#endif
9 B" l: u2 g7 z, J2 j        ret = platform_device_register(&da850_evm_tl_leds_device);
- Y2 ^4 x+ b$ D+ i6 H' d5 g        if (ret)$ L3 g* h; R$ ]0 F! h: I. X
                pr_warning("Could not register som GPIO expander LEDS");
3 j/ S( c; y: f; j1 T( z1 ^        else) S8 r4 G% Q; x0 y
                printk(KERN_INFO "LED register sucessful!\n");
7 {5 T7 P. @" K# V0 S# C0 Q% s5 g3 u- z1 f! A# }0 t% Y
        return ret;
* Z) ~" T" {' `3 b1 o3 z1 A}
5 T8 K1 R) b0 _7 c. _
4 k3 e$ ^" J1 p0 d+ N3 mstatic void __exit led_platform_exit(void)
# K) G! M4 L$ [+ }{
5 W; `3 N6 s: H9 P! H# {        platform_device_unregister(&da850_evm_tl_leds_device);
$ Q, [! ^( O6 I$ c  ~6 ?
7 X, g$ a' Q1 d2 r% Y1 h; `  \        printk(KERN_INFO "LED unregister!\n");: _8 \  K$ @7 @8 ?8 D! y# ^
}
/ p7 h  ?4 G0 [7 R' Z* E" a- P- N1 l9 C7 m' m
module_init(led_platform_init);1 V6 p; k5 i% F9 Z& }: V5 t
module_exit(led_platform_exit);
% C% W: ~' d1 V4 L9 c8 n; S* ^
3 I/ h* j% g+ ]- d; mMODULE_DESCRIPTION("Led platform driver");
8 f4 v7 `. F8 IMODULE_AUTHOR("Tronlong");
9 X# c+ p! U# f  K6 H6 LMODULE_LICENSE("GPL");* @9 p& Q$ ]) b: c. r' L1 h9 P3 `8 k2 H

% P. Q- k" n& a8 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 22:52 , Processed in 0.039031 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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