|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; R* |$ Z1 }( r
- [code]EDMA sample test application* Z7 i* A, J! D! S% r
- /*7 R& }& u3 J x& |+ e7 a* L
- * edma_test.c6 ~2 D, ^& E* c6 `4 s* O g- n
- *
7 W' s% V7 H/ q; e - * brief EDMA3 Test Application
9 ?8 f4 a, g- W/ d% ?5 }2 r - *
2 t% o* _0 r0 R7 s - * This file contains EDMA3 Test code.! b9 F$ G- Q6 q& z$ L1 K$ ~
- *7 V, f0 o" u+ t3 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, _$ w- O6 f" [; O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; }$ [! V6 e! S* K - * TO CHANGE.7 ~# A9 e3 X' }- b# H2 }
- *
; g d8 |% l2 f( c8 D' H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 ^9 M( u+ P+ W& C$ _3 o/ p8 q5 s
- *
6 o- g' Z. j" I- K" Z - * This program is free software; you can redistribute it and/or
3 D5 m7 N; ]1 n$ j - * modify it under the terms of the GNU General Public License as
$ K% d) O3 N, |2 p$ n2 b: ^ - * published by the Free Software Foundation version 2." V6 s3 @$ h7 }- Q. R- U
- *
) \% b3 s/ |3 [8 Y- |6 m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( F9 ]0 U3 ~/ K - * kind, whether express or implied; without even the implied warranty
0 u( Z4 ]; m) G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
H4 E( u0 `, n' E% t - * GNU General Public License for more details.) m) r1 j( u& Q- V
- */* ]5 U5 I+ q. C0 ?7 |
- 6 F: E2 Q9 w8 M# B% L7 {
- #include <linux/module.h>6 X- o# H- }0 n6 e6 t4 U6 T% o9 d
- #include <linux/init.h>
! p% f W1 E+ E! @8 Z" q - #include <linux/errno.h>
) u* ~" C; T! r6 s9 k# O. V - #include <linux/types.h>; @, d+ n" Q) Y/ ?
- #include <linux/interrupt.h># Y, |* u$ Y! [& z8 h4 ~& j: Q
- #include <asm/io.h>
5 [6 f8 A+ d; i& R8 b' l3 r( r - #include <linux/moduleparam.h>
9 M4 Z' V$ n% Z3 L* q) o0 M: H$ { - #include <linux/sysctl.h>. a. [5 H9 ~2 b/ w$ f0 d
- #include <linux/mm.h>% b/ K/ u Y3 c8 y- Y. j
- #include <linux/dma-mapping.h>
4 G4 m# r* \1 T; m0 }% T' V
* `4 R. C# u F3 G4 P3 r- N- #include <mach/memory.h>" j% @; g6 N+ Y& f1 z5 |
- #include <mach/hardware.h>$ Y' u- q& v7 s
- #include <mach/irqs.h>
" T6 O4 A* A* T8 A% F/ U2 Z$ K9 w - #include <asm/hardware/edma.h> `( u5 p2 k% x6 [( k! _. E; h
% {( b z/ ]: }1 r- #undef EDMA3_DEBUG
4 i% x1 b8 B9 u9 p- c6 R4 `7 w - /*#define EDMA3_DEBUG*/
$ f4 x) T4 S8 v: Y6 J - 0 s' q W; q, S. k
- #ifdef EDMA3_DEBUG
( `7 ]7 {: a, X4 t( ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ D4 U3 Q% j* u, m5 [. G0 Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- ~6 c; z" A4 K! P% g, e3 R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 S, f( X6 R2 F, t, _. l y+ ]
- #else+ R4 T- A" u- W8 Y" T
- #define DMA_PRINTK( x... )
% W$ R/ b4 e( }$ H$ I0 I0 { - #define DMA_FN_IN# K6 ?5 J; ]# U, e5 K% x" T$ O+ ^: v# k
- #define DMA_FN_OUT1 B! G# y* t y. I) E
- #endif
6 A( N0 p* z8 {
" E, S+ Q* Z$ U' s2 G! j% O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
c9 F" J3 o, ?' D$ Y+ z6 O/ M - #define STATIC_SHIFT 33 |$ a& }+ y. n5 B. l
- #define TCINTEN_SHIFT 201 L: u1 x7 o7 T6 w
- #define ITCINTEN_SHIFT 21, p0 K. Y+ o# x0 W2 ]1 G- }
- #define TCCHEN_SHIFT 22
9 \9 @$ a( R9 }& Q7 C - #define ITCCHEN_SHIFT 23
: P& \+ U: Z1 u7 W7 h/ @ p
0 _, O0 N. u: ?# ^- static volatile int irqraised1 = 0;
5 r3 D! C; v, X/ j/ \ h0 [4 d h - static volatile int irqraised2 = 0;
- q; @ Q1 g# C( n7 S - + s$ ]5 F; O; C7 e, U$ } Y @- j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ G8 ~: ]3 d* m+ [+ s/ L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' C" l7 Z" ?% T, |. `) m4 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ [* ]# m1 L' L5 L: ^ - 9 ~1 c( X; P! P. m F$ B- s
- dma_addr_t dmaphyssrc1 = 0;4 x/ e. @# e. H% G/ T3 ?
- dma_addr_t dmaphyssrc2 = 0;
3 x) r y8 Z8 S: M( D: B8 @( k - dma_addr_t dmaphysdest1 = 0;
( N& z3 W! v4 m% K m( ~ - dma_addr_t dmaphysdest2 = 0;
& f0 E2 r. V! g
$ Q, B% {5 b4 L H! Y0 K* V- char *dmabufsrc1 = NULL;& `9 S8 ~& @/ T1 w1 D o
- char *dmabufsrc2 = NULL;
5 _( E2 W% C$ G! T' X$ k- ? - char *dmabufdest1 = NULL;* ^% w" i. r5 }( \' k
- char *dmabufdest2 = NULL;
5 K# l6 q( M8 X* T8 u5 w - ( y, [' v/ O3 e0 G. o6 _$ y
- static int acnt = 512;# \6 p: M; L, v* U
- static int bcnt = 8;
- t; n7 i# w) I5 V! l# x8 Z - static int ccnt = 8;
2 K3 Q' I2 S) E2 t8 a6 L3 C - " E( X4 t4 B4 ?# R% v
- module_param(acnt, int, S_IRUGO);
7 ^" `! M% x) D& d - module_param(bcnt, int, S_IRUGO);
_ R q' c: `: L - module_param(ccnt, int, S_IRUGO);
复制代码 5 Q, j! M6 p" \# u' W5 K
5 a' p3 Y8 u: b, C; R# [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ C; y2 N, m! t, d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! J5 o* ?6 C/ f0 l( L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 {7 V) G: }" Z! ^
l5 f7 E( K! @8 f) y" W
: a; r% m3 q# q6 W |
|