|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ B; T( E5 Q2 ^1 G5 n$ B: Z' R- [code]EDMA sample test application
# \4 @& u4 G3 W9 \7 B. _ - /*6 v1 |3 Z: ~: _- Z# M6 a2 Y; j, n
- * edma_test.c
' R+ ^9 U+ B' m, K! M; o5 t1 ? - *, Q) ~; n! T; G: e* i1 k9 _
- * brief EDMA3 Test Application C; Q9 c8 W* D8 `
- *
, {- X; G" U8 |+ q; b: C8 l7 [ - * This file contains EDMA3 Test code.# w/ B0 a1 I/ \5 J
- *4 Z; \7 N9 Q$ q2 a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. a' d2 t" t( O9 k* y" M: W3 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; }7 }6 p$ ]$ { - * TO CHANGE.7 r( u5 E- v' c! ]5 Z: ^( S9 v
- *$ z! B7 p$ H6 c( k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ \' Z' O. o! J; m! J- ]8 Y# x5 B( A - *
% T) r& ^5 R+ O* q0 W* ] - * This program is free software; you can redistribute it and/or
7 ^" g. {' u6 C - * modify it under the terms of the GNU General Public License as
( F0 v6 G5 X3 y - * published by the Free Software Foundation version 2.$ A8 }5 G7 k4 _) {* C7 ^
- *0 c8 f0 j( D2 s- A2 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: ~! ^* m1 ^2 r3 C - * kind, whether express or implied; without even the implied warranty4 S: e, z9 [, L$ ^- ^) x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- U* R- q0 A7 e7 |3 k
- * GNU General Public License for more details.9 Z) i5 B8 l; ?' b# G/ e7 R
- */) [6 ?, n, K3 K2 u" z
# C6 W p# u1 ^$ p4 h- #include <linux/module.h>( u: h! _1 M( e" y4 }1 O: ?
- #include <linux/init.h>
( g. m9 q, y( f) L% d# H - #include <linux/errno.h>
) o/ X6 Z. N, h - #include <linux/types.h>
{" F9 Z8 g/ j5 a/ z3 m - #include <linux/interrupt.h>8 D' }* y3 n' \* D( G
- #include <asm/io.h>
* B; U* W5 [; x6 v$ t l7 r - #include <linux/moduleparam.h>+ T z0 l% X" N0 x; Y( U6 M( h
- #include <linux/sysctl.h>
$ s# ~5 u0 h- y( x | - #include <linux/mm.h>( k+ b5 K) H$ u" Q# m
- #include <linux/dma-mapping.h>/ x" X! {) y2 b: Y( W
- ' M, I. x0 u" K1 e# L) {7 ~8 _
- #include <mach/memory.h>( W9 M9 g/ D- q$ x7 a
- #include <mach/hardware.h>+ {) }, V) L1 l# I0 }! U
- #include <mach/irqs.h>. a* H0 l! e; F% E! n( T6 i
- #include <asm/hardware/edma.h>$ x9 \6 d1 i$ [
+ I8 U( M# ?! r' ^% m- #undef EDMA3_DEBUG
" L/ b* K/ ~6 p/ F% y1 X4 _$ Z - /*#define EDMA3_DEBUG*/
% t7 j& `# c a$ q; _4 X- D - 2 N# c2 |% q, n1 o" T- J
- #ifdef EDMA3_DEBUG$ D# v6 _/ b, u* K( g3 x2 b" Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" C4 ?) x" U; Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 T* b0 z# R* v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* ~. ]6 o! D/ T, z
- #else
# b1 B* \5 k" W: K% o - #define DMA_PRINTK( x... )
g5 `+ S+ y/ S8 P6 i& r- B ] - #define DMA_FN_IN/ Q( J4 }. G4 B# C9 C" q; \
- #define DMA_FN_OUT9 M2 t/ e/ T f
- #endif
1 d5 V# Y& Z' c - ) U& M, B8 ?6 K2 h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ B# \0 N I7 g! K1 T+ y% b - #define STATIC_SHIFT 3
4 x7 \" b8 P4 @( i - #define TCINTEN_SHIFT 204 u9 m6 g$ E/ }8 m5 }
- #define ITCINTEN_SHIFT 21
5 v4 m- f! d% S3 N' x5 @ - #define TCCHEN_SHIFT 22
2 {3 o; s% }! m - #define ITCCHEN_SHIFT 230 ~$ C3 J% R* @) ~6 S
, m" Z9 n3 }4 a$ v1 Z- static volatile int irqraised1 = 0;4 q" ]; I9 z8 U! ?( H5 Q+ K
- static volatile int irqraised2 = 0;
% r, _& ?) d; c: l8 Y5 N
7 A$ P5 {- L" z9 q8 q/ P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ^9 G* Q9 J/ y R/ j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! P! C) k% D+ a L* n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! B+ Q: Y/ D& T$ f
8 d' W; D; _2 m: U7 q; ^- dma_addr_t dmaphyssrc1 = 0;; e5 c v4 P" D; p, S3 a
- dma_addr_t dmaphyssrc2 = 0;& Q/ l4 Z) }7 A4 z
- dma_addr_t dmaphysdest1 = 0;! e/ E7 |1 L- g8 a- ~ z: J. {
- dma_addr_t dmaphysdest2 = 0;
# G# ~; |9 M4 T* B8 R: V; g, y4 j - ; Y8 ]8 f6 G- m- _8 B9 [, P0 h
- char *dmabufsrc1 = NULL;
1 o$ B) Q& i# g: B8 V% b - char *dmabufsrc2 = NULL;
, U8 B7 y$ z- M3 a& ^3 Z3 p' T - char *dmabufdest1 = NULL;
; {! k8 N x* S0 u - char *dmabufdest2 = NULL;; x8 D, L7 y. b0 ^- I$ U1 K
- ) {/ s, N; b, e+ z
- static int acnt = 512;$ [( x) v/ P1 j) ~/ Q
- static int bcnt = 8;" T/ h) p( a: z* q1 f
- static int ccnt = 8;
5 G* k1 Q3 {) J6 r8 E
1 n5 ?" I# S7 N- h# u/ b5 I- module_param(acnt, int, S_IRUGO);& @7 T: q. S$ L+ I
- module_param(bcnt, int, S_IRUGO);) Q/ V' W3 ^3 o; x% C
- module_param(ccnt, int, S_IRUGO);
复制代码 0 e1 z% A- N5 M7 V ~9 z s5 X% I
1 ~! R; b) Y/ C7 V) f& @! w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 N/ w; f/ {* r+ D9 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" w' C8 h) h% |$ r, C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ H& k' C& r; c
5 b6 U8 ?: f2 T4 h$ x
2 B! x5 n. L0 P# ~1 K
|
|