|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# B* z' P6 A$ D! O: h- [code]EDMA sample test application' |7 q4 `' b" o$ ~% F
- /*- A0 X7 s4 ?3 {4 b& a
- * edma_test.c
4 k0 F* W" x1 {$ a/ R4 @ - *
# N- M3 ]; a) B8 l% J' ?+ I - * brief EDMA3 Test Application' G8 ]6 y0 c/ C2 e
- * G3 m" j. R! b1 N
- * This file contains EDMA3 Test code.
: W( ]4 y4 Y; w# v3 o& o# d5 b - *
9 k2 }0 y: T7 O* K2 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! q6 Q( w5 R/ i" y3 I( j Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 {# ~' D( P/ |* Y - * TO CHANGE.
0 E/ G, V9 H+ R$ ~ - *" {, v3 ] k& i" n: I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ ] y, F/ R& J) r9 E; E; d" E4 w - *
+ ?5 \# q* d* d - * This program is free software; you can redistribute it and/or/ S% [# |8 p4 j6 B
- * modify it under the terms of the GNU General Public License as0 |0 m( e( ^8 G) j& [7 L% U
- * published by the Free Software Foundation version 2.4 o( n* {- g; Y: M
- *) C$ j9 p, I- Y1 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% L9 j0 T7 v7 e0 E9 }
- * kind, whether express or implied; without even the implied warranty) v7 z, M. T8 O f5 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. _ K+ p2 u; b! `
- * GNU General Public License for more details.
, l) H% w6 F- f& f - */
/ _6 \- S- I" n2 n0 { - % Q& O0 Z% q3 A6 N' ~
- #include <linux/module.h>
# c2 D* X9 [& Y6 q: u - #include <linux/init.h>) I; T1 Y. {, u" c& E
- #include <linux/errno.h>
9 A6 j8 q+ l- A: c$ ~. f - #include <linux/types.h>. z6 e4 ~; @& k
- #include <linux/interrupt.h>
9 F; o s3 U* N, Y- D& x - #include <asm/io.h>, K0 |- s r, X& {4 N/ r/ r4 _
- #include <linux/moduleparam.h>
4 G* z/ K8 Y( f) X6 e5 p5 V - #include <linux/sysctl.h>, [$ k5 g8 p% g! v
- #include <linux/mm.h>' l- E8 s' q8 b: H
- #include <linux/dma-mapping.h>
# J# S$ H& P1 C4 F* K4 a! _5 J - 7 j4 ]: X, c& d& K
- #include <mach/memory.h>. O9 }2 r( ?/ o
- #include <mach/hardware.h>
/ H0 t( p; p) g, N! g. t - #include <mach/irqs.h>( c! P- Z: ^; i
- #include <asm/hardware/edma.h>
8 I6 E* c) u/ b5 ]: c8 J - 5 y+ r- s; ~9 l( V
- #undef EDMA3_DEBUG3 L/ U# u/ A. l/ H. [/ Z: x
- /*#define EDMA3_DEBUG*/
3 k( T& q5 W9 b0 k) N# C
( p& {* {7 d/ X0 k, h) v8 Z- #ifdef EDMA3_DEBUG
0 L& w4 `( k$ f+ Q) ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- [! m% P, h5 d$ n1 A9 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- \, J0 B2 W. b* N z) M' L) [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 y2 q% i5 U7 M% U - #else4 J$ {) [2 K& [5 }5 }
- #define DMA_PRINTK( x... )
- \7 x8 ]( o/ _1 N: P' D - #define DMA_FN_IN1 i# n& H9 b0 Q
- #define DMA_FN_OUT2 ]$ t9 C* F, g' W6 O0 @: e6 D; C: ^: Y
- #endif
) | i2 A8 d$ g k: K+ a - * l4 S' E7 M+ Q6 P7 d) f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: H; A6 @; K* O# |! l - #define STATIC_SHIFT 3- W+ `1 i- J9 d: w7 f( F
- #define TCINTEN_SHIFT 20+ r+ F+ h: n, M" |0 N
- #define ITCINTEN_SHIFT 21
* C2 W( p, `' ^7 L% Z' e8 c. g - #define TCCHEN_SHIFT 22' U; A* Z0 V' T" h& m* n
- #define ITCCHEN_SHIFT 23- G f1 N# |8 X/ r/ G A7 Q! k! V! N7 D
- / K) q9 I$ K3 S7 l) M: x T+ L
- static volatile int irqraised1 = 0;$ ^9 K& N; s" Y3 K
- static volatile int irqraised2 = 0;
2 }; F9 Y( ?, @# m$ H: j - ! h* g2 [0 p# X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 a2 @6 S1 e: e, c; }8 ^( T5 c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ x3 y: j3 y- t& U" F9 D- H( U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; }5 m6 K h& G, s0 A
3 O/ C; i2 r5 @$ ^% [8 f3 j9 y+ ^3 v- dma_addr_t dmaphyssrc1 = 0;7 A$ }7 Y* k# q
- dma_addr_t dmaphyssrc2 = 0;: U* U1 F) f: _# ^! _1 O
- dma_addr_t dmaphysdest1 = 0;
. @7 ]7 ^' F; V8 B - dma_addr_t dmaphysdest2 = 0;
) O. ~4 A. p/ L6 L - : T* d0 V; S2 y5 x+ |( H5 H5 f
- char *dmabufsrc1 = NULL;
+ r/ A( Q( T6 a# M8 Q8 X- k - char *dmabufsrc2 = NULL;
1 Y G, \" Y Y+ W8 J - char *dmabufdest1 = NULL;
5 Z" a: U( B; s, }# j - char *dmabufdest2 = NULL;* J% l% [3 S$ {) ]* K6 v
4 f4 G' y! B! T3 p2 M) Q' y- static int acnt = 512;1 P& m, I$ O/ q; }
- static int bcnt = 8;" o+ j! [3 S( J
- static int ccnt = 8;
+ U, B6 }! l4 l1 d* G# k) V1 b - . r: Q4 Z: }3 D6 ]# _$ R8 I, M
- module_param(acnt, int, S_IRUGO);
( c, r/ k6 G# D4 f6 l' i) S - module_param(bcnt, int, S_IRUGO);
, ~# j* t a9 v - module_param(ccnt, int, S_IRUGO);
复制代码 r7 K& u1 t; s" K* o) E7 C
0 M! o& P$ R5 L* C0 T0 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ z6 j& g) c) G2 W. O7 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ M" e/ v' L3 ?# W+ y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 f$ O' Q3 j2 ?. V r
; i; j9 g. \" s. I. k) w
) g# J" x" \0 o1 E4 y2 q# H3 B |
|