|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% w* o. @6 r# z- g- [code]EDMA sample test application- h7 Y4 @# e) _
- /*
) D- l* Q9 v. _+ D: _$ z' w - * edma_test.c2 r4 }. \8 m' N$ G( k" A3 Q2 g
- *; ~! m, O* p8 w9 W% H G0 s
- * brief EDMA3 Test Application
" R4 j( U2 i* Q9 j& a* { X/ L - *
# s- }0 Z7 V( \$ [9 Y. t - * This file contains EDMA3 Test code./ r- ]! \+ Y; c
- *
+ z( H2 N* v- F0 ~8 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 v! X$ e7 s4 U' Q+ t% Y, O9 C2 ?3 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# D- [3 B# } K - * TO CHANGE.
! i f& K7 o3 n7 H - *
! A t$ j" W, [, K0 M; {% f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 I2 O% o7 x5 `% W- Y$ K
- *
& X+ J- I j- C3 m) s) @ - * This program is free software; you can redistribute it and/or+ W* n6 v# v7 h2 t4 [) n; C6 T
- * modify it under the terms of the GNU General Public License as
% [7 ~2 Z: E' k* _! f9 \ - * published by the Free Software Foundation version 2.# f) ?# {$ K1 }* V4 q) T! ^
- *
1 \; M& K! p, z+ x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 v$ J [- N( p% M# X
- * kind, whether express or implied; without even the implied warranty
& `' \/ O x! k! U! F/ P2 M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- O4 l/ j6 S1 L6 G9 E/ W R- R - * GNU General Public License for more details.- S: O. |/ m& g
- */$ d: {: m0 Z+ I3 u. x' a! D$ j
- ( z6 M8 A4 W) j0 n/ L4 X* ^
- #include <linux/module.h>8 x0 O3 s4 \4 F0 S. @ M
- #include <linux/init.h>
. H" }! k# W; G7 k7 ~ - #include <linux/errno.h>8 u/ W2 \6 B7 m; R5 v
- #include <linux/types.h>5 O+ B3 V$ z: p! U8 c" x& L( w2 N" G8 G f
- #include <linux/interrupt.h>; X' p, I. r: s L
- #include <asm/io.h> K, _% z0 g# ?: ^1 W c# P5 U) q
- #include <linux/moduleparam.h>0 K( ?/ d9 t5 m0 _
- #include <linux/sysctl.h>% U' G. S, J& q( M: o
- #include <linux/mm.h>* q! N# Q u/ L3 ~. K! f0 M
- #include <linux/dma-mapping.h>6 ~* O7 ]- o8 W8 r. U5 V' O
- & l/ U7 |4 K6 A
- #include <mach/memory.h>' Q& w2 b( Y9 e% T# ?' Y
- #include <mach/hardware.h>- u1 j( m1 r4 X4 R. P- L, ^! W
- #include <mach/irqs.h>
/ I$ O, m' B8 ^; ]2 r( [% e8 J8 P, T - #include <asm/hardware/edma.h>6 }0 h6 J: n2 o" [2 k
2 _/ G% ^1 n6 W3 a/ x- #undef EDMA3_DEBUG
6 h: d! i2 v2 e& c - /*#define EDMA3_DEBUG*/
0 T: S0 K7 z8 j2 t! W6 w. I: m( B, y
1 J% P! u0 `$ N- #ifdef EDMA3_DEBUG
! q# s$ p! e/ O- z! \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" E8 i# U: a: J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 t( r% V4 `. j; s0 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 t: ?* }5 ^- B& r" a
- #else
( M8 l: ?$ I) X- i; _8 H/ J6 X b8 ^ - #define DMA_PRINTK( x... )0 v' O$ g c* y1 x
- #define DMA_FN_IN( {* e7 [' i4 e. @! v# P+ W
- #define DMA_FN_OUT
1 i- z- v0 G8 v" I - #endif
' H* _% M/ [7 x6 a" D; S% [. O: j
6 X/ A. |' m3 J) H8 ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 p9 c- p# ?2 N. Q' K# j6 C' X
- #define STATIC_SHIFT 3
4 ~& d1 d; D9 l) ^) \3 V6 l6 r) I: J - #define TCINTEN_SHIFT 20: `) _8 W% x) C
- #define ITCINTEN_SHIFT 212 c' [( h6 ^# m6 s' @
- #define TCCHEN_SHIFT 22; q P! w z8 ~) ]( I4 y4 K) Y
- #define ITCCHEN_SHIFT 23
+ E9 @: `/ Q! `; J$ k: f! P3 P
8 q: E; ^) A* W# c; X1 U- static volatile int irqraised1 = 0;
. D3 v; @2 r0 g$ j7 ~$ P: x - static volatile int irqraised2 = 0;0 V4 h9 {' b* Q0 @) F
- \ W+ F6 }$ ~- ]4 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 E! F" b4 t- W- R/ E9 C& P1 k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ H/ L) v, A1 A, G8 i/ j9 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Z8 t' J# V; h& e* e* J$ Z; [! q
5 m% i5 g/ M; S. x: W: l- dma_addr_t dmaphyssrc1 = 0;
( l1 U/ f9 i* r: l2 d - dma_addr_t dmaphyssrc2 = 0;
`( l1 A& x: I& Y9 Z - dma_addr_t dmaphysdest1 = 0;
6 X- \, f' I! v F+ | - dma_addr_t dmaphysdest2 = 0;
; g8 D0 k% z; i- u
1 b/ W0 O; N0 N' ]& y. P4 M$ i2 N- char *dmabufsrc1 = NULL;- Q" |6 T6 S( [: `" d: H: i; a
- char *dmabufsrc2 = NULL;
7 q0 a% w( ^' C, i# X, n - char *dmabufdest1 = NULL;8 r/ P$ n$ I% }6 J2 K( j
- char *dmabufdest2 = NULL;
. } X+ I9 V( j, c - , k, g, T/ Q: w, S. T) f" W
- static int acnt = 512;
7 h/ S* j( K5 B0 s8 h- ~4 x - static int bcnt = 8;
7 J4 u- }, K- d - static int ccnt = 8;) h* ^& D: ?1 B0 Q
- ' w1 g5 x( Y* }, k; s8 y
- module_param(acnt, int, S_IRUGO);
& g% Z- x; B6 ^+ P! q - module_param(bcnt, int, S_IRUGO);7 e( @4 m: D# s' L
- module_param(ccnt, int, S_IRUGO);
复制代码 ; E) N' ?9 y! ~- C q2 z+ a- I: ]8 a
8 l4 o$ O5 d& ^3 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ f3 o7 v4 {; Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 d7 ~+ G$ p- ~' [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# I- `/ E8 N3 F5 R' f
: S$ f M! ^& M/ C! M) S9 q) D0 V: E v) v
|
|