|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 Y+ a1 z; C) A5 o7 {* E) G
- [code]EDMA sample test application
$ R, j2 t! I+ X4 h - /*
( {, v0 F8 g! g) b' I - * edma_test.c. ]$ b N2 E) D Z& |; t
- *
4 } n2 `5 X! a t" _5 X - * brief EDMA3 Test Application3 Z9 Y- [7 [6 a j8 z
- *$ R( }, s5 z0 n8 _+ d0 p- |( Y6 {
- * This file contains EDMA3 Test code.3 N$ w. s0 R( H: r9 @5 R5 m5 \% S
- *
* Z; n$ h$ s/ R/ e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- H0 F( I1 V2 b( A6 p0 T& g- I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 l% L3 R m" f, T% I - * TO CHANGE.0 }4 k0 J5 A% C" P8 |
- *0 C- d( @0 s6 t& v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& p G/ s6 T$ C; P1 f* P - *5 n: U7 a4 q# o0 [, ^1 q
- * This program is free software; you can redistribute it and/or* p) J7 G2 ~2 a8 C/ j: [
- * modify it under the terms of the GNU General Public License as+ }) q; Z2 R Q) }8 g q. {4 F/ l j
- * published by the Free Software Foundation version 2./ t+ M$ }1 c3 W7 e7 V- Q
- *7 v+ e9 D3 e1 H* W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 |2 B& h0 A( {
- * kind, whether express or implied; without even the implied warranty
; {8 K; r2 k0 x) l+ c: L F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" l* m, d9 Z+ S) u, J; c - * GNU General Public License for more details.7 \) H- g6 c: w" k* A7 d; R2 C V
- */& ]5 J4 Q6 b! e5 W1 u# } o
7 q9 @8 T7 t g2 k0 [( Y. R- #include <linux/module.h>1 m. _7 a0 @' o6 K
- #include <linux/init.h>8 |0 w ]) n# _( C! c$ I, t9 X1 v0 a
- #include <linux/errno.h>
) X' |; A# I" A: S; f, f' U* I - #include <linux/types.h>/ T% b* j$ x9 }
- #include <linux/interrupt.h> F' B# z, Q+ X1 Z e
- #include <asm/io.h>7 d0 ^4 p& I r7 d% e! ?6 s/ D
- #include <linux/moduleparam.h>- I6 C4 j% {2 d, z
- #include <linux/sysctl.h>
4 G" y9 t) E( d) r/ n# x - #include <linux/mm.h>* t1 x! w0 ?7 r; r2 x
- #include <linux/dma-mapping.h>% P7 @9 ~, f* A* g
. y2 W- R% Y( A- J! S! w5 K- #include <mach/memory.h>' O2 v2 t& [7 g1 [ ~; \! x
- #include <mach/hardware.h>- O# E) c! Q' ]- x
- #include <mach/irqs.h>
: K7 x, P O' y/ y4 K0 O1 e - #include <asm/hardware/edma.h>1 d0 d( Y* W0 F) s6 P2 K
- 8 i6 A; l+ V- ?5 R
- #undef EDMA3_DEBUG6 E- W% t8 G2 [9 G7 x; ^" p; S* s
- /*#define EDMA3_DEBUG*/
9 G- P! }9 b4 L5 {: g' A0 S
$ ^( m5 r! H( V. {) Q- #ifdef EDMA3_DEBUG
6 n/ _/ q! r5 t: ]3 f( S. \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! i- \/ g9 c- h% d. |! Y0 ^/ v( [+ Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 m/ f; z' U% i0 T1 @! t$ q. C( _! i# P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 m' S2 d! y$ j8 s" @" G
- #else/ ]6 {$ t) C; I! l' @; L% x
- #define DMA_PRINTK( x... )1 {- }* {+ U5 ~; @" u
- #define DMA_FN_IN
" G! E* {' V- y2 _0 ]+ S7 w3 ? - #define DMA_FN_OUT
( E) s, @! `( ^6 o& x& G1 n' ^# C - #endif
3 p. m0 u0 @9 f4 v
; y, l6 w/ A5 \& A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# G: q5 m: l& R5 q - #define STATIC_SHIFT 3, U' n$ v9 F+ e9 l2 V Y$ D' m
- #define TCINTEN_SHIFT 20/ W9 I7 y- Q8 q u% N2 _3 Y% ~
- #define ITCINTEN_SHIFT 219 K+ Q4 c* S/ \# A( S5 A( Z
- #define TCCHEN_SHIFT 22
0 P5 V8 H5 `6 ~. m, ~ - #define ITCCHEN_SHIFT 23
% `9 n% E C# e3 k( e
0 x" V) A; C9 l% i- static volatile int irqraised1 = 0;
6 {- q$ b$ A, M# o/ P& m - static volatile int irqraised2 = 0;
z1 T; Q8 ^9 p9 G
* S6 N. H+ |" z% l' P. \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- v$ H0 ~; c. a7 u+ e! J* C" y' k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O; j' B: C8 y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% J, o z9 o2 V1 A% e4 i
- + R# s8 X/ ~' ]; w& F
- dma_addr_t dmaphyssrc1 = 0;! G+ q. I/ T2 W8 ?% R* ~
- dma_addr_t dmaphyssrc2 = 0;4 f' O" ^" u( D7 ]* `
- dma_addr_t dmaphysdest1 = 0;
$ ^8 x- `6 _6 j k/ M/ M. O. T - dma_addr_t dmaphysdest2 = 0;
! l/ `, k2 k( ^$ d1 B- S, T
8 d! r5 m! {( n$ P- char *dmabufsrc1 = NULL;
* H" [# |" @1 Y1 t: U5 e9 c - char *dmabufsrc2 = NULL;, G6 N7 p- t- V) C
- char *dmabufdest1 = NULL;
8 S# r; u2 {/ B9 p! U - char *dmabufdest2 = NULL;
( C# |6 e3 z, ~& Y2 B/ G
# _- y* E/ b3 T% n9 l7 V" [! h- static int acnt = 512;
8 T& W) r* t* Y0 Y/ @, o - static int bcnt = 8;! \. F* q- I6 g0 g+ }2 L
- static int ccnt = 8;- t' X X( i1 x. R4 e
- # ?* y2 U& v9 @" u+ V1 j% B
- module_param(acnt, int, S_IRUGO);
6 P( ^9 S' S! }; n, u - module_param(bcnt, int, S_IRUGO); D7 [9 F* @ z% n. @
- module_param(ccnt, int, S_IRUGO);
复制代码
" |1 D* E; M+ P0 C- L5 _; `: g7 W4 {, T1 l2 O8 a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% o) S8 k$ V/ d3 _: h" [: M
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" b: s! F, Y! O7 k) L3 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) V4 g& {$ H* W& L! R6 a
K# W- E- q! f! h9 @% X t
9 D# k9 z1 o$ { |
|