|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. Q" L$ X: ]0 C4 h1 _- [code]EDMA sample test application
0 R9 Y y/ [5 ]6 J - /*
3 |! O% q+ {; P; k - * edma_test.c* V0 x+ D" j# d+ K2 _
- * J4 x$ L* l! {( ~
- * brief EDMA3 Test Application4 B& ], h! g' h. f: [0 v5 b
- *
( }; Z1 n9 p `. x6 k! O - * This file contains EDMA3 Test code.5 n) K0 C( V! F
- *( h/ i# b. R+ Q4 u9 M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 p5 Z/ |, t( e1 m7 q. x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 V; W' i6 W- e: b. N; j' i
- * TO CHANGE.& V. }2 b0 B7 m5 t0 z
- *1 w2 n0 n; T5 N/ g. I3 H- F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 S9 Z) E6 M8 K' r) C
- *
! |; q( m" `2 ~( _) g - * This program is free software; you can redistribute it and/or
' `( N! y7 k! D" R0 {$ K$ i - * modify it under the terms of the GNU General Public License as2 r- e2 q" t/ Z2 U
- * published by the Free Software Foundation version 2.7 P9 _1 c( q+ y2 s2 V6 \# h6 h! h
- *
+ |4 b4 L. Q$ s% Z/ w W; B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' m; E1 x* h2 \- y - * kind, whether express or implied; without even the implied warranty
, q+ {, b! k( T" F# Z5 A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% L4 [- @$ V, i1 c! ?( o
- * GNU General Public License for more details.' |6 C" s _( a1 C8 @9 T m$ h
- */) H6 i7 Y- Y7 ?. Z. E
( L) I8 {& ^7 d3 a; J" L- #include <linux/module.h>
7 [6 U. y2 e2 `: H+ j$ ^ - #include <linux/init.h>
6 V7 a- Z$ V% Z& ^5 I - #include <linux/errno.h>
1 _- c+ `7 t4 v! H# p6 o1 E - #include <linux/types.h>: F* G, E0 D, V6 b n
- #include <linux/interrupt.h>8 p' B. }& \% k1 _
- #include <asm/io.h>
- i* C- I' k( I) m5 R - #include <linux/moduleparam.h>
6 X0 c I% o& l. O) q - #include <linux/sysctl.h>* ?& y- q9 y& S" o7 e W! C
- #include <linux/mm.h>6 @# ?# z7 l' w" @$ X+ k
- #include <linux/dma-mapping.h>
/ }, D2 m( T: {, n - 0 X1 j1 ^& N$ Z' e& F2 y
- #include <mach/memory.h>: U$ A* c2 T, @: R7 _ k/ S$ B' g
- #include <mach/hardware.h>
3 ]% t2 K$ w ]9 w. M - #include <mach/irqs.h>
. i6 Y. Y- }% g - #include <asm/hardware/edma.h># u; \3 E8 Q# ^: o' Q. s" A
- 4 M! A% { g: {6 a/ t
- #undef EDMA3_DEBUG
/ ] w5 ^& s& `& g/ A# s - /*#define EDMA3_DEBUG*/
4 G0 Z. W( _% c% b3 c& S; B
( ~3 p3 s2 z1 e5 q( J2 U- \- #ifdef EDMA3_DEBUG
( T* W A8 Y3 v* r3 g" o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 E( m% T; o# q) Q( F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 w3 z6 L: ~; |9 ~, I" K2 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): W6 A! z% z2 B, n! V" ~% o% ^4 j
- #else
1 Z# |7 d; F, c, l7 g8 f - #define DMA_PRINTK( x... )8 }, w+ z8 Z# q# l
- #define DMA_FN_IN: K9 n/ U [& d c- P1 Q$ l
- #define DMA_FN_OUT
K( q& N( n' c5 Z) m$ B- u - #endif
4 h r$ D: V! U5 p+ p4 q* O8 x/ \6 z' p+ { - ! \, c- a, x5 D6 F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 j4 z7 t+ g. v I6 z, D/ j - #define STATIC_SHIFT 31 V y- u! H9 w. ]' |
- #define TCINTEN_SHIFT 205 u% J9 m o- ]9 X5 M" k, N
- #define ITCINTEN_SHIFT 211 x+ e7 X2 d. r0 F
- #define TCCHEN_SHIFT 22
5 r3 @8 M) Z; B# _6 N4 v T - #define ITCCHEN_SHIFT 23% W. ]8 ~- C7 b2 L+ Q
- 9 r' m4 V' r, y. v& O) C3 q( t% q
- static volatile int irqraised1 = 0;* \2 ]( Z* z- x; ]9 v3 L* A
- static volatile int irqraised2 = 0;" M4 K: j+ o8 J2 W+ S4 c
- $ c, i: H1 d" b5 o( D8 S, }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# I$ _% c$ a, T% y3 `( A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. L& J: V7 m9 L9 X5 \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 A( U# y& P9 b0 w
( _1 z4 s: \0 c5 c" W- dma_addr_t dmaphyssrc1 = 0;
, O6 h) m' j+ C% C3 v, ^6 p, U - dma_addr_t dmaphyssrc2 = 0;
8 w! D6 p; T# ? - dma_addr_t dmaphysdest1 = 0;4 g6 v! A! r9 p. e8 Q1 F& \; |- A
- dma_addr_t dmaphysdest2 = 0;
9 c" S7 N( u# w! m7 V - + }3 A {- a8 ]3 x9 l( p9 `
- char *dmabufsrc1 = NULL;
- l3 Y/ D1 s5 [9 z, }& s, o3 C& K - char *dmabufsrc2 = NULL;
) r, f% G7 h, p - char *dmabufdest1 = NULL;9 c/ r" t* n* ^7 t8 x9 ]
- char *dmabufdest2 = NULL;! H. C" S( X+ w$ R$ }3 a* B
- Z! b5 Q' [4 a! W, R% q! p
- static int acnt = 512;& ^2 s) i% O6 `3 ^8 x- ]4 o: Q0 h
- static int bcnt = 8;
& ?+ a( y8 n2 H - static int ccnt = 8;
1 _% Y' V7 T. c. P* _
: Q' l. B ]9 B& m" \3 ^- module_param(acnt, int, S_IRUGO);* D# I% B: P( P+ c8 H* ]3 ?
- module_param(bcnt, int, S_IRUGO);1 |& g( _' V, Y0 k- f
- module_param(ccnt, int, S_IRUGO);
复制代码 / Q9 L1 P+ U# Y g1 X0 _+ U- V
# ~3 w# V/ Z# O9 F' ~( X* `. H' K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ l8 |* G6 \1 y2 b3 f2 I ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% I4 I w( z* m" h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, b% Y/ ~5 Y- ~( p E
1 g0 S, b$ V6 G; D3 J9 K% a
3 l2 _$ F/ Z8 R5 Q2 ~( ? |
|