|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ C7 {0 |1 x9 ]3 U$ A7 O4 d3 n4 I- [code]EDMA sample test application
' c4 e( ?1 x2 L. `3 i6 f& O. W- B - /*
+ n6 |5 V: w4 i1 S$ I! y( p - * edma_test.c
& A8 e- O5 I! b9 ? - *& N' Y1 G4 f0 H) _
- * brief EDMA3 Test Application* F* ^0 g0 U/ f5 S
- *" z2 Z! t9 s3 l. F! I
- * This file contains EDMA3 Test code.* J9 z3 N0 A4 w! ~# `1 ~; V7 o$ ?
- *
5 ^% y" Q4 U4 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ T) ~, ^+ ~6 q# `. \' Z# D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) _. |' ]: I+ U - * TO CHANGE.# Y& v" ?/ i; A2 W; Q) v; n
- *$ C& I+ C; N- s: g) a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 E( D. e3 C+ r# G2 C6 v8 l* D8 E6 X( s - *6 A# T i# ~7 e+ L* l% E7 A
- * This program is free software; you can redistribute it and/or
2 E5 N# s- f6 `8 O+ ]$ } - * modify it under the terms of the GNU General Public License as
% j( b U* t4 j9 ] - * published by the Free Software Foundation version 2.
' k$ q1 y c6 M+ X( K0 x, X0 I/ R - *' D1 y) v9 v+ s- P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 g2 j6 c2 R! n: G0 L5 A - * kind, whether express or implied; without even the implied warranty
# a1 Y/ _( [ E0 A e* U& h. M0 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& M' B1 x( }" s, l - * GNU General Public License for more details.+ R: W, C; s; F# S- }7 o
- */- O% \! Z+ K% t! B9 j
- 3 ~$ p" j; U5 `4 T
- #include <linux/module.h>' ~; K3 r; t( Z
- #include <linux/init.h>* ?9 c+ n2 ~& d" s5 R" H1 N! P
- #include <linux/errno.h>
1 [. w: ?! c- P+ w - #include <linux/types.h>8 W; e) z! Z8 j; i, c: w
- #include <linux/interrupt.h>7 l6 Z, x+ c4 {" a
- #include <asm/io.h>8 p' C( F! ]# ^( X0 Z
- #include <linux/moduleparam.h>
5 G" g" I/ _* R/ }" g+ D6 K - #include <linux/sysctl.h>
* O; i4 R+ T( D$ `+ y - #include <linux/mm.h>
+ w: q8 F; D2 g: a0 D - #include <linux/dma-mapping.h>
) g, M& x/ g8 d; ^! I( W - + @" j9 i. \, k' w
- #include <mach/memory.h>
h, B2 b j0 W, g" K; ? - #include <mach/hardware.h>
7 {/ q4 w' b' V: Z/ M2 a - #include <mach/irqs.h>3 X" P; R1 O+ R4 Z
- #include <asm/hardware/edma.h>5 F8 G; ]( X0 K9 y8 O8 r
~; \6 H$ D% u! Y- #undef EDMA3_DEBUG
; i Z8 ]: k/ n8 u - /*#define EDMA3_DEBUG*/- W1 O o6 x9 K
- . p: `- V9 p$ r6 C3 e$ L
- #ifdef EDMA3_DEBUG+ d% n# x( d) c. U6 R. v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 D e* \% g3 Z0 Z6 {( ~* K% j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ E. ]( D, C& p$ R( \, f$ p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) h, o/ ?' [7 r% m- R( \9 h! P
- #else
3 r4 T7 V4 I+ [' a. U; ? s - #define DMA_PRINTK( x... )" e0 Z8 E, r- f, S, L a& c
- #define DMA_FN_IN
2 o& M) `5 J" o0 [ - #define DMA_FN_OUT9 s A. D5 V; _% Y8 A
- #endif8 b3 \: L0 i* H* y& z
- @! L, R" g: C7 L t: _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 `* d) E3 C& F; {( _9 s - #define STATIC_SHIFT 31 S- M6 E; _' |6 V3 ~* R# ?
- #define TCINTEN_SHIFT 20
+ w- E. Y% p# M4 L+ ? - #define ITCINTEN_SHIFT 21/ j9 k1 b5 N4 U- i# W
- #define TCCHEN_SHIFT 22
5 d9 x( `# m9 ~5 m- N2 f0 [ - #define ITCCHEN_SHIFT 23
( N( a& g3 u0 s: w& q4 P0 Q3 g' H - 5 t# ?- d. a9 q: s. x/ ^
- static volatile int irqraised1 = 0;+ N# K. {2 B! p" y& B
- static volatile int irqraised2 = 0;/ Y" t" |% p f( m6 g. E
$ P! a0 ^3 c5 T' L" v' g, G* s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ V0 @$ v T, t5 f7 I0 Z$ e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) a7 F4 Z8 D( r- u) |. }6 |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' q4 d' k$ `/ O3 z1 Q" I
/ V. ]% p% s" c+ t6 M- dma_addr_t dmaphyssrc1 = 0;0 ?/ U1 D5 @( R$ J* a& R) R2 {6 M7 h
- dma_addr_t dmaphyssrc2 = 0;+ ?8 I: {. {0 R/ x/ m3 h& K5 g
- dma_addr_t dmaphysdest1 = 0;, v) F7 b/ ]1 D6 f# U, R1 B
- dma_addr_t dmaphysdest2 = 0;
. ^" Q. \& S* m& \ h
1 R/ e. E0 n: I& k: R- char *dmabufsrc1 = NULL;2 b1 L4 ^3 Z' F- R3 j0 d
- char *dmabufsrc2 = NULL;
! E @4 M; U: A d* U; G - char *dmabufdest1 = NULL;' y9 K1 K7 e- N0 g4 }1 H# t/ U
- char *dmabufdest2 = NULL;
' g) k$ \4 E! G1 L Z2 p
" C" o0 {6 N4 y( h8 a& P- static int acnt = 512;
* ?$ L! ]' T( E" p - static int bcnt = 8;
/ x# \6 L0 \2 V3 y$ t1 R - static int ccnt = 8;8 n7 T: d7 G4 q5 {
9 z0 N- {# C' p% `( M/ f7 y- module_param(acnt, int, S_IRUGO);
, o# R# a2 H6 r' }0 T% L; f$ k" x - module_param(bcnt, int, S_IRUGO);
4 g; w6 }2 h0 @+ H% H# \; q - module_param(ccnt, int, S_IRUGO);
复制代码
t t. _ i& c3 D8 R% i, U1 {
2 J- F- K# A6 I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 L& {! Z- P& E: U6 n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( B1 t3 X1 F: i# L6 G' B! S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 v4 ]* u+ U0 O+ t' O- D
2 |3 a+ o2 [7 @2 g: {. Q, j0 F4 U1 O% P
|
|