|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ {2 z/ A, Z3 |5 H" u2 t, {8 Y
- [code]EDMA sample test application( ^% {* Y5 G$ v+ M; ^# T
- /*
1 S+ [* Z/ k. G8 A - * edma_test.c5 g( x/ n% P7 h5 N* l4 n
- *
$ @" b4 Z. x- v7 q8 o6 ^ - * brief EDMA3 Test Application: G0 y. L; F$ X( Z8 `
- *8 }; U# I' w8 v
- * This file contains EDMA3 Test code.$ b; y. l' X1 T& {) a, {
- *" l: `- O( ~$ R& X* U8 V4 i1 K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; E1 Q: J& C5 w" T" Z" p; x4 D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ _+ J3 `/ ^8 V7 Q1 l' ^) I; ^' S3 V - * TO CHANGE.; |; \7 q. u$ Y$ ?- ^( u- q6 U
- *
, |$ q) \ b6 k2 ]' ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) R/ G; B8 x6 T1 k) a2 `: k
- *
! Q* n/ y# w; w+ f7 K7 a - * This program is free software; you can redistribute it and/or% f: e! ? L& v! P5 Q5 e4 a
- * modify it under the terms of the GNU General Public License as# G8 M9 P R3 O1 i9 ~$ r7 ~9 a; ~
- * published by the Free Software Foundation version 2.# y$ `" G$ W" b
- *, V/ r& Z+ v1 E3 \6 r( c5 p6 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 s F8 P- U1 E0 t9 c+ i - * kind, whether express or implied; without even the implied warranty; b# q, }5 v5 z) |8 ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* [1 |+ v" ]; K. H- K - * GNU General Public License for more details.
6 d1 ]6 l% Q6 s" H - */
% X2 ?0 i8 a1 W. C* Q
5 Q- u+ K# b' C- #include <linux/module.h># Z. d5 K, c( J/ i
- #include <linux/init.h>
( U8 \$ u1 I. h" u - #include <linux/errno.h>
: B" j9 G* [# a" u2 ?* M- ^ - #include <linux/types.h>
7 E" ^& n( W- v1 J1 ^9 ]) y% W* J2 l - #include <linux/interrupt.h>$ g9 L/ b8 E) O8 h3 ]
- #include <asm/io.h>7 P! g+ _( C( y
- #include <linux/moduleparam.h>
. p9 T# m2 \' U5 L. ? - #include <linux/sysctl.h>5 e; z% e( T; p! w& {/ @/ }- H$ B& X
- #include <linux/mm.h>
\7 m/ r4 q) t" _. X2 a8 p. p - #include <linux/dma-mapping.h>
5 b/ {7 `" T7 c# W; T$ A+ | - ' H6 \- U6 @: K' F
- #include <mach/memory.h>
/ `& j. L- u: J: l - #include <mach/hardware.h>
3 D, m6 P) ^9 o5 k$ G4 _. N - #include <mach/irqs.h>1 r0 \: R* Z. }" {( l
- #include <asm/hardware/edma.h>( g- x4 ~" J+ y" O, k8 s
- 3 s t% b1 r7 F. [
- #undef EDMA3_DEBUG# V/ k) E& _: ~2 y4 ?
- /*#define EDMA3_DEBUG*/
8 Y3 [2 J5 B" i, U. `" z" A
6 ~2 {! J4 R% j4 O- #ifdef EDMA3_DEBUG
- r' o' n2 v& ]" u a; H9 Q0 j" T# H0 v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. P/ i( x) w1 w9 j8 c/ d- k& S$ Z5 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 l' x H8 l( o A4 N% k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 j! e9 C1 u& Z4 y0 y4 C- `
- #else% z5 I! w9 _. p( y( R, K9 ]- V
- #define DMA_PRINTK( x... )* g0 v8 K4 |1 R. X2 ^% Y' c/ j% t ~
- #define DMA_FN_IN
_) g# a+ h- c" e - #define DMA_FN_OUT9 h! E9 }! h7 s, ?
- #endif
( f3 G* {* ? C# Z: F - ; X" y9 v0 x$ W9 ]' z5 |8 l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ w- C/ \7 j8 {# Y* w8 N
- #define STATIC_SHIFT 3
+ J+ g; h: D% @& k5 y6 I+ ^ - #define TCINTEN_SHIFT 20! j( g1 r6 L }* W7 C6 a* B: F
- #define ITCINTEN_SHIFT 211 ?" `1 R, B& Z. c2 |7 C
- #define TCCHEN_SHIFT 22
2 }' J& Z5 v6 P6 V3 q f8 X% W6 k - #define ITCCHEN_SHIFT 23
) s# k* W$ D4 `$ v# Q
6 _+ Y0 q3 V0 C- static volatile int irqraised1 = 0;
5 J$ W/ g: y" {* b1 R/ @8 t5 \ - static volatile int irqraised2 = 0;
7 z: {- b2 V5 I% l5 W( c% p
. N, @& C, A l4 S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 d \1 _9 ?5 Q" N3 h! q( p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) k1 ~% E, J( V5 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 |7 z3 ?* X/ a7 ?, I
/ E7 z5 z! i* O- dma_addr_t dmaphyssrc1 = 0;
& U& S4 P. P( k" q, _/ k8 x - dma_addr_t dmaphyssrc2 = 0;
' S8 D3 a7 l! P( A# m - dma_addr_t dmaphysdest1 = 0;
: b7 c+ p0 R3 k& C3 G* t. C, u) V - dma_addr_t dmaphysdest2 = 0;
4 [5 g- H) r' g9 g! ~ - |4 B! w+ Z; k9 X
- char *dmabufsrc1 = NULL;) [% I p$ x! w- ~ a& \ F
- char *dmabufsrc2 = NULL;
. ?5 H( u( j- q' L5 U& c9 C0 ` - char *dmabufdest1 = NULL;; s( M/ S% ~( l$ q/ f
- char *dmabufdest2 = NULL;$ U3 x+ W, _/ b3 J D5 S1 H0 Y
! D' [/ c" r' o8 J- static int acnt = 512;
2 R! P [( Y; B' r* @/ S" @8 f - static int bcnt = 8;
; y; Y7 Q/ l7 z - static int ccnt = 8;
) d, H8 p X. [ - # @' c6 m* l/ m# Q
- module_param(acnt, int, S_IRUGO);" k9 w7 n5 w9 [( S8 q( y; f
- module_param(bcnt, int, S_IRUGO);/ Y4 D+ Z' Z. H
- module_param(ccnt, int, S_IRUGO);
复制代码
' w# Z* h/ H3 q* r4 t1 K) T
/ y9 K% |4 \+ @' ?9 d" O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' v8 Z; b8 N( f% p( M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 i% v$ E4 `9 z6 [+ H! U; x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( f1 j! A p1 p/ V9 _( t6 ?, ^
8 j7 ^% ]. Q& k$ g' h" J
1 a5 K) v# N9 p. [* D |
|