|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' X$ N6 ~/ i# b, [
- [code]EDMA sample test application
% F/ I( N5 _9 B, e) [# h - /*
& J5 y0 }5 T' r* e& `# d8 l - * edma_test.c
0 g0 W$ @% h9 J - *
5 H) P, W9 b- a6 l# O$ K5 R - * brief EDMA3 Test Application9 }- H! m8 p: T, W1 ]- z
- ** C0 y4 Z+ F4 v) N+ r1 Z3 a" L& ?
- * This file contains EDMA3 Test code.% x3 T# u) S Y% C' m
- ** R* X0 h+ r w' Y! s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE X" Y$ D( _- x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 y! X( k% T3 S9 ]5 [/ N# l
- * TO CHANGE.
, Z' K) j! z1 j - *
; U/ h! M P+ d3 i! R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 r1 b* Z9 v0 D+ G% j
- *
$ L' V& w" H0 I- g! @; D7 l& p' X - * This program is free software; you can redistribute it and/or
. l: [1 G1 @8 Q. o y - * modify it under the terms of the GNU General Public License as
5 I* F; ~$ a7 B0 d% W% z( Y* p9 K; N - * published by the Free Software Foundation version 2.
" y3 @ _# W) V - *
_$ ~1 N I6 r* f! X: o: Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ R& z- b5 E% u9 |. l% O - * kind, whether express or implied; without even the implied warranty+ s# H" T6 B. P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: {/ x# @! T! R) @
- * GNU General Public License for more details.- n5 G; Y/ g: m8 d: M
- */
7 d& b4 _& F3 S7 i
& m% O' @2 _9 J; R- #include <linux/module.h>
7 X* y6 {* D. f. w, C0 R - #include <linux/init.h> W! W3 T3 ^- v6 R- K
- #include <linux/errno.h>
0 P9 A; k8 Q7 Z8 R/ f' T - #include <linux/types.h>
( |6 D E" z& F& H. w - #include <linux/interrupt.h>
+ E8 }5 z6 }, B& w- f8 q6 t! c - #include <asm/io.h>* w! o( _$ r% z& x
- #include <linux/moduleparam.h>- g4 g9 w$ p% @ H' z8 F- }. e
- #include <linux/sysctl.h>
+ ~+ ^" {1 q* q. J: ^ - #include <linux/mm.h>
8 T( w) f/ c, i! R& V% V6 T - #include <linux/dma-mapping.h>
6 t+ I' }( X3 O) \. I' E6 S - 8 W0 y8 V) u7 K) K! `( b2 H
- #include <mach/memory.h>
, g* d }3 K) m, f8 j* A4 M7 d - #include <mach/hardware.h>
/ L3 L9 W" _, m; a% x - #include <mach/irqs.h>* t: F6 \6 a) X. s8 [
- #include <asm/hardware/edma.h>
% L, X0 X2 u( ?+ Y% y - " j# K% I8 W5 r6 j
- #undef EDMA3_DEBUG1 u4 x- b$ x" p. P
- /*#define EDMA3_DEBUG*/
7 Z V& q! F. e) \4 r b' n - 6 w/ D7 f% C; @4 R1 x
- #ifdef EDMA3_DEBUG
3 t; t8 s4 L$ C; E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). l) z3 x, j) ~/ G+ a+ @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 W" Z3 X6 L4 Q* }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ i0 u' A* z7 _6 z - #else* ~" A3 e; F7 R' K" H
- #define DMA_PRINTK( x... )+ i! a5 D( Q( Y
- #define DMA_FN_IN! @, |- h$ \7 I7 o
- #define DMA_FN_OUT
( S2 j5 d; d+ ~! ]9 ^% E8 Q& O' r - #endif ^8 | e$ L3 g$ T
% u* c9 T: A$ T9 f; l; L, K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 a; R3 q0 m: B K+ f - #define STATIC_SHIFT 3+ U1 I: a/ M' `! q2 W2 Y& e8 \
- #define TCINTEN_SHIFT 20
2 i9 k3 u9 J) k9 [ - #define ITCINTEN_SHIFT 218 s6 S# H1 y9 K8 P& O
- #define TCCHEN_SHIFT 22( c2 E- i" d7 q+ u
- #define ITCCHEN_SHIFT 23
0 l1 w, H0 |! k; x
; z( G1 N6 A2 f4 _- static volatile int irqraised1 = 0;
( x; h0 e: L3 e9 b4 ^( \ - static volatile int irqraised2 = 0;1 j. n% m4 F% d) Y7 s- A
0 c5 |4 t l0 O: m$ q3 y% n' G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 C- S: G' Q. c- |4 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! b) _4 h7 f$ C. z. _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ^* e$ ~3 G$ [ - $ t& t o% L: L1 J; Z7 H( w' \! ^
- dma_addr_t dmaphyssrc1 = 0;
& D8 T: [1 ^, Z - dma_addr_t dmaphyssrc2 = 0;
2 t' a" }" D# O( K N - dma_addr_t dmaphysdest1 = 0;
6 P. [$ H) d9 V& n/ F0 e' A - dma_addr_t dmaphysdest2 = 0;
3 [5 X( S3 b/ ~- u7 t/ _
& @+ ~- ~* B& K0 Z6 ]- char *dmabufsrc1 = NULL;
8 O8 L" |+ l; c O - char *dmabufsrc2 = NULL;' \0 X! n/ g# e x& x
- char *dmabufdest1 = NULL;9 E/ S* G# l; F
- char *dmabufdest2 = NULL;
& J2 e: o$ P; k1 r - I H4 I# ~! f( N* k
- static int acnt = 512;
! z9 W& B8 W4 k2 G4 a- N5 Y - static int bcnt = 8;+ @6 y/ Q8 A4 ^! u2 b
- static int ccnt = 8;
! a4 q1 p% i3 H+ f$ [) }/ _6 I9 e
0 z' d& G0 B4 r+ V/ f& l- module_param(acnt, int, S_IRUGO);
6 [9 C3 w, G9 `) l( u' C) L - module_param(bcnt, int, S_IRUGO);8 l* j* c) H& p/ s) E
- module_param(ccnt, int, S_IRUGO);
复制代码 1 y- J: N4 q) d
9 }1 N+ n" Z: s, _1 Z( p$ I/ U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: [) v& x4 `% O6 k" P( sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 f5 E& ]' d: i8 x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ G6 L; ]0 }- C! n1 A
. m2 p I+ ^" Y3 m3 {/ ~
6 J4 I! G4 u, q1 k |
|