|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ^. z6 X' E$ x
- [code]EDMA sample test application( [+ y/ p+ e, d; M
- /*; D0 H4 a- O3 Q, v" b
- * edma_test.c" s9 d, T( N9 S$ R& E0 }
- *7 M2 q& J$ J6 a" q) t( r$ ?+ P
- * brief EDMA3 Test Application
$ b: ]4 n. V( v4 B$ u% ~2 f - *
4 |/ X9 U& j9 {+ S - * This file contains EDMA3 Test code.
; ~( ?' a- C7 \' f+ b! t* w; G - *
4 |% b9 r1 G3 r) f* [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ W6 ]8 m; e! A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# Z2 ]% f4 J" ^
- * TO CHANGE.
* f. O4 O* D9 E* D I' s' J* h - * i- h4 Z. h2 _: e% S6 n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 ~. V+ J4 g5 u3 v% B5 S7 M0 D' h - *
+ V& p) a/ ]" ~: [4 a+ q" c - * This program is free software; you can redistribute it and/or
# y& |7 @3 `* y4 E2 I - * modify it under the terms of the GNU General Public License as6 f( N: n" i+ D/ S) M
- * published by the Free Software Foundation version 2., x! T" d: _( T+ x/ E! }1 V: \
- *
( e" o' Z& N& h' P$ [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 c* r6 |1 [1 W: h5 T8 j) T# `, e
- * kind, whether express or implied; without even the implied warranty
) `" p4 N. I% G1 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the F0 e0 Q6 r4 x( b
- * GNU General Public License for more details.
! h1 v% G- t7 Z) g* X - */* u W( [$ k# b3 ^. E
# t1 E. Y, V; r8 U2 n- #include <linux/module.h>" @# W, V& s- j0 @. X0 t @! |# y
- #include <linux/init.h>7 J' y6 H2 F2 T' G
- #include <linux/errno.h>
: }: U( E) f8 Z8 t$ e2 Y5 l - #include <linux/types.h>
5 p2 N7 A9 @% A0 C9 R7 E - #include <linux/interrupt.h>; v( [/ K8 P9 u& S) d* |2 G5 y
- #include <asm/io.h>5 |9 F: T% M: V |2 ~
- #include <linux/moduleparam.h>
, L- d8 i6 ?' O) S1 h& Z/ t - #include <linux/sysctl.h>; F% h6 w) b) d4 {& r( J. x ]
- #include <linux/mm.h>* J1 U! r* `' O: ?
- #include <linux/dma-mapping.h>& ?: H; t I \$ m& H2 w
; T G* ]7 @. r- D) N- #include <mach/memory.h>
6 ]9 o! M. z0 ]( t: g - #include <mach/hardware.h>
1 E9 `, b8 G+ _7 i - #include <mach/irqs.h>. R# ]% c( Z, _; c5 j7 C2 V6 o
- #include <asm/hardware/edma.h>! z& f, Z# ~( k
- . H; i- s4 t9 h+ i
- #undef EDMA3_DEBUG" H. {% a( d. Q# E# R: \
- /*#define EDMA3_DEBUG*/6 e& G9 d" |8 O9 y
9 i5 ~ W8 \( a7 j! f- #ifdef EDMA3_DEBUG
; D; u$ T8 L" T9 r; I; v. y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 `% n; J8 O$ @' ^) Y# {2 ~# B* o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 H6 [/ G& T7 d! _4 g$ r: O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' e0 ]- |, @, a3 K. O3 t" H
- #else
8 \) @9 K! q2 k) m6 o, J - #define DMA_PRINTK( x... )/ L5 j$ M2 R' H/ e3 S9 Y# ?
- #define DMA_FN_IN
- v7 _" U$ @/ C# }1 ~# X/ S - #define DMA_FN_OUT7 {4 x0 l4 T6 Z& l9 c
- #endif/ n7 ~ }( X5 W& `
1 P7 ~/ w4 [1 G. Y& A0 E2 n. x- #define MAX_DMA_TRANSFER_IN_BYTES (32768): F4 \' Q: ^; Y
- #define STATIC_SHIFT 33 }6 q2 m: x2 Z0 y5 U+ `+ B
- #define TCINTEN_SHIFT 20
% b- d' T$ c/ f' { - #define ITCINTEN_SHIFT 21/ a6 t2 W! L6 a1 \' J3 @
- #define TCCHEN_SHIFT 22
& L- r# y5 T0 h1 x% g, n - #define ITCCHEN_SHIFT 230 Z% N& K0 t- v- J& i3 M' W3 N* K
o5 K/ v+ Y3 P5 ^, m0 C- static volatile int irqraised1 = 0;
* e) O/ Z0 X0 c4 s - static volatile int irqraised2 = 0;( h1 o% g; }6 F1 q7 \. A ^7 v8 H
- 3 k1 E, W5 }; v0 @ K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 G, a$ C# Y( ^7 w+ C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ^, l0 L/ F. ?7 w7 ?, I. v. r# ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 m8 @- y+ V" a1 l& k: h1 F3 g - 9 g* x$ _% f3 _9 p( {
- dma_addr_t dmaphyssrc1 = 0;
6 H9 E4 _$ Y) T( Q - dma_addr_t dmaphyssrc2 = 0;
# y0 `/ X( ^/ q# a( b2 D# t - dma_addr_t dmaphysdest1 = 0;6 y* G8 [3 c }, j' H
- dma_addr_t dmaphysdest2 = 0;5 ^+ Z4 k& P! p9 q6 t$ Z: Z V
! G0 ~( D, G/ t7 q/ ]8 K$ \+ ~7 T( X- char *dmabufsrc1 = NULL;- e3 a0 u; q5 |2 t2 n
- char *dmabufsrc2 = NULL;
( {0 I, r4 d# f: x* m - char *dmabufdest1 = NULL;
4 B$ K! L9 W- Y7 p4 h7 i; b - char *dmabufdest2 = NULL;! g8 g6 S5 q, Z7 w# d
6 A4 b, g# z2 t5 Q4 x: U- static int acnt = 512;
f# x8 w* O6 W - static int bcnt = 8;
4 h9 a3 {9 a/ d8 [. o& F" j - static int ccnt = 8;
1 j3 y- L, @2 H2 u; w - 0 A7 i! L& Z3 }+ e2 p8 h& c
- module_param(acnt, int, S_IRUGO);8 \! T; _2 i; w: g- n8 E# N
- module_param(bcnt, int, S_IRUGO);' S% e; @7 v* R4 O5 Q
- module_param(ccnt, int, S_IRUGO);
复制代码
$ _3 `$ a, J) o0 `
5 ^% [/ W6 I/ x, e7 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! ?0 v5 j7 }- |* ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( j! i$ Q3 c+ U9 @* v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 G1 ~+ q: S' U9 L! j- Y$ p2 o( [
- d a! q% c! J, }" u0 E' D# d S q; h% i
|
|