|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 A" S. z( {* e" I! l- [code]EDMA sample test application
& y& @: O$ w, F+ _' g( E! I - /*$ |* S2 l" H! j2 m/ y3 i, j% x
- * edma_test.c
8 _8 P" b6 K1 s7 E5 v7 J - *: m% V+ {8 [6 Z' m
- * brief EDMA3 Test Application) p W; a5 r% b5 w o
- *+ M8 K0 N. {) P! I2 [
- * This file contains EDMA3 Test code.2 X" m) G r6 W4 o# p. }' ]- }# \9 V
- *6 R! ]$ Y2 U& w. o$ C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 M" y3 t0 J! Z E7 t1 n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. Z& s j& {4 U: l. s% O" ]
- * TO CHANGE.4 g& U4 W, w! y; J+ i
- *8 I8 I) I4 G) t2 ?: l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 P; D6 q+ j+ n q8 B! X
- *
) w8 N$ @4 y; d" [. {- L% j - * This program is free software; you can redistribute it and/or
+ Y+ h; E- ^' ]6 c - * modify it under the terms of the GNU General Public License as
6 S: K5 t5 r& x; ~ - * published by the Free Software Foundation version 2.
8 y! J+ H( C( a. a2 R: V0 n& j6 d - *! z# K7 F. l" G! {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 c/ A0 B& m/ I
- * kind, whether express or implied; without even the implied warranty
( S2 O3 u' Z: K0 T) J2 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! {8 @9 s& X$ ~7 }# O m- s1 f - * GNU General Public License for more details.4 t8 _) f1 e4 x' u# C3 u l
- */
; X$ i9 m1 I5 S+ @ g2 Q$ p, g
/ K1 d3 d* T Z8 |! U8 `3 q- #include <linux/module.h>; L; s b% J; B8 l* K
- #include <linux/init.h>- ~% u2 H1 m' ]3 v
- #include <linux/errno.h>
" F0 k" _) v5 S! B7 s - #include <linux/types.h>; |1 }% R2 {" ]
- #include <linux/interrupt.h>
- n6 ?- K! B. v0 P0 o1 D - #include <asm/io.h>
' \) m* D0 ~) S0 p u( A6 g+ [ - #include <linux/moduleparam.h>! V Z9 j$ ^# o r9 l
- #include <linux/sysctl.h>
2 m ]/ F! e$ q( ~: @& [ - #include <linux/mm.h> p+ ~" _, O( ]' m" W+ O- \9 ?
- #include <linux/dma-mapping.h>) N+ O# h# X0 q2 n, U" _7 W. R; M
- 9 I# r- t" B" @9 P4 n: T' o
- #include <mach/memory.h>
, u- H: \! }$ o4 S- m1 N; E$ x% \ - #include <mach/hardware.h>
" M" I& k+ G8 y4 O" X - #include <mach/irqs.h>
7 ~% {7 t3 d$ x* [4 n. X0 @5 P - #include <asm/hardware/edma.h>
" f) L& }. b8 e
2 ?. y G: Y3 |1 U- #undef EDMA3_DEBUG# l O6 S2 v' f1 q$ z4 Y1 g, f& s
- /*#define EDMA3_DEBUG*/
, Z+ P6 I7 [" H# n6 _
* B: s% }& ?! W- #ifdef EDMA3_DEBUG) d) U/ U" o: Z( @5 q7 |! x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( y% t3 ^/ C+ Q8 V7 A$ w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 P! l) G/ E) C9 r, H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ]9 W R8 ]9 {7 _
- #else, ~! D# w. D# g# l3 }0 l' {
- #define DMA_PRINTK( x... )
* ] o; I' j- Q/ [& ~' a, t - #define DMA_FN_IN+ D$ f' ^( ~6 V$ T, L" D
- #define DMA_FN_OUT& b: u6 J4 `0 {6 o2 x
- #endif% G0 G* P& Q9 L5 m6 e6 |
- / N1 I9 J4 C# O6 ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ G2 h, T8 ]4 A) t( q5 B2 a: \ - #define STATIC_SHIFT 3
9 U3 O8 B& d# \: I% m - #define TCINTEN_SHIFT 20
2 w; _" s7 q7 `2 f7 o$ a5 H - #define ITCINTEN_SHIFT 21 u$ B5 G0 W2 Q
- #define TCCHEN_SHIFT 22
/ ?! O7 g' G& h) D. `% Q, ?% d6 ?6 M6 { - #define ITCCHEN_SHIFT 23
* E: d* t k' ?4 N) h - 1 N$ S) g; l% r s
- static volatile int irqraised1 = 0;8 s3 n- m8 V1 m5 K, K* F
- static volatile int irqraised2 = 0;) e" ~# O, D" ^
- , s/ C6 p# Z: o2 i I8 O9 z G3 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. x, m4 v! `* }- f; R# c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% R4 U6 W' r1 D3 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 u3 i' O% e) `* D! J4 v$ r - , C/ \3 o/ Q4 ]9 P) A4 b
- dma_addr_t dmaphyssrc1 = 0;
, B4 t p+ W- }3 k - dma_addr_t dmaphyssrc2 = 0;
4 }5 J- D/ v" g3 ~% Y$ h: P' _ - dma_addr_t dmaphysdest1 = 0;; o& c5 \: h( ^. [
- dma_addr_t dmaphysdest2 = 0;
! q0 x( Y- k" r: R# c q
0 _9 Z* {# o, A3 e/ Z1 |- ~' L& F* D- char *dmabufsrc1 = NULL;- E- F8 G) W' H9 K8 Q, Z- R
- char *dmabufsrc2 = NULL;( I5 d1 k( f! R8 U( e0 K& e
- char *dmabufdest1 = NULL;- {7 r$ ?1 N! b. f
- char *dmabufdest2 = NULL;1 P6 @( S. z* L- L
- 3 o; I, G5 T) c1 a% h: y
- static int acnt = 512;
% Y! p# i% f" Q$ j) X1 K! v2 k - static int bcnt = 8;
( H: T* T2 k. c - static int ccnt = 8;# v* G! K6 I- |, y# q; J
0 }3 |) A6 K9 Y. o. v" p- module_param(acnt, int, S_IRUGO);+ P( U8 z; b; X7 I% O% M% a
- module_param(bcnt, int, S_IRUGO);" J4 l9 A3 A7 q7 G# F0 ?* g
- module_param(ccnt, int, S_IRUGO);
复制代码 5 y* V, v: d% k. o5 r1 m! M
) g0 e3 D; M+ B) v5 L1 x5 k$ U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" w; n( I" |7 L+ j5 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 [% Z' `% \& e, I) J5 B5 [/ U3 J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ^0 N7 N* }9 U3 o$ M0 X
7 q! F$ E& u/ m
T, F5 ] i4 c
|
|