|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 O5 K1 H( N$ q! F# ^! E
- [code]EDMA sample test application
' c/ ]3 P t8 {/ C) l& G: Q - /*
) U' ~" V2 l, A) @2 M5 H - * edma_test.c# C1 f) G9 ?) F8 v( ~3 |
- *
, x# s: r0 V( r - * brief EDMA3 Test Application# p! j. ]! z' }9 T. p0 n5 r
- *) l3 [: j6 f* X0 R0 U% A; `
- * This file contains EDMA3 Test code., D$ C: i1 C- Z' l
- *
$ ^' B( L' v8 d7 |$ t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* h9 D& y3 E$ T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ f+ o" P6 N) o6 U2 _9 C - * TO CHANGE.6 ?4 c& l1 i+ T5 ` h' w
- *
" ?1 }* ^4 m* I |, g; y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 a: g7 l7 p5 \0 E/ \
- *2 }8 s7 R) A$ }5 t4 h8 t% X0 O7 ?
- * This program is free software; you can redistribute it and/or
; M$ K$ n7 Y+ A! O/ ]+ Q, ~6 L - * modify it under the terms of the GNU General Public License as; h' c/ {! c7 N
- * published by the Free Software Foundation version 2.) Q# k5 z+ o, ]3 a
- *
" _8 P% V4 T* |9 I% B; k- f9 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% N$ c; o) q6 y* |1 B - * kind, whether express or implied; without even the implied warranty
' }6 v c& {; P* u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- P% S7 \" u, ]( V! e" w9 A1 u
- * GNU General Public License for more details." {3 o/ s' O! _! s/ a& a' ]
- */ U) T, w1 m6 [% O6 @2 R8 G+ M
" a5 v, ~" z; N- #include <linux/module.h>
0 p E2 r( c4 s [# r% {$ v - #include <linux/init.h>
J( H( t3 ^+ y* n! H/ F2 T# a) v - #include <linux/errno.h>9 i2 ?% @* f3 Y& k, _% P! k s
- #include <linux/types.h>& C) n9 [7 q' C3 q$ B1 r
- #include <linux/interrupt.h>1 r. p! r' P) f/ m) R
- #include <asm/io.h>9 D, D$ {/ ?6 X/ w, V
- #include <linux/moduleparam.h>0 K9 g2 q; N, k7 ~, B* V7 l
- #include <linux/sysctl.h>" T) X7 U* T7 ?8 R
- #include <linux/mm.h># D1 L; G4 V4 C0 P: |* v
- #include <linux/dma-mapping.h>, |' @9 R& o/ @3 D2 V' c
- 5 e4 \& s: [+ A/ _. f
- #include <mach/memory.h>2 S, y: l/ P9 }9 I* N: h8 e8 q* y
- #include <mach/hardware.h>+ A. C/ i6 q( A8 r( _! s( O
- #include <mach/irqs.h>0 K2 c9 B+ U# L! b
- #include <asm/hardware/edma.h>
/ q3 I. `) q$ D ?9 D' X( F
( d3 y3 e* ^1 h7 _. I- #undef EDMA3_DEBUG7 W' c7 u0 I# J9 ^2 r: ^5 C# T3 l
- /*#define EDMA3_DEBUG*/
" Q" T( j$ r9 z" W1 S2 u! d
4 ^- ^! o" s$ U! m( ]- #ifdef EDMA3_DEBUG) E; ]8 O7 I& i* V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( j; c( C& k9 r7 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 k* E9 y( A2 y0 j) g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 M8 q6 u# f' [) X/ u) ` - #else
) i3 `- V5 m) q - #define DMA_PRINTK( x... )
4 P/ V4 \# j* s; U u - #define DMA_FN_IN7 f: S% M& ]: k+ E4 A
- #define DMA_FN_OUT# I9 _! [7 I* q3 P% H6 Z0 B
- #endif
4 Q9 @* \: t- Z& L. B - , c/ e: B" x( s* Q* g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& ?/ O; {/ G0 Q' j7 {
- #define STATIC_SHIFT 3
! I5 f& r. z6 S- v - #define TCINTEN_SHIFT 20
& K! ]$ X. b# ~& B @6 W - #define ITCINTEN_SHIFT 21
7 V8 x9 A/ J3 ~ - #define TCCHEN_SHIFT 22, d, s3 Z$ H. h) V
- #define ITCCHEN_SHIFT 23
/ a. h6 c5 d3 _4 {
/ X) ^* I \ I- n2 c; Z. h* s8 R4 f- static volatile int irqraised1 = 0;
1 I/ R, Z7 E- Z, T* G' T - static volatile int irqraised2 = 0;! d L" q0 ]% M9 U
- 4 z* }/ D: i& N3 d- W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' m' R0 @8 i$ q7 }) }0 f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 v9 Q2 B7 F9 @; q2 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Z# ~) o3 d( O, M2 ~" M, O" Q
3 p+ ]( @ h/ E- dma_addr_t dmaphyssrc1 = 0;
1 ^8 D3 ?" G3 b0 _# I( y8 S - dma_addr_t dmaphyssrc2 = 0;# X4 |* t1 J7 K; i# B: I
- dma_addr_t dmaphysdest1 = 0;
# |% b. H7 |2 T' @ - dma_addr_t dmaphysdest2 = 0;+ w/ O8 j" ?& _ H2 F4 w I/ {
1 O) }2 G+ ^5 i. _1 r- char *dmabufsrc1 = NULL;
# r. v* G7 D; h. T2 @7 _ - char *dmabufsrc2 = NULL;
: V; J% g; ~ f5 r) _% d+ h - char *dmabufdest1 = NULL;, q: g( z& x* U3 Z
- char *dmabufdest2 = NULL;
1 L4 K3 @8 y0 u: B4 N! P B. b& ^
+ r( |6 ~6 i$ P# d! o- static int acnt = 512;* x C {8 y) @6 w. t9 v
- static int bcnt = 8;# ^# I4 }" n' ~& t
- static int ccnt = 8;
9 n$ i- K8 _, b, N H" h
. y, T# h6 x% O0 V+ S- module_param(acnt, int, S_IRUGO);7 N& u5 b& o: m2 d i7 u9 ~
- module_param(bcnt, int, S_IRUGO);
! r1 {9 D7 H! G: [# ?: A1 o - module_param(ccnt, int, S_IRUGO);
复制代码 7 G3 b! u$ S+ Z. b9 _3 o, ?
) Q# z$ I% F8 b& ?9 l; A- H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ^+ E% U& b* G( R4 \( `9 @: v* X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 x4 f# N2 Y/ E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! H9 j" Z9 m3 P. T2 u/ [
4 L; D7 n+ a9 u1 }7 b4 E
$ J2 \1 Z( `2 _5 x/ L* U" O2 Y6 t |
|