|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ Z E" b9 Y! e+ D! j- [code]EDMA sample test application
* B9 Z5 f4 _, D c) Z - /*
* B! A( J8 d) C6 W4 |3 y2 _ - * edma_test.c3 y1 L) P. ?5 B+ Z$ ~2 k/ X
- *9 h! |3 Z. e6 U3 O
- * brief EDMA3 Test Application7 I, T( l/ _5 q2 |
- *8 a6 ?2 V, |5 N4 R2 t; h. G r$ j
- * This file contains EDMA3 Test code.
; W' ? j& G3 U( h- ?& S - *
r! p# O& N2 c% {5 x" a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 `! i! `4 E) W" p: ~. _ P6 ~/ I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; Z P! K( y. @ B6 M/ n( F, w$ `
- * TO CHANGE.1 w7 H' I1 w& `2 q% |
- */ U! N8 g6 o1 X, p- n; ~+ l! ` F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 H/ E5 H( K( T- J+ L
- *
+ _* A- v: V, N, h* O H6 r - * This program is free software; you can redistribute it and/or
3 z9 ]+ c5 ]- u' a. D- M) P - * modify it under the terms of the GNU General Public License as8 U" p1 C* t7 ?! S
- * published by the Free Software Foundation version 2.
q+ t, ]& b# _1 X7 G9 |: m W: N* l - * d* V( b, i" x v; |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 e9 M! F( Y% E* V9 r& G9 \
- * kind, whether express or implied; without even the implied warranty
- H# `/ j5 N6 f9 R$ U1 a9 ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- N4 D7 h3 K6 J" D' S2 ?4 a
- * GNU General Public License for more details.# d0 K7 l* E/ T( T# M
- */6 ^' |+ L1 b" ]
- + E3 `1 a: b0 j# N) E
- #include <linux/module.h>
, A7 b# w2 t) u1 n! l8 T - #include <linux/init.h>
( P- F, Y# E2 a. C6 R3 F/ H - #include <linux/errno.h>3 u2 ^6 W( {/ L9 a$ Z1 l, R' o
- #include <linux/types.h>$ W' O$ }7 Y0 Z8 A- N6 ^
- #include <linux/interrupt.h>
+ x, t2 }" c. e, l" S8 ? - #include <asm/io.h>9 p( |% E2 B/ _0 |) ]
- #include <linux/moduleparam.h>; N& S* d! U/ C% {" @8 Y5 q
- #include <linux/sysctl.h>5 O! R( l7 p5 t. C5 X
- #include <linux/mm.h>8 [+ U3 M" p8 W2 v. v" {
- #include <linux/dma-mapping.h>9 l% `: Z: d/ L n
- ' U# F7 k/ Q; R) o& a2 c1 w
- #include <mach/memory.h>1 S; K o- o" i! F& _& V, V% q$ t
- #include <mach/hardware.h>
4 E: {. k m' P, b; r) j% X - #include <mach/irqs.h>' d1 Z* u0 e( t' s" Y8 l+ X+ E& Z
- #include <asm/hardware/edma.h>
* g& }& B8 R X$ y; { - 1 A# {; d9 l3 U6 n4 o; } g
- #undef EDMA3_DEBUG# `& d% `: e. Y9 R+ e) q
- /*#define EDMA3_DEBUG*/
' O3 A2 L/ n2 {; W* m. l& z+ b7 [1 q
1 N p/ R9 r/ j% [; l5 |- #ifdef EDMA3_DEBUG2 k' y. C; U7 U# j" z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* m& ]7 \6 Q) l% b& s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. H" \* u: C, R7 u# @, _# l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" @! v* c- \5 J! H- w: d3 A - #else
2 d3 E) f+ T* _3 K - #define DMA_PRINTK( x... ): y. |- \& J' c4 I
- #define DMA_FN_IN
: [2 s9 b& p5 r! u) Z; B6 b - #define DMA_FN_OUT3 A) N1 r0 X; S3 f1 b2 R+ Y
- #endif& B9 i# @2 q( b) s
* u8 O$ @" E+ X" [. _- ]% x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( n- R, U4 z% ^: [# D! v
- #define STATIC_SHIFT 3
! m" R6 A5 W1 p. Y - #define TCINTEN_SHIFT 209 y/ \ |6 A m, C5 `
- #define ITCINTEN_SHIFT 21. p: ~6 K" d6 A m
- #define TCCHEN_SHIFT 22! L* z3 W. R2 B* Q0 N! S
- #define ITCCHEN_SHIFT 234 u$ A0 v6 g j1 }4 T
; W$ |3 L" ~) n- static volatile int irqraised1 = 0;
9 C4 m' c/ }5 n - static volatile int irqraised2 = 0;
# m* b% X$ X% h: c4 W - 8 L% L b6 \3 `- b% k6 J% {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 o% `/ R8 I0 n1 h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 F5 L% w4 {" @5 k, X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. j. |+ t) d. Q2 F4 a: ]) h. M
, a9 u0 ^3 c7 x2 |- dma_addr_t dmaphyssrc1 = 0;0 k- K+ Z, l& f; y4 ?+ N$ T
- dma_addr_t dmaphyssrc2 = 0;
b" T9 m! M9 F9 I% M3 Y# v6 [ - dma_addr_t dmaphysdest1 = 0;
+ d. U, H( y* x0 s1 }, ~( V1 l8 a - dma_addr_t dmaphysdest2 = 0;7 h. E. s* @! r# e" _4 D: l! M
- V4 ]( e6 |+ z9 o& m
- char *dmabufsrc1 = NULL;
X1 M+ n# I1 Q, m9 W; ^/ F$ w - char *dmabufsrc2 = NULL;
! e! P- s2 |8 T% ^; n3 v+ u - char *dmabufdest1 = NULL;9 O) C5 C" V8 a( s1 D6 W
- char *dmabufdest2 = NULL;
! ?; n; [1 r) ?9 \ - 7 m$ ?5 \- D' Q8 M7 g2 I# r
- static int acnt = 512;+ Y* J t! p5 R+ {) p- m
- static int bcnt = 8;( h2 U# T, m" ?8 P" k
- static int ccnt = 8;3 Q; y# e, {5 Z5 I* Y' i
5 L/ R/ L; I% N# a9 Z( O- module_param(acnt, int, S_IRUGO); `( T1 Q# Q$ X M
- module_param(bcnt, int, S_IRUGO);
6 ?, M" f: C1 K( \8 h - module_param(ccnt, int, S_IRUGO);
复制代码
C% i4 m/ i |
7 V. y& [4 o: g% v* X: {2 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 [, g. L9 R3 ?0 x+ Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* D7 {4 k( i/ T4 d0 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; S) u, O! g* S3 V( v# _. G
- k4 ^# Z! u! p6 F3 v. v% k: O) F
. a+ S1 i1 ?* P1 v+ K7 D |
|