|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( X2 K! i9 U! b1 _) }
- [code]EDMA sample test application/ q0 g& W @' X w$ ~
- /*
$ G. i/ S, S0 V - * edma_test.c' X V0 a, R4 ^& P
- *2 D4 {8 x! \) k# u4 W4 W
- * brief EDMA3 Test Application
, b1 Y; e- Z! l - *
; d' n, \* X! w - * This file contains EDMA3 Test code.
8 I. g, g( z2 Y% M0 e0 Y - *
7 t0 W7 |5 Q7 ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* V I" Z8 ]4 D$ E4 n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: q, x4 y4 i, O: Z2 M7 Y( Y - * TO CHANGE.
0 q5 c; o% r, V; _ - *6 f0 c& s# o: f) P d6 A2 {8 R; \" V. t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 l6 q' C9 b- H+ L+ e - *
: v5 O9 ?/ T- \ - * This program is free software; you can redistribute it and/or' T5 S$ y6 l6 Z* @
- * modify it under the terms of the GNU General Public License as9 {" r# x6 F# j1 S
- * published by the Free Software Foundation version 2.
: T; Q% F9 R: Z8 I. W, V - *0 B8 M4 J. R U, _, j) g* J% i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' q* p2 R7 C$ x - * kind, whether express or implied; without even the implied warranty
* r: ~' t9 s1 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ G1 Y8 W# B5 h
- * GNU General Public License for more details.% b5 u6 t0 Y; k, z) F
- */
1 K2 Z" t$ d1 p; I, }
+ ]+ `8 f- v- |4 m7 ]0 E5 ~" t- #include <linux/module.h>
$ Q3 B" r+ O+ V - #include <linux/init.h>( e" S% v! p3 f9 Q
- #include <linux/errno.h>
/ q4 E3 Y5 I% q* C$ G% ? - #include <linux/types.h>8 w3 ]8 o$ r4 ]4 Y$ ]- M
- #include <linux/interrupt.h>
2 g4 _' e. Y( i o - #include <asm/io.h>
8 @1 y( z5 G0 y9 x - #include <linux/moduleparam.h>
( ~; H2 S0 P) K) p( j - #include <linux/sysctl.h>! r, d- A" K% {" F
- #include <linux/mm.h>
$ r& m2 J- w) L& ]7 u! o0 M - #include <linux/dma-mapping.h>1 y6 S/ `9 R5 t$ o' U
% \& U' I. Y. D* \- #include <mach/memory.h>+ P2 W E) B# }& a* b
- #include <mach/hardware.h>7 Z& ] q: Y$ O2 r+ b7 K
- #include <mach/irqs.h>
" t0 W+ ^- e# G: M5 b - #include <asm/hardware/edma.h>! p/ T, ^6 E9 K/ e
- 6 s5 y$ M* K* x2 ?0 k* z
- #undef EDMA3_DEBUG: F* c# z X) E9 E2 x3 H0 T
- /*#define EDMA3_DEBUG*/* ~$ ^. F8 k( O- y( b8 Z7 ]4 B
- , b/ k1 h" f- W/ S) N7 e" v0 A: A. N
- #ifdef EDMA3_DEBUG' e+ m% y1 x! ?! [9 T* T. l, x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% g( B* ?5 ^& E; A" ]' d$ V( V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ `, d, J4 U4 F9 z& V! h, N8 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 `/ p' Q; H' j2 s# q
- #else
6 y1 h: q3 [( y6 I - #define DMA_PRINTK( x... )0 ~0 B' T* U: a
- #define DMA_FN_IN& y4 ~( b, w! v+ i# f, o ]
- #define DMA_FN_OUT* q- Z- z, c8 j5 z0 F2 E
- #endif: T. ?& Z/ W0 r ~
- - W- S% [( J2 E3 b! V M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- B7 w" J2 t0 R& Y' P$ n - #define STATIC_SHIFT 3
( l/ j: ?/ `( o& d# o; E - #define TCINTEN_SHIFT 20$ K& z( o# f2 |8 n) J, B0 u5 l
- #define ITCINTEN_SHIFT 213 C" G, B f% j3 p6 k
- #define TCCHEN_SHIFT 22$ |( a! T1 [1 i" ?
- #define ITCCHEN_SHIFT 23
+ l% V, T1 D& R+ _( D1 _5 J' u - h4 A0 c, U4 u8 f/ S- w T
- static volatile int irqraised1 = 0;
# v1 ^- E7 H9 _! J7 n0 S& n z - static volatile int irqraised2 = 0;& w9 Z3 X9 G. o+ Z* ^
- 2 T+ q7 l. S N% a! O+ u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 k; h% Y; A% f' ^4 \; g0 @1 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); C- q% }; v9 b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ` m; Y: t7 W' V. \
l) ?0 \9 f2 ]. X, V- dma_addr_t dmaphyssrc1 = 0;6 _( U) Q4 z$ j% [
- dma_addr_t dmaphyssrc2 = 0;
, W. f/ a/ J( @3 I& S" Z1 {8 c - dma_addr_t dmaphysdest1 = 0;
7 J7 u9 e N6 n8 N4 u - dma_addr_t dmaphysdest2 = 0;# T4 l- |" S' w) Y* m
' R/ D, R: I8 g8 v4 L# P) X- char *dmabufsrc1 = NULL;4 b, Z1 [/ p% w2 Q* f4 Q# {' l9 z" o
- char *dmabufsrc2 = NULL;
. ? Y+ U# c% J+ c) c - char *dmabufdest1 = NULL;
# M% P! i5 q2 ~, f+ U7 X - char *dmabufdest2 = NULL;
' }( \2 o* y' y9 e& ~# V
% {5 y, X: s) c% g' e2 f( u$ T- static int acnt = 512;
- }. v+ ?8 ^& S - static int bcnt = 8;
B" b+ ?9 {/ Y5 @+ w. e5 c7 ~- P - static int ccnt = 8;, H7 M3 k2 ?) w) x" _0 O9 k
- 3 y& V/ W7 R! [; V, A4 \1 C* [
- module_param(acnt, int, S_IRUGO);
. v w" Y1 n3 d - module_param(bcnt, int, S_IRUGO);
- G+ G0 x4 b3 n. o& ^ - module_param(ccnt, int, S_IRUGO);
复制代码
% Z+ o% M4 J. V) a. ]) O; r2 x7 M5 Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- F+ q' H+ Q* E! |& e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( f) ?7 U1 h# i$ j) ]. ~/ P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 K' K3 N: J9 X4 z- }
& b5 _+ v! Z! {( r- D. s( ?
) I; |* p' \+ Q. P! |1 J; h6 c |
|