|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) A# y' W x/ B
- [code]EDMA sample test application( Q M1 Z. j7 r7 {) I
- /*& l- G% r7 b! Q* p. `# a
- * edma_test.c+ [* w3 \& F' u0 K' ]- y- K; ~
- *2 Z/ H3 V$ n$ A- M, ~" W W
- * brief EDMA3 Test Application
2 ^* k! Y- c: S" P; }! u# W8 y - *
/ D. s* m* e( t* h3 g3 X - * This file contains EDMA3 Test code.
. ^; |* X8 i1 V; e, J# Z& a0 Y - *. N" q! w6 v) f; ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 F; m) X) e9 J% L( ^4 Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; v3 G' p9 ]1 E, L( G5 [) o! S - * TO CHANGE.; V# z; ~0 Z8 r# K( H
- *3 T' @! U, z {1 d( C, d$ V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ b' K/ I6 U3 t5 G' Q - *0 D9 L" ~9 J. V$ `4 y5 d0 k: |
- * This program is free software; you can redistribute it and/or/ k, S* F% _% f* W
- * modify it under the terms of the GNU General Public License as& j+ Z6 u% p: H$ c6 B! S- F/ Y
- * published by the Free Software Foundation version 2.
5 s7 J9 t9 O( u- K0 i - *2 o2 d$ b9 u) C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% a5 Z. `0 r9 X0 ?8 E - * kind, whether express or implied; without even the implied warranty
% R8 F+ @6 b! L; J% ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, r+ T) M, A" V7 x) r
- * GNU General Public License for more details.
[9 B- l2 i" G% |4 g6 W: G% x - */: n) U$ Z* B& J1 k
3 X% C# Q Y/ u. n( f- #include <linux/module.h>5 |1 G* Z8 H/ u4 l6 {' j
- #include <linux/init.h>. q' r+ S4 B7 y4 M6 z7 _
- #include <linux/errno.h>4 A- C5 Y* L* t$ A; [
- #include <linux/types.h>
2 o7 P- f1 Y b! q! c. K) B - #include <linux/interrupt.h>) r. W/ Z0 X4 W. G3 c
- #include <asm/io.h>
" `, e2 F" `# x9 g+ d, k4 s# r, q - #include <linux/moduleparam.h>
8 G4 D$ l# x: L2 W5 s - #include <linux/sysctl.h>% Y( u8 W- _% `" N
- #include <linux/mm.h>
- o% l- i7 s7 B - #include <linux/dma-mapping.h>
# u8 m8 H8 Y. z& x. p6 n
$ N" ?5 ]$ Y- w6 N. [. _4 \+ ]# k- #include <mach/memory.h>
- `- s, |2 r% W* ` - #include <mach/hardware.h>9 {5 _3 a Z6 Z% d# h' W! a' m; K. e
- #include <mach/irqs.h>2 N2 I. p" Q, U/ T7 @3 ^' K3 w
- #include <asm/hardware/edma.h>& j7 N$ W8 U. Q/ g! M
5 U' ^' T4 y& @$ }" p- #undef EDMA3_DEBUG
! v) F; O2 d1 F! E - /*#define EDMA3_DEBUG*/
X N- r" k- d4 k6 `/ A3 V - / _8 ~ t4 X4 c; }+ c* v7 k
- #ifdef EDMA3_DEBUG" F: @$ B* P& u- X+ `; Z1 b3 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* \- h3 U# a! [- D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 A) j* `' a/ B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ y. _4 ]; T8 P, b4 C* E F; ?
- #else
3 ^' c/ Y8 d$ \. Q8 L" W - #define DMA_PRINTK( x... )+ s9 [6 p0 a$ l7 _% X
- #define DMA_FN_IN
' \0 t1 u; n2 A1 L( t - #define DMA_FN_OUT4 D/ c$ h+ I: V$ P/ w# U
- #endif8 G( _. O9 \1 b+ k( V2 i+ U J) o
- 7 ?: h( C2 D+ @. F, C5 S: q% n# e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ E) F( M/ {! r& G9 w - #define STATIC_SHIFT 3
% o+ o& w$ {. O; c0 @* n - #define TCINTEN_SHIFT 20) v. X2 m# t; X3 o/ s4 ?
- #define ITCINTEN_SHIFT 21
6 a5 B* ]5 ^& s. Z; H/ P* ~ - #define TCCHEN_SHIFT 22
, u3 D; f0 V) g3 f+ N - #define ITCCHEN_SHIFT 23
6 E+ g3 j, c6 U3 r - . W+ n: T. s8 ~9 l Z/ u
- static volatile int irqraised1 = 0;( C1 J' [0 g0 k- f! I
- static volatile int irqraised2 = 0;/ I' Z) e/ c# B. y% G
- 1 K! |# A( y2 D1 [7 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); e% i) j+ K. \, e7 b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( J0 |9 L9 f! T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( Y+ P% K3 C- u/ Y3 y0 U
6 |: X+ B9 C, t& S. U- dma_addr_t dmaphyssrc1 = 0;
+ o0 }7 P9 |7 a# Q" T6 h; V - dma_addr_t dmaphyssrc2 = 0;
: y) G( s" u3 r - dma_addr_t dmaphysdest1 = 0;
+ A$ h2 n) d) T - dma_addr_t dmaphysdest2 = 0;. r# K. L" u" N; ~
" z. V4 F0 f$ U" I. q8 B- char *dmabufsrc1 = NULL;
1 o8 Y+ n% p' L" G$ g e# J; l - char *dmabufsrc2 = NULL;; e- T: _' G( z0 T
- char *dmabufdest1 = NULL;; t# F1 `) p0 C5 z+ [
- char *dmabufdest2 = NULL;
( f3 _% U: Z, C) o2 l& E - ; Q4 ^* G# \% N% l/ c, |- s. I
- static int acnt = 512;9 r8 t. [( N$ K# P& Z
- static int bcnt = 8;5 Z7 b- n0 }( o" Q" I: p1 f
- static int ccnt = 8;& f$ N/ i7 V) l( Z& f4 [' S, x7 _
5 I4 s K% J Y7 l8 v9 q- module_param(acnt, int, S_IRUGO);
* t! g6 ?8 Z( E% ^7 E* i$ y1 M6 d H - module_param(bcnt, int, S_IRUGO);
8 v3 a9 H: G, m! w4 v - module_param(ccnt, int, S_IRUGO);
复制代码 . ]5 i, b. c- @
" a: i* G4 @3 l8 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ D; i, M/ N+ q( harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ~7 p. b4 P% P h$ B/ `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( q* c5 H/ Z' Y- L( R) w7 t
2 @) t0 \- w' y7 G
- A L( E4 I# U' H+ }6 N1 ^( {1 Q J
|
|