|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 ~, n* t' A6 ^1 [$ d- [code]EDMA sample test application% ^6 N/ e y3 p. |$ D5 J% j0 x
- /*1 R0 y, A/ ?( a* e( }4 Y+ _5 I
- * edma_test.c
0 _' W. n4 |4 |( ~! p+ ^, R/ a+ [ - *
- c& \1 e6 J1 A" i2 r/ x8 A - * brief EDMA3 Test Application
1 r8 k( M! q% r: m) N: g - *( C; ]% v$ i3 b6 i/ z$ O7 v
- * This file contains EDMA3 Test code.
- J/ d6 t7 v4 z - *
$ X4 P- e- A6 X. I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 t: Z5 X* y- T- u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& g* t3 x( y+ i+ d3 _/ V) G1 X; o - * TO CHANGE.* O( M7 i; ~0 n" P
- *% |0 Z0 }5 \" w6 v7 C' K7 g) I9 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ Y' ^. p8 B& e3 E% L1 k3 v - *
I# L) }8 I% G1 S4 N& [' r - * This program is free software; you can redistribute it and/or
2 A* X* O& `3 I1 a( a - * modify it under the terms of the GNU General Public License as
2 |: Q- ]* { V* ] - * published by the Free Software Foundation version 2.
, a3 N1 q+ }7 V; ? - *' ~' i6 a" ?; S3 `, W- r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 N4 @; J! O. S- w
- * kind, whether express or implied; without even the implied warranty
0 F* P! o' X& p+ Y/ h7 j; b; u ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 \, l( \0 ~$ C9 @8 U - * GNU General Public License for more details.; t& q* k3 q1 Q4 T/ w
- */
$ U6 c4 p+ C! A6 x1 T - 0 _5 M0 h: M- ]
- #include <linux/module.h>2 [# b+ l( ^& ^" f! ~* [
- #include <linux/init.h>0 V& ^2 M5 |: y* u, x+ [6 J
- #include <linux/errno.h>
' h% V) V0 o% h& v( R0 X( D - #include <linux/types.h>* \6 Y1 a6 `, b
- #include <linux/interrupt.h>
|3 h E+ m* U) J! G - #include <asm/io.h>
: j" ~9 W7 W: f6 \, r - #include <linux/moduleparam.h>
1 |! D4 y! [! r - #include <linux/sysctl.h>" I# r+ }8 w9 a g
- #include <linux/mm.h> b3 @$ o( D$ t
- #include <linux/dma-mapping.h>
' a# Y1 o$ [3 D - $ y [* k& ]! v- F' d* A
- #include <mach/memory.h>% L9 p/ s' c; G+ X& m4 Q
- #include <mach/hardware.h>
. o2 W7 Q; k$ B' Z- A - #include <mach/irqs.h> M+ g" c$ C5 u
- #include <asm/hardware/edma.h>
3 @5 k% R9 N( \. F0 L& z - ! I* Z3 t! T8 h2 H; E
- #undef EDMA3_DEBUG
7 f7 t. ~2 q9 F/ m7 ?: ] - /*#define EDMA3_DEBUG*/
7 L/ s& N: t! |6 Q2 z
; O4 Y! K8 D, J0 ]9 b1 D4 d- #ifdef EDMA3_DEBUG
5 G$ E$ V4 t# R+ @1 L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 Z+ G- z3 @, x$ J \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" o% }- m! U8 a2 z5 G9 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# _# H9 l* K2 P: x3 w! q
- #else$ }4 Y1 I4 z3 D+ A
- #define DMA_PRINTK( x... ) G( s. O% M; r$ ^ I
- #define DMA_FN_IN5 C2 U$ A4 x2 C5 O; o) y1 c4 |4 l
- #define DMA_FN_OUT
" N }$ V* p/ C. R6 M- p) V& D+ b3 { - #endif
- _& \% U6 [+ I8 r" a
, L5 {6 Q' f; p5 t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" p3 M, a2 F! z; M - #define STATIC_SHIFT 3, b0 U. `- }% n; u! ?6 c4 X
- #define TCINTEN_SHIFT 20# }/ y; a" u) o$ N( D/ Q! ]
- #define ITCINTEN_SHIFT 212 f* F" m+ m' O/ I
- #define TCCHEN_SHIFT 22) s! X; g; G6 h6 f3 Y
- #define ITCCHEN_SHIFT 23
6 m. p- [2 ?$ K* [* Q+ s
* E3 S' C+ U o- static volatile int irqraised1 = 0;
. Q; D* U3 P% n$ V/ y" T - static volatile int irqraised2 = 0;
: c8 c- ^5 j2 w, s- x; F - 1 M! v4 u# Z D. C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) g2 A+ D3 y- b R/ D5 T4 [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 H# G8 b$ a* H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) t* x3 V/ M. d9 A
! Y/ ?0 D7 J( z) v+ [- dma_addr_t dmaphyssrc1 = 0;
/ T" ?0 W/ K7 }( @ - dma_addr_t dmaphyssrc2 = 0;2 z2 ?2 D/ L& F( {
- dma_addr_t dmaphysdest1 = 0;
# F5 L4 L7 P! |0 O - dma_addr_t dmaphysdest2 = 0;
- G- s9 H3 O' {
k' z& a) U3 p s% o% q- char *dmabufsrc1 = NULL;
! m. s7 c: z) x - char *dmabufsrc2 = NULL;
+ J& ~5 }6 H- P m7 c% M - char *dmabufdest1 = NULL;. G) O- `; V/ q" G2 |
- char *dmabufdest2 = NULL;
6 [& s- ^3 k1 y7 s7 C0 F c# ?1 Q
4 [& R5 u0 E9 k8 z+ S& F- static int acnt = 512;
8 [9 M; R3 ^6 f* B5 x- L0 P, w; S - static int bcnt = 8;
5 N. N8 X0 m$ G. z! I- P - static int ccnt = 8;
$ c; k) P4 ?& H4 _: t
4 D! h* r6 y8 U& K/ N; h* M: M2 V- module_param(acnt, int, S_IRUGO);
* U! F) x; J2 Z, m9 h( V/ B - module_param(bcnt, int, S_IRUGO);3 z- q* p5 T' y/ E5 o
- module_param(ccnt, int, S_IRUGO);
复制代码 3 Z9 _2 _( A" y; T, \6 ~
! m+ |8 M1 R& e! @. T* h) v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! o4 \, v' M9 d# X( Q, k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# n* K3 u5 j7 C, |+ ?5 I/ v, s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 d% n4 w& ?( n) _+ O3 K' ~7 p, ?9 @/ G8 ?3 I: G. a
2 j0 I, w9 o. e$ \- ?
|
|