|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & |( @3 }, w A! z1 C
- [code]EDMA sample test application8 B' Z4 c+ }. ?5 E2 j
- /*) L; K. o, f- h/ ]: V3 q4 C
- * edma_test.c) P: M+ N: g: q
- *( l+ a( B& T& W4 F$ R
- * brief EDMA3 Test Application
/ S" H& }: P. U- n8 S$ R - *% k% q- R8 ]8 `5 U
- * This file contains EDMA3 Test code.
]! U9 {4 [+ f- n2 f - *
! A' o# W6 \4 i* Q" I, \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 ^' ?2 z Q' t+ E7 l- H% G7 ~4 e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ P Z/ b& x1 l7 F; \6 M
- * TO CHANGE.
. q& P0 X( ?* v - *
: E, {8 \/ A; f, H- p5 B. D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& f7 x4 U; b' O" c7 c5 s2 R
- *! s3 E* Q0 D# Z( d* n7 T
- * This program is free software; you can redistribute it and/or
( g# F6 D0 b/ F' _. }9 b5 c; M - * modify it under the terms of the GNU General Public License as
) k2 P, t7 _% t& D5 p4 J, O2 ^9 V, } - * published by the Free Software Foundation version 2.9 W3 z. ^8 ~* P: H. L3 v
- *
$ @. E4 Y8 j) t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ q8 K* z, H3 B4 Q6 \5 U+ o8 a - * kind, whether express or implied; without even the implied warranty' t1 R9 @( g0 U _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ o# Q) i4 @. `4 I
- * GNU General Public License for more details.# O* G; ~8 |. ^8 C/ I6 \
- */
- f2 H+ u' Y% l% e$ X/ J
' v0 _) ^7 W8 ?7 {- #include <linux/module.h>
: K% r2 z& L" {8 _# W# z - #include <linux/init.h>
3 F) w5 P$ X! t/ k0 {- n - #include <linux/errno.h>1 j z. V2 @/ v. `1 z! e' Z' J
- #include <linux/types.h>
B3 k5 p. T, } - #include <linux/interrupt.h>
[0 ]/ y+ y q* U, H. Y$ ] - #include <asm/io.h>
+ Y1 ?4 z* ^ ? X - #include <linux/moduleparam.h>
8 O) M7 q9 P/ J( M! k1 O' g - #include <linux/sysctl.h>( w: B# {4 y2 Y
- #include <linux/mm.h>
2 ^# ]; f! d) {9 L' } - #include <linux/dma-mapping.h>7 _: z" P5 W; I# F% e' ~
0 I1 a6 A' D7 l3 n- #include <mach/memory.h>
& o Q" K4 F; S9 N4 b3 D - #include <mach/hardware.h>
, ?1 f: l9 b: U: [8 ? - #include <mach/irqs.h>+ T9 J5 s. K# A
- #include <asm/hardware/edma.h>5 p* k4 d) H1 \% y) a
: A% `" X8 H4 y- {- #undef EDMA3_DEBUG. B4 Y- I5 u9 E, U" a
- /*#define EDMA3_DEBUG*/1 ^* r. S( O3 \+ R. V- m) |! r- y8 A
- 3 a* s7 o1 x) H) P8 j
- #ifdef EDMA3_DEBUG7 u( z$ x' W- k0 f9 z+ h0 r- W6 }4 Y- t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( X6 H O: P* _. b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' J- A. _. ^) z+ \) i5 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 I& S. P. {+ Q1 h - #else; ] z' {( S, L- [1 L$ p
- #define DMA_PRINTK( x... )& C" d2 s9 R6 ~ n! \; A
- #define DMA_FN_IN
. F3 D9 D M2 H" E) M - #define DMA_FN_OUT
5 p2 {& c7 z( C# `3 A. H - #endif, R B2 i# \% }1 q
, s" J [% O3 H4 h" G/ D. j7 H, o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 U" O. ^) ?' K% }3 D. m - #define STATIC_SHIFT 3
9 j. u O/ E3 H& V3 H7 R) ]5 w - #define TCINTEN_SHIFT 200 S& k! H0 l( ~, X( B
- #define ITCINTEN_SHIFT 21
0 E' c" s, w, f7 k: c - #define TCCHEN_SHIFT 22
8 I* d( y3 ^, i/ A! d1 D2 Q1 s - #define ITCCHEN_SHIFT 23
/ f6 a# E' n8 n6 ^7 G" J+ c - 4 K5 K [. R! y4 S* s
- static volatile int irqraised1 = 0;
5 o( e* J9 p- q+ r7 W d! o( h - static volatile int irqraised2 = 0;3 a; @. x' {* t0 c2 A, Q `, N ] k
- + S7 @1 P* q- e j; R! x2 y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ?8 M9 I6 h7 c1 ?5 \- W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 [) V* g4 m( Z- _' d# @1 [- d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 R" V |7 y- g c5 g
- " L% L9 O% G* M9 K
- dma_addr_t dmaphyssrc1 = 0;( |' a/ f* T! ~! q3 K0 _4 }
- dma_addr_t dmaphyssrc2 = 0;
7 Y" [, s% X+ p' ` ]# q - dma_addr_t dmaphysdest1 = 0;( Z k6 G: O( X5 F, W
- dma_addr_t dmaphysdest2 = 0;( ]& @* C: W* E7 _7 E* z
+ i/ t U7 M0 u7 L7 c- char *dmabufsrc1 = NULL;0 k) ?& ~ a) K1 V" j
- char *dmabufsrc2 = NULL;. D5 ^+ [# v1 q4 y% A# Q
- char *dmabufdest1 = NULL;
( W% x: j6 l; [3 {' Q: l - char *dmabufdest2 = NULL;
' F8 L$ P, [: p
0 t5 ?1 ] e- [: c0 T+ P- static int acnt = 512;
0 E& _8 e9 {7 r6 N0 Y. \ - static int bcnt = 8;
- \! H, N- y& D* y1 T4 L$ X - static int ccnt = 8;# p" { U4 U5 H) e6 }
. G4 J. P2 i3 W- module_param(acnt, int, S_IRUGO);
5 u% C1 y( b- s2 H2 e4 d0 n - module_param(bcnt, int, S_IRUGO);
1 M, ~3 |. U2 K - module_param(ccnt, int, S_IRUGO);
复制代码
& L. Y5 p5 @- G8 A* B& t$ b
' ~& e: m+ D4 r( }. T! r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 ~% h; ^6 m+ B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; m- F5 d3 f$ g, N" S9 a6 A$ I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 `3 q7 l" F5 v4 I
% l- q: [1 ~8 Z8 ^' r" w& N/ y! ]; `: @
|
|