|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 g/ b$ ]# b) `" o4 U$ Y
- [code]EDMA sample test application
5 ^5 ~( Y: h# y x% J, Y - /*
, N' L* S6 g2 O; z! c% Y - * edma_test.c4 [( K; t4 |6 l, U, w7 q
- *
( i# i' h/ W* B$ ] - * brief EDMA3 Test Application
o! K. h( } L9 J - *5 i4 E% Q$ W$ l% f% o+ p- w
- * This file contains EDMA3 Test code.) t2 d. Y8 E9 A# A( g
- *
9 p! E1 e8 c; d$ h% V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ j B- R! n9 I' G+ ?+ H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' Q1 g f% H- o6 ]. I9 V - * TO CHANGE.) x3 y5 L# V, U
- *
+ e$ [" }# ]+ w7 Z$ r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* c" a3 P H% m) g5 g+ D8 H5 Z: l
- *
7 {6 _7 I0 m) f7 [: x - * This program is free software; you can redistribute it and/or0 I$ i2 D! _0 r% \# i0 c
- * modify it under the terms of the GNU General Public License as) _: `' b! Q* C, ]4 ~5 J
- * published by the Free Software Foundation version 2.
$ N1 I( ^; x, {) ^7 n, x - *
1 ]/ j* y7 U" C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; S; l" i; S4 m! A# s
- * kind, whether express or implied; without even the implied warranty- {, ~% S( [7 p' x' y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( b3 h" ^" ^0 s! ~
- * GNU General Public License for more details.' C1 g. E, T9 R/ e# ^# B
- *// q- k, U8 s- M7 [
o8 C4 B: u A( j# l4 M- #include <linux/module.h>
: d Y0 E$ |2 n! H( i, I - #include <linux/init.h>
' ?" E5 O5 T$ _# ^# @* q - #include <linux/errno.h>
, E" i8 k5 ?. K. _" ^+ ^ - #include <linux/types.h>
" O0 e+ s O" S2 { - #include <linux/interrupt.h>
" w6 q, B5 b" V- Z, ^9 V: C% O - #include <asm/io.h>
( ^( C- j* s2 v% G5 w0 c/ s - #include <linux/moduleparam.h>
" z3 _$ w1 \! @7 P' |) \ s0 f - #include <linux/sysctl.h>
& P5 j- M% p s b6 o: { - #include <linux/mm.h>* Z# E7 c. P& E: @' ?1 O
- #include <linux/dma-mapping.h>/ u# L; c Q; Y% P9 N
- 2 Q1 {! O/ N! f* |# c
- #include <mach/memory.h>) c7 z: T3 T0 N9 s5 E* C
- #include <mach/hardware.h>
$ U( h) R O4 |# E% }0 S - #include <mach/irqs.h>, z' a; ^1 ~/ z/ y
- #include <asm/hardware/edma.h>1 g: T6 C' i+ H/ P
- * N+ P9 P0 b; W; k( i
- #undef EDMA3_DEBUG. t& W# L9 R' Q
- /*#define EDMA3_DEBUG*// x1 X' G, t- c, @7 p. T
; Z7 ~: _" E8 F; M' ?- #ifdef EDMA3_DEBUG5 I- d! r4 ]$ ^8 o3 W5 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# l+ w9 {& i, f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
A8 \$ \1 y3 D0 h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), x- g+ R: i+ y/ Q8 C% E
- #else8 U7 F3 B" \: H/ |8 S$ E5 \6 ?
- #define DMA_PRINTK( x... )
# \( \( l# B1 \5 w1 ?; x - #define DMA_FN_IN) r. A+ w$ q2 p: i z
- #define DMA_FN_OUT) P+ Q: B/ f% n% R1 h6 A
- #endif$ R* E+ w& w! k$ K3 [
- " r; J; S( }: q& K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 Q- v' z& l9 O. P - #define STATIC_SHIFT 3
# Y! K. c* U* X% f - #define TCINTEN_SHIFT 20
8 I% `' ?' T [( f - #define ITCINTEN_SHIFT 214 ~2 b. I2 G' p/ t* A( e7 ?
- #define TCCHEN_SHIFT 22
: b! ~) j; p5 H# _4 A - #define ITCCHEN_SHIFT 23
4 u9 R) l+ n( V2 N# Y4 n
! V3 b0 ~/ x |3 ]) p4 a- static volatile int irqraised1 = 0;; \: A& y, I; M# m5 R% I% A w
- static volatile int irqraised2 = 0;! [1 J, ?& P2 J* s/ G x$ v
- ( e; m* ?8 K& A7 r( g5 T% |+ Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 q. l8 n' z' F" Q$ @1 @% `9 F& O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 J$ h: A4 A& A; ]' A) w& G: F5 p0 N+ M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) [& K# D: Z5 ]- t: v! l - g( ~" O9 c/ j+ e+ h
- dma_addr_t dmaphyssrc1 = 0;: u; w Q4 D$ Q1 y; ?) e. X2 Z, M
- dma_addr_t dmaphyssrc2 = 0;
5 b* R8 J% Y. [" q) ]+ N3 C& X9 Z - dma_addr_t dmaphysdest1 = 0;
. p5 k5 C7 X0 _ S9 @) u8 M0 T - dma_addr_t dmaphysdest2 = 0;+ P# `5 |4 u, R& |2 c
" d) i- K) R z7 R- char *dmabufsrc1 = NULL;9 T1 c; j0 O) u
- char *dmabufsrc2 = NULL;
+ J/ s; a# z: [% L - char *dmabufdest1 = NULL;7 l, M- b5 W6 s. s% a
- char *dmabufdest2 = NULL;- l% Z; U/ F- z6 o
- ) A( P: O- G" m9 F! o- r1 F( R
- static int acnt = 512;
- }# X! o) e, W. z4 w - static int bcnt = 8;
4 i, I! H( J1 h4 g( V6 S, ~ Z - static int ccnt = 8;! ]$ Q2 g2 {. m" K# Q w) x" c
- 7 `; m3 g4 r# c! |- ]
- module_param(acnt, int, S_IRUGO);
5 g M" p$ T9 e3 a5 g. J g8 W3 ? - module_param(bcnt, int, S_IRUGO);) y3 P) E' I3 c# [5 _
- module_param(ccnt, int, S_IRUGO);
复制代码
! T3 \# a3 k4 s- r. `
- L1 u A" Q# y! u, g5 @5 F3 ~9 L" z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; \# R: D5 S7 m) tarm-none-linux-gnueabi-gcc -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 m; q1 f8 Y9 y& F" p+ j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; u+ B; x7 z) M# Y/ k! D
( M! n h3 K! J( d. g5 h9 O
6 F, b1 A9 H" A, Z8 l1 z' i |
|