|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( H [$ m) w: V- B* ^, x+ h# c- [code]EDMA sample test application
! b4 E5 f" W6 b$ y4 T9 C: h# G) h h+ V& o - /*- y% }5 `( X! {* j& q5 Y
- * edma_test.c
7 W+ X# R$ W3 L, _5 B - *4 F: J B4 \# r2 N
- * brief EDMA3 Test Application
2 ?! O6 J; a( O3 V: T - *
/ z" E% O$ ~$ y" v - * This file contains EDMA3 Test code.' E! y* A: M5 C# ?
- *
0 e2 C. H/ o, {' V: c/ f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
S) C- x& B& w; a3 G2 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: A [9 z# a5 \. ]/ }& V% W" p- p - * TO CHANGE.
. \4 ]1 ~ K* r0 Y" X n( ]* L; x9 \ - *7 V" z" J" y: K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# \$ t+ z4 @5 X! x# A8 ?" F - *7 R! v* X) w8 S" F
- * This program is free software; you can redistribute it and/or6 l! J- z1 U; Q! h5 X0 I
- * modify it under the terms of the GNU General Public License as
$ w l+ s4 P, @- ] - * published by the Free Software Foundation version 2., [, B7 p4 s1 e" U
- *1 a9 D1 g, f( z# G- q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* ?& C0 v# e! D! S
- * kind, whether express or implied; without even the implied warranty
8 o; ?; {2 f: Z* c ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' B- q8 @, @9 q# Y - * GNU General Public License for more details.
1 L- m) ~* K; i5 Q- `1 { - */
( X* F+ P! _( W A/ y
6 o+ C D7 O: y2 Z2 w8 x- #include <linux/module.h>( P1 y$ c/ n* W1 E
- #include <linux/init.h>
: ~+ ?& y, x6 g. Q0 W; F - #include <linux/errno.h>
4 k n5 o5 r- v g) @ T0 U2 W - #include <linux/types.h>! q6 i" B" k9 j) d, _$ s$ {
- #include <linux/interrupt.h>/ i7 b- u7 N& e+ M2 u( O
- #include <asm/io.h>
/ ?2 N4 K* Z/ s& B3 S0 v - #include <linux/moduleparam.h>
0 F( f0 n! T6 ?. D' d - #include <linux/sysctl.h>8 e+ d- q' R; p# a& C% Z6 z
- #include <linux/mm.h>) C" ?) F W3 f" }
- #include <linux/dma-mapping.h>
- S. i) D3 i" B8 l$ d& i# g - + X9 m9 P- p$ I$ T4 Q3 Y
- #include <mach/memory.h>
' j6 E5 L m5 U& g3 I' g$ g - #include <mach/hardware.h>
/ S0 G$ v$ D5 C& a4 W! I - #include <mach/irqs.h>
8 y8 z. S; }. N |8 @0 a - #include <asm/hardware/edma.h>, c7 r7 T5 t& t a0 j- V' C
. a/ G5 `3 K: i. Y5 a- #undef EDMA3_DEBUG6 F r# c; ~- q+ R( ]& I. s
- /*#define EDMA3_DEBUG*/8 @9 k4 w* Q+ L0 u) ?
' a; o, S3 X% d, n. [% G- #ifdef EDMA3_DEBUG
4 ^2 _9 z- s1 | i0 z4 W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' y3 n1 N N& V8 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 z8 t% q, p( \; R# ]9 T: b, j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; W0 J1 h9 ~8 K1 }& v5 Q8 J - #else
; z+ {; R/ [$ s3 C2 J# [ - #define DMA_PRINTK( x... )6 R# @2 @7 `0 [# o; m4 R
- #define DMA_FN_IN( K) F* | m; P6 G/ }& W- |
- #define DMA_FN_OUT
5 r x5 S7 ~# g* n" Q+ G, I. \ - #endif, ~( t5 Z; ?7 C8 K
- , D4 Z9 P9 Z ]( C0 _6 S( A+ [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. H1 W; ]6 O1 {/ }8 L' w; g5 { - #define STATIC_SHIFT 3
* ?9 q9 Z4 v9 d# U - #define TCINTEN_SHIFT 20
1 S! M+ Q% t2 B6 |8 x( H - #define ITCINTEN_SHIFT 217 X H5 ], J$ E. Y- P
- #define TCCHEN_SHIFT 22
3 p8 O# r, O# E8 {( M# E - #define ITCCHEN_SHIFT 23
# l- s7 c/ U; R4 q4 |- ]( H
8 T- f1 Z8 _* E6 N' r- static volatile int irqraised1 = 0; b5 J: J" X+ ?3 n; X
- static volatile int irqraised2 = 0;8 ~, e+ X" \+ q( P8 \4 W
$ C% l2 I `- V" `) }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
\! P) T( m$ d% ~- x' X8 q' D) L: p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ P$ i z3 ?% H# p4 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 T% V; Z! ?: r) F# i3 a8 l
- 2 O, H/ y6 D3 L5 [: `
- dma_addr_t dmaphyssrc1 = 0;' s8 o x5 Q9 G8 {: l" _; Z) n2 d0 D. |
- dma_addr_t dmaphyssrc2 = 0;
% G4 L5 O# }$ C; x( X: X - dma_addr_t dmaphysdest1 = 0;1 D- M0 l" y2 T5 s. M% @1 R
- dma_addr_t dmaphysdest2 = 0;/ x0 o9 a3 {( a( `. J# f0 ]+ H
: }# r% K( ], }9 B/ O* d- char *dmabufsrc1 = NULL;7 [9 x8 q* D/ P9 m# G) n6 K
- char *dmabufsrc2 = NULL;$ j: C6 G* \6 p
- char *dmabufdest1 = NULL;3 D: e! B- P) S0 W+ z
- char *dmabufdest2 = NULL;, O, {! z% C$ J2 t
- S$ Q, c! N5 D2 [7 F c
- static int acnt = 512;
1 r, d/ Y* a0 d1 ?" V - static int bcnt = 8;
0 r# i$ [+ d* | - static int ccnt = 8;
' w1 [/ r6 D8 v$ d$ F. k/ T
! |* {' M. K3 x- module_param(acnt, int, S_IRUGO);- p1 S8 d0 A6 U/ B" q/ e0 Z6 ?' q
- module_param(bcnt, int, S_IRUGO);
/ E* E" i& W- f2 i$ v. C+ D8 G0 t( q - module_param(ccnt, int, S_IRUGO);
复制代码 2 T6 d, m, e6 ]
. y- ]' K, K% P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- Z! N; N% h, |* [. {+ q6 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) K- ]' G. Q3 s+ c/ v& k0 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 Y9 B& c& i2 F- o
% B2 k6 T9 `+ y! E' ?8 n3 S/ @( H: ?- H8 B/ N+ n3 j# |" L
|
|