|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 F6 f- w: u* A- [code]EDMA sample test application8 n6 `: Y4 C( a! P% X1 U8 o
- /*: F& Z$ ~4 ~1 @" Q
- * edma_test.c3 d* j {, d3 ~' A- X8 L
- *
& [( V0 A; O" Y3 @5 O' k% j - * brief EDMA3 Test Application
_% t4 f& ]+ f) @/ |# w, R - *- g9 [! k" l5 P: L |
- * This file contains EDMA3 Test code.& Q* y7 |8 X& R6 A3 R# {
- *0 _7 N T6 ?( E) w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ q8 R% h7 {& Q5 j7 }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' Z! y6 d5 |8 A& v( w - * TO CHANGE." P1 L0 Q) Z* q3 Q; a4 U
- *$ n) u" |9 l3 C" a( r0 Z" r3 M/ v6 H) _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& @, l8 y4 |2 k) H& A- v - * h" r( |: r7 L) ~
- * This program is free software; you can redistribute it and/or
6 T% E) O5 I& \& S - * modify it under the terms of the GNU General Public License as( }! q+ | ?! X& e$ Z6 Z$ S
- * published by the Free Software Foundation version 2.0 |+ V8 |. V5 Y: h/ y# l8 n5 O
- *% D N6 I0 Y& {1 y1 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, X* k$ F- W7 X$ L: n. Y - * kind, whether express or implied; without even the implied warranty$ ?+ ?# T! V% Z) g( `+ U- c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- Y6 Z6 j8 Y5 o$ @! @+ @3 [8 c
- * GNU General Public License for more details.- p1 ^, [/ }+ |" u
- */
3 N" Q8 b8 J# N9 d/ Z$ ~ - . H6 k9 b/ w% X2 ?# o3 S, x
- #include <linux/module.h>1 o4 A. P* {: T' v
- #include <linux/init.h>8 V. |, a5 l1 Z& f) B: p
- #include <linux/errno.h>
: j" @- O8 K5 J1 t: Q: {' E - #include <linux/types.h>
) U8 z5 F( [, n- Q. A2 n' L - #include <linux/interrupt.h>1 f5 c1 x; Y( s `
- #include <asm/io.h>4 T. }+ n! L% f1 p/ H
- #include <linux/moduleparam.h># K* u. B% O* V" H' p( i6 b/ U6 q
- #include <linux/sysctl.h>$ q" S8 O4 @- K( s5 M" K
- #include <linux/mm.h>' D) G5 R" X0 T1 F5 r
- #include <linux/dma-mapping.h>
3 W+ H+ X0 B. T) {6 y0 S& z
8 R' T& S4 x" g& T9 z/ w1 j8 l+ D- #include <mach/memory.h>
5 l9 v9 O0 x$ O% M$ p* r - #include <mach/hardware.h>5 {, Y+ {9 L* m2 v
- #include <mach/irqs.h>
( H0 b& T" n- t1 i' d8 [! E - #include <asm/hardware/edma.h>5 b* o; d1 W9 \' V
@/ c: M2 \) i- #undef EDMA3_DEBUG
: h: U/ |/ ^7 O8 O - /*#define EDMA3_DEBUG*/
, M' B5 q5 i2 A: K) J. y& [( n - * o& ]" m" U6 y: ]% J6 {- R5 o
- #ifdef EDMA3_DEBUG; E( Y' K. `- e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 V3 H0 [# p$ e" ^2 N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. ]8 c( r/ f$ w$ f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 W5 C) j6 n/ ^$ v2 f
- #else, c, T4 u) W3 f# W& s7 d4 d. F# k
- #define DMA_PRINTK( x... )
2 s7 @0 l8 I ?4 h - #define DMA_FN_IN# `% T" ]: h6 O% a5 l
- #define DMA_FN_OUT' V3 m! g, c* @
- #endif# ?: `8 s8 D8 j
- 4 W0 ] p/ g: N6 f' D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( ]4 ]& s, d" R! v+ `$ b- _2 @4 X9 |. D
- #define STATIC_SHIFT 3' n- Q# @1 \9 T1 e6 k; v
- #define TCINTEN_SHIFT 20/ {& E# ^- ~/ z8 I0 \! L4 Y
- #define ITCINTEN_SHIFT 217 | H, c+ Z0 k8 ~$ l: q
- #define TCCHEN_SHIFT 22
# `$ [/ C7 m8 A - #define ITCCHEN_SHIFT 23
9 s) J$ z/ z$ s5 y - 8 q* y. j' f3 d; ~8 u# }
- static volatile int irqraised1 = 0;- a* a: \* o1 Q6 i" {
- static volatile int irqraised2 = 0;
) E7 ^( M% ]3 o. K S" t& Q
|0 Q( R& ^/ ?0 d" b+ J' B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ }# n% k$ w0 C' @/ G$ b& J6 g5 a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* ^3 @# B: l1 C$ t2 F2 N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. v) w9 `1 O$ y7 I
' J4 |0 V0 B- j5 f9 ~, e5 G- dma_addr_t dmaphyssrc1 = 0;$ O/ S# {) o7 f+ k7 ^8 q E$ v
- dma_addr_t dmaphyssrc2 = 0;# n' V2 l8 O6 Z
- dma_addr_t dmaphysdest1 = 0;
: \, T1 d! A5 O. Y# u) F6 }* S - dma_addr_t dmaphysdest2 = 0;3 Y B& J! m+ k, n; c
2 G: B: Y: Q* |' |3 r4 I5 I- char *dmabufsrc1 = NULL;% u: D, E% R* W" z+ r! A( d' q
- char *dmabufsrc2 = NULL;
+ i% ^: n! F3 _' E1 Y* ^1 n# Z# V+ S - char *dmabufdest1 = NULL;( T0 L4 Q" j( n
- char *dmabufdest2 = NULL;; D4 e" q* h! L% R' m+ |
, R5 p |8 W0 V0 l: |1 s- static int acnt = 512;7 u. y) M5 ~ N }/ H& U* g6 b- a
- static int bcnt = 8;
1 F5 r' n- q. |, ~9 l& F - static int ccnt = 8;5 F7 J/ R" V- r+ x
# o( p! C; C8 s d" o- module_param(acnt, int, S_IRUGO);
$ D2 A: R* ~% R - module_param(bcnt, int, S_IRUGO);
. N) p% I2 ] c9 l6 |0 B6 Y - module_param(ccnt, int, S_IRUGO);
复制代码 - r1 B* I) T7 t3 P) m: ^0 [5 ]
, R& Q6 P( T: |( ~0 B1 k( t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; y3 ~8 n$ y. V* E9 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( u/ d/ q8 @5 N2 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 H2 p! N' J* S/ A( j; K9 J
" F; F$ x. F8 X) N5 i1 w
6 y, U8 b: b8 |: N: H" O& P |
|