|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. e# K N- y$ q- r- [code]EDMA sample test application7 W; o6 l5 j U& `) J$ e7 n# l
- /*
: @+ o f5 c1 s4 o0 {2 ^ - * edma_test.c
$ V. r# v0 F* ^, Y: N4 o4 O/ A - *
9 M p6 C1 Z' j* N8 g! I - * brief EDMA3 Test Application4 X. W( o U% m" K" R7 x
- *
5 s6 L& m( A& U - * This file contains EDMA3 Test code.
3 `, i! A( x+ C - *) ?. ^: ]; T0 l' Z9 B6 V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' M5 C6 g2 t3 Q: \- B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ Q. U# K d" I5 ]+ x - * TO CHANGE.4 y* Q/ M& o: O# I3 e3 |" u8 n5 x B
- *
7 _) D% F& {0 F4 D1 t% J# K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 N* J+ W# Q3 |- e+ m - *+ D* r D3 U1 h
- * This program is free software; you can redistribute it and/or
. h! i }5 k8 z% R - * modify it under the terms of the GNU General Public License as
! ~2 l3 Z! r8 D: \9 ] - * published by the Free Software Foundation version 2./ R, j2 x( z7 \+ ^8 z8 f
- *0 _3 r) i) \: n5 z& ?8 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# V' t: e: ^, y' b0 m - * kind, whether express or implied; without even the implied warranty
0 \: X2 I7 Y1 R% r8 V3 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* t l* o( `6 |7 S
- * GNU General Public License for more details.0 q6 o! `8 X' q2 {2 V
- */$ \3 v4 |9 O7 _6 n( g- R
3 p; z! P, E, c8 _% O- #include <linux/module.h>* O# X: W& J) D S4 a! u) X
- #include <linux/init.h>
: H. g; V$ V% h - #include <linux/errno.h>$ e9 c" R$ ]5 i D5 U
- #include <linux/types.h>0 ], V5 t( x* G: B
- #include <linux/interrupt.h>
6 e( B" M8 P! \1 M0 y2 ^1 N3 s - #include <asm/io.h>& N9 C* v! j' P, R, U" b
- #include <linux/moduleparam.h>
' ^( W3 g r4 Z* B" q! E0 L - #include <linux/sysctl.h>
8 \1 M4 P! q2 V8 X; E! g - #include <linux/mm.h>1 F u! O/ A* s2 D' Y. G( @* P
- #include <linux/dma-mapping.h>
- u0 N8 O3 {( m6 E* @5 U! p% E
& d. T, @- v* a8 o1 w6 h# V9 P9 v- #include <mach/memory.h>, m. A2 w- z% ^3 X
- #include <mach/hardware.h>* K3 ?/ j* Y, E, ]! j( E
- #include <mach/irqs.h>8 L) t g9 \, X* o0 x
- #include <asm/hardware/edma.h>
# m! ^) Z* M# h$ d' R4 E - ' a1 W i+ {- f/ o- A1 x" m( E
- #undef EDMA3_DEBUG0 D5 a# I* F7 @ ]! H! Z
- /*#define EDMA3_DEBUG*/. y! _5 x" W/ q' P) g n* i. V
- Z7 o" q! Z' J0 i; [- #ifdef EDMA3_DEBUG0 {$ P* k7 O) E/ G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- w+ e! Q/ L) @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 A3 _/ R/ }7 J2 r3 `$ b5 ^' H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" B. O% u9 N5 x: H* T
- #else2 y* J8 e; F `! P ]; b' D& x; R
- #define DMA_PRINTK( x... )
+ i9 x' d: ?( I( S! G* `/ K - #define DMA_FN_IN
}" q) ^* T. d% G$ v - #define DMA_FN_OUT1 z9 P% f5 ~4 P
- #endif
/ F- n% P4 V$ z; d1 ]
6 @) w2 a: m% R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 D: k! F/ i) t- r& s - #define STATIC_SHIFT 3
& f* I$ y) o* n& ~ - #define TCINTEN_SHIFT 20
# E' W% F3 `. l- J - #define ITCINTEN_SHIFT 21
3 ^3 {7 t/ ]; Y4 t3 o- o( n - #define TCCHEN_SHIFT 228 l# {# w& `1 |* s, B7 ]2 b
- #define ITCCHEN_SHIFT 234 n" w1 z/ e% C
' O% v* L- k0 b5 {. _: t7 G. O- static volatile int irqraised1 = 0;
. W# M6 I6 S8 m/ ~ - static volatile int irqraised2 = 0;- Q V. P) B, |
- # g- l8 F/ S6 _/ O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 B- q. |2 q( R0 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! j" q) C0 ~/ q- v7 h* c9 g2 Q% V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% w: G% [+ b* h! ^/ z
- w: j7 E6 q# o; z5 A( ~6 [- dma_addr_t dmaphyssrc1 = 0;* k% j, f& h! n8 a
- dma_addr_t dmaphyssrc2 = 0;9 F `2 m( L- g7 ~! M, C& _7 B
- dma_addr_t dmaphysdest1 = 0;& b" V1 X$ f! v2 D# V$ V
- dma_addr_t dmaphysdest2 = 0;! o" e+ }0 w4 g
; e3 W5 ?, p, @1 U' X- char *dmabufsrc1 = NULL;/ J) ~5 U5 E( } G
- char *dmabufsrc2 = NULL;. w6 M8 J+ x. s. j8 i: f7 [
- char *dmabufdest1 = NULL;
$ z- X% T7 _/ ?0 N' e. d+ j' f; E - char *dmabufdest2 = NULL;. ~+ Q) J3 _: D: N5 a( }6 D4 N
, O" y9 ~" R8 z% e$ ]+ L. a- static int acnt = 512;
7 m8 A% Y6 p7 k - static int bcnt = 8;8 [8 H6 V* {$ q( a5 E
- static int ccnt = 8;( [4 v0 |/ }; {1 s
1 x. {1 B* O( {+ W, \! ~- module_param(acnt, int, S_IRUGO);
6 B( |; i' ]( D/ d - module_param(bcnt, int, S_IRUGO);5 N. [1 U# ~) x3 Y
- module_param(ccnt, int, S_IRUGO);
复制代码 , n5 z/ W9 C8 }5 S
+ y, P% ~$ p c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 O4 |: J+ ~: S5 a! O4 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
l J, A! d" c6 Y: A/ A! ~# H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 d1 N- U5 {' }1 b9 {' @
4 h5 }. |; A3 n3 _# A
" L" h( C4 c3 c% o' A
|
|