|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * R: ^+ j- v4 u
- [code]EDMA sample test application
, |# t. i _8 l" q - /*
$ w7 r* r8 e* a8 t4 Z, Y+ c - * edma_test.c' p/ K. j! d3 m- K
- *
5 z. P: V9 g1 E( H# `2 F - * brief EDMA3 Test Application5 N( H9 z9 _) f( i
- *' R5 z3 D( q0 p* D3 p6 M* j: B
- * This file contains EDMA3 Test code.& I5 r: y9 u' ]7 k1 |) ^0 U j
- *" u! I, A1 t+ c! X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- \6 H+ m' z& D* h( D+ a) ?. b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 t: z. X) z) s. ~9 R - * TO CHANGE.2 w5 S' _) d9 Z7 \# O0 @2 l
- *
( E6 I9 J# u1 a' Y* G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ r$ W9 _+ E& D5 c - *' U" N4 u, t% m. @5 F0 A H
- * This program is free software; you can redistribute it and/or# t2 u7 u# d `
- * modify it under the terms of the GNU General Public License as# d" P! r* F7 F- L5 \7 q* Y) _
- * published by the Free Software Foundation version 2.7 M) \/ Z: _/ R2 P8 [& B) c
- *% `9 o R2 p' l9 z- s: `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; h) Z' e N8 \5 S& R1 M/ P$ n6 y
- * kind, whether express or implied; without even the implied warranty( M, o( U6 g/ U# z7 w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# r8 }& |! T! x# o
- * GNU General Public License for more details.5 ~2 f5 h& [4 p. \4 X/ S/ ]9 K+ @
- */6 C1 N- i! w" [: W. W0 T* o- }
- 5 V# F1 W8 m/ P& q; g G$ ]
- #include <linux/module.h>3 M9 V. c; X+ e" G# q) y+ o0 W
- #include <linux/init.h>" \* e b5 M T \; e4 o
- #include <linux/errno.h>4 b, k4 t7 L" m' K. `
- #include <linux/types.h>/ T5 Q7 \# c- m, p
- #include <linux/interrupt.h>
$ n2 I# l) a( m9 P) S - #include <asm/io.h>
j/ i# B- _7 t+ w' y - #include <linux/moduleparam.h>% R* e& Y: S9 u! V+ ?2 C- v
- #include <linux/sysctl.h>2 ~3 ~* I; ]1 O( F
- #include <linux/mm.h>
: c# u4 X3 N8 M- h' @1 j: U% i - #include <linux/dma-mapping.h>4 H; s" Y3 U/ G% |- D, l& m: n: ]9 ]
2 J+ ?! u( D+ d- #include <mach/memory.h>( z r* K, W/ y/ c% l
- #include <mach/hardware.h># m& T! n8 u: W# [6 u
- #include <mach/irqs.h>! ]: ^# ] C" x9 h$ ^* ]6 ?
- #include <asm/hardware/edma.h>! s( x q" q& c4 L& u6 }' b
- % I# Z& r" h4 h% r# ^1 ?
- #undef EDMA3_DEBUG
! j; e2 d3 G8 k" g) h0 ?! |) N - /*#define EDMA3_DEBUG*/) u! C, A! o& h: \
! B, a/ x9 h5 D" \- #ifdef EDMA3_DEBUG
5 D/ M$ M2 E2 ^8 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 A% k$ W1 c( [) W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 Q) T2 c% J" p: B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 ]' U* B3 i7 e- ~6 R
- #else
3 t9 u: U& \4 A- Z( K4 N' Y - #define DMA_PRINTK( x... )' ^) F; N6 n% G' B+ O: C9 ^0 x
- #define DMA_FN_IN
1 E) t( r) C# P4 S& T - #define DMA_FN_OUT- ~# c' I4 v8 ^; @5 y- ?
- #endif
: U5 E7 v ]. _+ t
, Z8 \. z5 o+ ?" j7 ~$ h$ v2 ]/ v+ }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" l% I) Y% k* N! [
- #define STATIC_SHIFT 3+ }, {4 u5 m9 w. J* _) [
- #define TCINTEN_SHIFT 202 g' h/ R/ D/ y% b# b" f! o) u
- #define ITCINTEN_SHIFT 21
4 W! F0 ]7 Y0 A5 k - #define TCCHEN_SHIFT 22+ ~) [: [1 C* U8 S8 y
- #define ITCCHEN_SHIFT 23, d4 y( o Y( ?) Z$ w3 C- @
! q+ h8 n6 h+ f$ k" G6 o1 x# b; b- static volatile int irqraised1 = 0;
3 N$ R# U. T. @1 y3 O - static volatile int irqraised2 = 0;2 L5 l/ i) N; ]% t# \' x+ L: k6 p
3 H8 j7 n3 }8 N- B0 B7 a6 a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) z, ^: a: N/ C/ k, R1 ~ s! n% @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# k( b$ Q+ R* m5 z9 R1 ^9 Z- ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' s3 H- u0 f) q) I - & W: Q6 D2 S: M8 }7 f
- dma_addr_t dmaphyssrc1 = 0;
1 {( ~1 Z* o7 h" s6 U) n - dma_addr_t dmaphyssrc2 = 0;9 s# z! i1 Z( C
- dma_addr_t dmaphysdest1 = 0;
/ D; A" A5 ?' G" Y- b$ j/ j - dma_addr_t dmaphysdest2 = 0;" E3 E- F1 |1 O5 N) V
- . J$ l$ i+ S9 W
- char *dmabufsrc1 = NULL;
% b) \% g- k. O - char *dmabufsrc2 = NULL;
; U5 y& h9 T) N! \ - char *dmabufdest1 = NULL;; ~( h& @( ?( N) @ M
- char *dmabufdest2 = NULL;+ |" u! `; K9 V' z' O
9 f$ b4 x9 r' q: l( t- static int acnt = 512;
, _; n( H* j# s' o/ D" i1 A9 w0 Y - static int bcnt = 8;- V/ V) v) Z6 o6 G9 q& a4 B; [
- static int ccnt = 8;& L; R9 c, s; Z
' k2 q$ f& D; R8 A$ y/ M d( z- module_param(acnt, int, S_IRUGO);3 {" F( ?1 K8 V5 m1 V, E. f+ x
- module_param(bcnt, int, S_IRUGO);
! P. m3 S* G) }& Z) U - module_param(ccnt, int, S_IRUGO);
复制代码 : T. D- V8 _& k( y
D+ D' C. i1 H7 p* m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ r2 F3 {6 K( o& H8 k* d' C! S' h5 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 ~& E8 z0 H& j( n5 y- ^, G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% H' k) T3 a5 B6 L3 |4 T
- h- p7 f1 F% Y3 S, Q6 v. ?4 Z0 ]: \9 |- R
|
|