|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ^5 a2 k. k# L+ w3 V) C
- [code]EDMA sample test application
- t+ w# H, f& J$ l" {, U - /*
2 \8 A5 L) J+ i. z - * edma_test.c
* u1 s* R4 i2 V! X3 Y& j. R# i - *
$ W) C; c9 x/ b7 o8 ` - * brief EDMA3 Test Application
, }+ i/ o/ ` v1 |( m, L8 |: I - *8 w" L4 a+ x* _
- * This file contains EDMA3 Test code.
0 g F( i8 w1 k8 Y$ P# n - *; i e; R$ W4 a8 g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' n o0 J! x1 q$ r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 o' R: h' p/ C G# Q
- * TO CHANGE.7 `! R8 f2 n; n' C! t0 D
- *
5 V, O( g2 U3 f$ h! B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ G5 X/ P8 k( m9 [) K. a0 o0 g' ~9 m - *
: n, Y+ U' r0 Y! x$ n4 Q% d - * This program is free software; you can redistribute it and/or
( A, @) d, N6 _) Q) \! _ - * modify it under the terms of the GNU General Public License as3 w" j; l$ B/ e; a* W% i. M" j
- * published by the Free Software Foundation version 2.1 t. q, } B. m' v$ H! E& w
- *, T7 o) l1 k6 b. J3 d' y2 Y( O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' v! f: o: `. t) |0 z4 E9 l
- * kind, whether express or implied; without even the implied warranty; ]7 j7 G8 B( E+ X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" B( y% R6 W9 `" V8 t" p
- * GNU General Public License for more details.2 l3 W& |! |; w% _+ l+ t" E" q5 r
- */& i2 b, O( i. |& I& k: W% [3 @% p9 e0 N
- , z9 \8 I( E- L0 t$ U& Y- [
- #include <linux/module.h>
3 c7 W1 |- x6 I. S - #include <linux/init.h># g! V) [7 z% U4 D( x
- #include <linux/errno.h>( @* @3 v+ i5 i# ^( s1 q X
- #include <linux/types.h>* m6 v2 C7 b; S/ ~
- #include <linux/interrupt.h>$ s" Z, P9 l t- `) n0 v! k
- #include <asm/io.h>' Z! d# e& F5 H$ R( B! O
- #include <linux/moduleparam.h>; R$ g8 {" C2 H, A
- #include <linux/sysctl.h>2 v) X3 m! T1 k0 g% [
- #include <linux/mm.h>
1 p$ n( N# L, B X! K0 D - #include <linux/dma-mapping.h>4 t; K: K( H# M$ A; ]/ K& m
7 d) f1 G' f* g' |$ R- #include <mach/memory.h>
5 S5 l; x3 s q+ _) L7 E. b - #include <mach/hardware.h>- @ k$ s3 y. y6 g2 }
- #include <mach/irqs.h>
1 ]4 y* m; Y; B0 @ - #include <asm/hardware/edma.h>; b+ S0 W( B* X- A% ~: I
8 ?1 H8 J4 z; q0 w9 |0 [- #undef EDMA3_DEBUG2 H8 q7 S2 A, f/ s8 B; w
- /*#define EDMA3_DEBUG*/" \ |. B W, ~9 H( t/ g
( Y7 P1 x* l6 |) l2 ]- #ifdef EDMA3_DEBUG
! L6 K4 B1 h0 U+ b4 a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ {1 v9 M" K" h( V) \! ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; ^5 y7 t; C* v. f; ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
Q% D* S7 J c+ _# `) B. B - #else- S, S) T3 m8 O9 @
- #define DMA_PRINTK( x... )' F$ V) z: [6 D, ]: z- P
- #define DMA_FN_IN
4 {4 \# k; a% M7 y( W* u - #define DMA_FN_OUT
$ J0 y0 v; R/ d" O5 ~3 q* g - #endif
# D- T+ l( A- T5 C" h; t - # G0 h3 H6 v, S: E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 p* p4 Y& ^" Y- T0 f - #define STATIC_SHIFT 30 |4 [( z( c/ u7 j% ^3 a$ s! }! R
- #define TCINTEN_SHIFT 208 H V g2 b( y
- #define ITCINTEN_SHIFT 21) T, p' Z) w3 B
- #define TCCHEN_SHIFT 22
- e7 s) N3 O, ` - #define ITCCHEN_SHIFT 23- r. w5 w3 b$ K# N6 W9 k/ U* U9 Q* E
T' A1 j7 A7 F2 r( n: ?& j% a5 K- static volatile int irqraised1 = 0;
. k3 r- q) r1 Q% r) Q) _- Q1 Q - static volatile int irqraised2 = 0;- Y2 e; |1 ?' w, j& E5 I% L" c# s q$ e
- % f5 t) t$ N1 G# Z6 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, }+ { C5 b2 t6 h P# _3 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 H' `/ `0 r7 i+ \& N7 y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ M: _8 w; n! Z2 x/ ?4 w; w
3 ]" j% P- M S% {, e i- dma_addr_t dmaphyssrc1 = 0;3 p4 X3 Q3 U2 H: w- |8 a2 `' f
- dma_addr_t dmaphyssrc2 = 0;
3 D0 X0 ?3 u+ N9 y& I - dma_addr_t dmaphysdest1 = 0;
- t& f) x) T& a - dma_addr_t dmaphysdest2 = 0;
: Q {5 [( r6 \% G: H c5 O - % O5 o y2 A' ~: u$ h! |
- char *dmabufsrc1 = NULL;+ ]" z$ C8 ^3 Y; p) Q
- char *dmabufsrc2 = NULL;
/ F/ ]$ Z6 A- z- c O) ^0 D5 P - char *dmabufdest1 = NULL;, @# d# a9 z5 Q2 A9 J6 K, u
- char *dmabufdest2 = NULL;
0 `4 M1 r& b* J# Y - * X. H1 K U. H% A+ L
- static int acnt = 512;4 i0 Z( g% a$ T
- static int bcnt = 8;
/ T' M# q8 A [5 q Z - static int ccnt = 8;
9 T' x; O$ s* Q2 b3 r
) W3 l, T6 k, H# m- module_param(acnt, int, S_IRUGO);, z `" E5 J: \8 `& ^
- module_param(bcnt, int, S_IRUGO);
5 r/ A8 B& ]0 K. R4 L+ V+ Y - module_param(ccnt, int, S_IRUGO);
复制代码
# z* Y G% ]& E- ?7 h
o& L Z( |" w. i! `% p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! m: M5 b$ S# ?, t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 z: |, ^# L$ ?& M* ^5 l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: I( {& z5 U2 o( s' V) g6 [
, E# u* m" a' O; l9 E- P* T
0 q# d8 y9 ~* g' R j4 w( M' q
|
|