|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ I8 I! r5 L* D1 \, r- [code]EDMA sample test application
. \0 T* }, y3 F! V/ N - /*4 }4 ^: g* n/ V6 i! H
- * edma_test.c' l$ u4 y7 }9 y) |0 {" |
- *; }# U; M6 x# y ~3 I' j) @
- * brief EDMA3 Test Application, Y6 b9 |3 Y- o7 Q
- *
4 j$ ^6 R" \- r7 a+ j( y% i4 S - * This file contains EDMA3 Test code.
1 C" s+ r9 {3 I) \9 W - *
7 B" q; |: d5 c: h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 N2 p! X( \, i. z1 |$ D4 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: b4 u( y* ?' s6 ^. d+ b7 o
- * TO CHANGE.4 f. m% j- j) D# }
- *
5 E! ]1 g ^; p( b9 G0 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 f( M" l8 p8 Y, n - *; V4 L1 z" I# m
- * This program is free software; you can redistribute it and/or
+ n0 L& i3 o$ F# G - * modify it under the terms of the GNU General Public License as- u, `5 r' ]1 ^, }
- * published by the Free Software Foundation version 2.
7 }% v8 ^0 t" i; M( v - *- |. X( {& ^! M4 c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- f; l5 M+ D" `# F2 @ c& R p
- * kind, whether express or implied; without even the implied warranty+ N) ]0 C5 i* G5 o! k6 k1 ]% \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 u4 c3 @4 v3 c6 W - * GNU General Public License for more details.
9 L8 ^* C$ Q7 P' I - */0 G$ F8 U, M: ^' p* @0 Q4 F7 j
- , p: [; J1 l: {- {1 x
- #include <linux/module.h>
# s3 G9 t R9 L$ n6 M; v2 x - #include <linux/init.h>
# p+ \' L P- J - #include <linux/errno.h>
2 W# g2 D9 Q9 Z" C7 _: I$ B6 x0 Y - #include <linux/types.h>
' ^! e2 X6 V0 U0 p5 E$ _ - #include <linux/interrupt.h>9 E+ u d' \ x" {0 C
- #include <asm/io.h>
4 n* k0 a7 o2 o - #include <linux/moduleparam.h>
" _ Q4 `2 E' {% ~# r; d - #include <linux/sysctl.h>
5 ^8 p" {6 X$ P+ J - #include <linux/mm.h>6 j; [" s$ z2 p- i c
- #include <linux/dma-mapping.h>
6 ~9 x2 l2 B9 F1 [! q% I
# G4 ^) P! Y( F8 p( M% E/ [- #include <mach/memory.h>
& l# \2 \* X# S+ m9 g - #include <mach/hardware.h>
& b# P& D2 @! L# |7 r - #include <mach/irqs.h>3 v# F0 o! m" C" j. t [
- #include <asm/hardware/edma.h>
$ y4 Z0 ?1 y5 M% s( E5 m1 b& w* G
+ Z! Y: T6 @$ x) Q: o5 ?- #undef EDMA3_DEBUG. D4 x- j0 j9 r9 V* {7 v' k
- /*#define EDMA3_DEBUG*/8 a( Y# v1 l% A h9 Y! b' B9 K# Y
- 6 L9 Z3 U- o! U+ v5 d1 I
- #ifdef EDMA3_DEBUG
' x; m! \1 @% i5 U8 G, }3 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; A; m- N9 s' u& B) ?3 y' } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; r2 `; T. ^" D4 G# Y8 }7 n: c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* o; N- ?: u( x - #else. B& j! _! s; a5 Y6 t& e: C; b% t
- #define DMA_PRINTK( x... )9 ?4 W8 b9 K2 F
- #define DMA_FN_IN
0 m$ H. P \. w7 O1 k) l1 h ?. }4 W - #define DMA_FN_OUT/ j/ c2 F% w% O4 q: I5 [
- #endif) ~5 n8 {; x* J0 m7 N# }
- . y) V+ i, s& x# }* ~- Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! h( d, K- b# c- V
- #define STATIC_SHIFT 3
0 x5 t3 r4 v4 T% o$ M4 R - #define TCINTEN_SHIFT 204 D, h. h9 F/ g% d# w: E
- #define ITCINTEN_SHIFT 21
6 Y% e! U& G. { - #define TCCHEN_SHIFT 229 f/ L. [% D2 H8 K) O4 y# N
- #define ITCCHEN_SHIFT 23
' y/ [5 L: @. G3 | - ! o) V0 l' |$ R# {' k
- static volatile int irqraised1 = 0;
% i, ~# ~/ f5 J& H" D$ B - static volatile int irqraised2 = 0;* O1 [9 `: Z" m& \4 x
. b! q- k' ], B+ a, C7 k" Q3 V; n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) E W; O" H' ^/ T' `: P" l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! U1 D6 c; b6 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! m( H/ D- \8 q0 I4 p
- I" s5 z$ M) w" s
- dma_addr_t dmaphyssrc1 = 0;
! l5 J* h& J( u- s+ e - dma_addr_t dmaphyssrc2 = 0;
- \! y9 |! P) ?! d - dma_addr_t dmaphysdest1 = 0;
, G7 N7 P1 O0 R) H/ s7 k - dma_addr_t dmaphysdest2 = 0;4 C" G* C, @ q* P( u2 i
/ `' e7 \5 ^% e0 |: x, v- char *dmabufsrc1 = NULL;7 ? w) g, F; [2 Z8 N& o& l, k
- char *dmabufsrc2 = NULL;7 T4 z9 H, t2 R4 [
- char *dmabufdest1 = NULL;
6 _, K% V- K, i, q$ P6 y k - char *dmabufdest2 = NULL;
+ [: [. N& v' L) _8 f# \: y" `
- J) v& R* S( S( B3 W/ B& O$ O- static int acnt = 512;- w) i) g1 W; g7 l+ S
- static int bcnt = 8;
- R7 J* g+ e( P# p5 a2 D' k" x5 O% P - static int ccnt = 8;8 a( f9 B& m4 [* K/ q8 q3 m
- # Y3 }" X/ t. |1 f
- module_param(acnt, int, S_IRUGO);7 B" \* s. I# U: s# p
- module_param(bcnt, int, S_IRUGO);
& M( v/ M& y: J c3 |2 {* L! T - module_param(ccnt, int, S_IRUGO);
复制代码 1 b! w8 j& u, \* i3 K4 [8 e
2 {0 _% a* P H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& Z; b+ a5 E$ d$ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 l9 l: \8 k, t* {( D, ]7 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 M0 z5 @5 N: n+ ^" ]+ Y* m
/ V9 a( @- u; ]5 {( n/ C8 O
: c0 j6 T: \. m8 R& q+ t+ M ] |
|