|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & f# j) p' Z) G' u6 U. ?
- [code]EDMA sample test application& m0 O! u/ E5 H! N6 h5 v
- /*
0 B. E) L5 S. p - * edma_test.c8 L7 d; H3 _* {+ C( D/ a, {
- *+ E" M' T4 N- j
- * brief EDMA3 Test Application1 @1 d7 k7 {8 F& w
- *5 i1 A/ _; r& z. v" K0 m- S
- * This file contains EDMA3 Test code.
: w! Q1 @+ l6 x4 a$ v - *
/ h9 Z$ S! t% C7 O$ a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
O; r' K5 b, K) [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. S+ X% e. \0 P* Z% }' z
- * TO CHANGE.
) `% T8 Q/ T- S4 ~0 l( R - *
) K4 A- l0 t( J$ a* ?; F3 v$ n$ P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: l5 }: o$ L) h' w; k8 O
- *: V& _/ m7 g; Y: J* U
- * This program is free software; you can redistribute it and/or: M7 @! Q1 O& d% W" {! z. [
- * modify it under the terms of the GNU General Public License as
0 w \: R6 v F, ?3 z; K# ^0 ] - * published by the Free Software Foundation version 2.
1 w- x1 _( a0 L- j! D" x - *
5 d" d3 F* K4 J2 _' x; q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ `; f' R% _! V+ z
- * kind, whether express or implied; without even the implied warranty
* k) a& {' q+ Q/ o& h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 k4 `% y5 }) z! \
- * GNU General Public License for more details.2 t$ p0 l& ]6 L: w/ A
- */3 _& \ _# B% h1 ?2 |0 C% @
- . o Q! i) r: O5 m9 M9 Q& f; S
- #include <linux/module.h>- ^/ ~/ q5 @9 ?! o/ A3 I
- #include <linux/init.h>
8 X% ?" U/ v! G2 n$ P6 J U - #include <linux/errno.h>3 c- B* [' t" s0 O; o, z
- #include <linux/types.h>0 _* s, P7 N, |8 d/ u
- #include <linux/interrupt.h>
+ L8 B0 U& h7 d# t% K, c - #include <asm/io.h>( n$ ]2 u0 p$ o+ |* o: m% L
- #include <linux/moduleparam.h>4 }3 l2 T. B v! I. s' Z0 X
- #include <linux/sysctl.h>( U) h) U! y+ w: ~
- #include <linux/mm.h>! q( L; E$ h- w& ?( i A, T ^% _
- #include <linux/dma-mapping.h>" D% l0 Q4 v; w1 a u( H
) B8 n0 _$ K' f: u7 J+ t- #include <mach/memory.h>9 ]1 i7 ~& G k4 u
- #include <mach/hardware.h>' A5 v$ X+ i6 Z6 n- @8 h7 `+ K
- #include <mach/irqs.h>0 t( Z( n2 D% M. x9 P: |
- #include <asm/hardware/edma.h>2 `8 p& j% F& p4 a: a0 z
5 a2 k+ d& a$ U, G- #undef EDMA3_DEBUG! _" C5 C, Y) M" ~* L2 C3 X
- /*#define EDMA3_DEBUG*/
0 I5 m" s' |7 m F J
+ g' Z: j' R+ ^- #ifdef EDMA3_DEBUG) S# ?; G) L! i+ i/ g4 b8 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 R- G; N. {4 P9 \% q* n3 ~. O5 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 A" j/ w9 [# z" h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' @- @# H8 o) G" D/ s- ~ - #else& A( J9 K8 q8 S3 U' u3 U
- #define DMA_PRINTK( x... )7 }; E" I3 y! D' k# H- y) p
- #define DMA_FN_IN& J3 w, O) y. _& ?6 ?
- #define DMA_FN_OUT' ~! g0 D5 V7 l: ?# |. y7 Z2 s
- #endif3 u! h; l E5 @- Z* T- R
' }& F5 |& K. ]- t2 [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) T8 s' h& \( u2 F
- #define STATIC_SHIFT 32 b2 D( G4 `6 e7 `! ~8 m
- #define TCINTEN_SHIFT 200 Q* l( ~( y! r. U6 |
- #define ITCINTEN_SHIFT 21
7 I' q/ u r' ]4 Y+ _0 N$ H' x9 N - #define TCCHEN_SHIFT 22
/ ^" R- B2 m) [" B( U! U! I - #define ITCCHEN_SHIFT 234 _5 R1 Z- E& Z( i
- \; }3 a5 o* J3 y. o, Z0 ^/ P
- static volatile int irqraised1 = 0;5 e( Q8 E, Q/ P
- static volatile int irqraised2 = 0;- ]7 x. |+ N B# y6 {
7 P7 [6 u5 T2 ?* D' f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! V( ~$ q) X+ u* A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* g1 i. r; N+ p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! T, J: X3 R- D7 ]$ k# M - / y5 b/ q- F: e) Y2 q
- dma_addr_t dmaphyssrc1 = 0;) e9 Q) }" [( K
- dma_addr_t dmaphyssrc2 = 0;
" v2 H4 a- I2 w2 p8 Z - dma_addr_t dmaphysdest1 = 0;
( q1 H1 x4 h2 c! ?! N0 M - dma_addr_t dmaphysdest2 = 0;5 q# ?9 U0 L0 M2 h0 Q% e
- ' y5 M# H3 t: I0 i1 X+ G( E0 B) P( y' Q
- char *dmabufsrc1 = NULL;
& N1 g! _: h+ b, b' p8 m3 S - char *dmabufsrc2 = NULL;* w. f: ~& R5 l2 ^7 B# v
- char *dmabufdest1 = NULL;; s+ q; O/ b0 R W8 f
- char *dmabufdest2 = NULL;4 l" J8 U" P" b2 X
- / T2 C/ h3 L5 L+ C( K o
- static int acnt = 512;& r" q# }* R( O' w
- static int bcnt = 8;. h u" y( r$ a; W _9 h" h1 M0 @* ^
- static int ccnt = 8;+ h, [$ Q8 {$ x$ P" b+ K( a8 a
- A# s% ^1 m% m2 k% o. h. M- O1 t
- module_param(acnt, int, S_IRUGO);
% A$ f6 u9 e% Q: g1 f' i9 q - module_param(bcnt, int, S_IRUGO); Q3 l) G+ t" g8 N2 N
- module_param(ccnt, int, S_IRUGO);
复制代码
9 e# G# B7 F# q) M! b5 ^& A, L1 X& x( |. O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 y% d2 c0 ^: l3 s$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 s) z; T- O9 p4 M+ ?5 N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 l" E( E9 P6 \5 L" g
) d) m) p" \" D
& E- S2 i V! q
|
|