|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) V$ R1 Q# @9 `8 p) V0 E
- [code]EDMA sample test application3 o. h: e0 C) e8 @0 Z" k% \# D" J
- /*
; j5 R. h. \: u# }( ~ - * edma_test.c) I1 @' N6 Q7 u3 {
- *
4 J/ o! x% r; ~ - * brief EDMA3 Test Application, e/ ?8 o3 o( j9 l& U
- *8 L: }8 k6 q5 w$ k8 x2 v
- * This file contains EDMA3 Test code.
0 V' v: x( K# s - *2 T5 n( u( O9 |5 D& T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 S, |: R: M" A6 r! ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ h8 ~; c0 a' K
- * TO CHANGE.
: e @, A+ @& ]! p5 D4 E - ** ^& n3 c; O# o6 K0 k& F1 s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 t& a0 w4 M# g, T
- *; n6 Q2 v0 h& u2 w
- * This program is free software; you can redistribute it and/or
: K$ Z! Q. ~2 P }- J - * modify it under the terms of the GNU General Public License as
+ p) `0 P- ]1 r - * published by the Free Software Foundation version 2.+ I4 d6 @- k9 }3 O6 b
- *3 _" I/ G3 R8 v5 F$ S1 e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 T6 l0 h7 y' B# X( L& m
- * kind, whether express or implied; without even the implied warranty2 ? w0 L) m+ w3 ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 c* `' e0 E T: `0 J. x - * GNU General Public License for more details.
5 p* a+ b" W, B. M5 R - */
$ I& A/ x# b5 G0 @; `9 U; F - 7 B" @+ N9 g% D4 j$ R$ _
- #include <linux/module.h>2 ]% Y- @" f; A- p5 S9 Z: N- w% l0 n
- #include <linux/init.h> P6 w1 }% G! h. y0 k+ t$ \9 D
- #include <linux/errno.h>" l) e5 C+ K, b6 _
- #include <linux/types.h># b% v% s C: o* \3 i3 k1 T
- #include <linux/interrupt.h>
9 g. }" B) l" T: |6 G - #include <asm/io.h>
8 j+ z0 A. W' n* z: P2 u8 v, B - #include <linux/moduleparam.h>( C2 ^- d1 u# k* r; Z0 o
- #include <linux/sysctl.h>
" u# j/ F( v6 S - #include <linux/mm.h>
# q* i) r5 Z, B0 l% {1 s( K0 p; m - #include <linux/dma-mapping.h>* d$ }0 j X2 Y
- $ E( E4 Y* L j5 G, d
- #include <mach/memory.h>
: x. u7 P! t8 G1 x0 s; z - #include <mach/hardware.h>3 `6 s; N3 f9 I$ r4 L. F" S
- #include <mach/irqs.h>
. G* f K" I4 y) q - #include <asm/hardware/edma.h>1 S, p) W9 i( g" r) s! {
- ) b# I# q. D8 R9 J% O) i% x* {
- #undef EDMA3_DEBUG
. X/ K3 L* p" W2 b, Y7 G - /*#define EDMA3_DEBUG*/
6 y v M. r7 q6 v5 R+ e' P
7 T/ W( r) A, X, g8 D! w( Z- #ifdef EDMA3_DEBUG
4 r& U" z i: y- H3 W }# u% K8 K* M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 G/ I* c! S+ p6 j9 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 N/ h* I" a! f3 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, n# n' y' L4 v7 E/ M4 Q9 l - #else
* |/ C9 M' I2 Z7 N' j6 K - #define DMA_PRINTK( x... )0 b% F/ [1 t& \0 @- F. U$ p
- #define DMA_FN_IN1 M5 M: R8 b. H# l, A
- #define DMA_FN_OUT/ V, H6 j: c6 g1 O. p* t: Q* Q) }
- #endif
; g6 A) S6 \: h
0 h0 ?+ G: J# Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ F. b6 c( R; b% Y* Z1 i - #define STATIC_SHIFT 3
' q- |8 w7 C9 G - #define TCINTEN_SHIFT 20
. m" G1 a) G) N* r0 R3 P - #define ITCINTEN_SHIFT 21
5 T/ J7 o }6 S' K, h7 j% Q - #define TCCHEN_SHIFT 22
. ~" w9 S! t5 `. I% W - #define ITCCHEN_SHIFT 231 `/ J4 [3 w5 Y! A' ]
- / l) G- o" f# g7 z& y
- static volatile int irqraised1 = 0;! y, T0 K5 x( a6 P) U$ {$ a+ L
- static volatile int irqraised2 = 0;
' K& y) {5 g7 k, X
3 Q/ ?8 p. P5 |% f( a* }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 M( |1 a6 ?$ t$ ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 [1 ], {6 H5 s" ?, t* P/ t9 n4 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ]# z9 V/ |% ?' q
- s( a( \3 H" ^7 A5 s
- dma_addr_t dmaphyssrc1 = 0;5 G4 L9 n* X& R' P8 f7 `$ C
- dma_addr_t dmaphyssrc2 = 0;
( a+ R+ D2 R7 t" L3 d% Z$ h - dma_addr_t dmaphysdest1 = 0;: _3 z( `0 [' m* Z
- dma_addr_t dmaphysdest2 = 0;: v# I9 ^, k' y" j p
" ]# I* w5 b# K3 z6 G7 N- char *dmabufsrc1 = NULL;; C; I. a7 j5 A; f
- char *dmabufsrc2 = NULL;! A! x. b0 U; Z& R% O$ N' J; \
- char *dmabufdest1 = NULL;0 _, v- F. O8 K. e& W' Q6 c9 G
- char *dmabufdest2 = NULL;
9 @/ w: M; o1 x
/ l& R0 U6 _% I- static int acnt = 512;7 b4 a5 g7 Q+ x0 u! m% S
- static int bcnt = 8;6 ~- \7 e: {: ?* E: @! {0 P) f
- static int ccnt = 8;
, p/ j' ~/ y% H6 Y' y0 X
: b5 \9 p0 V# o5 f- module_param(acnt, int, S_IRUGO);$ H* Y. p/ n8 r% W0 W2 ?
- module_param(bcnt, int, S_IRUGO); [& X& D1 z& ]' m) N6 j$ k5 E
- module_param(ccnt, int, S_IRUGO);
复制代码
, g; y+ M+ W. G' q# _) n) Z3 N3 R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 T& H3 x0 w8 h4 _8 |4 |
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 {& |- r- @& O4 l- R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 t7 M& d9 o" B( `
/ d9 x1 c$ @! R: g
0 }# ]$ F# u. X* | | |
|