|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; C3 z q# o) h% O# f% i
- [code]EDMA sample test application
3 P G7 r& A7 K# ^, B/ G% M - /*
+ L$ e3 P" q! Z9 m2 Z# U7 Q - * edma_test.c6 ]4 h4 O, o; t0 \! Q- B
- *4 y$ w. K+ M7 G" Z/ m+ U) ~5 }
- * brief EDMA3 Test Application4 \/ x1 K/ P. ?4 e" b% a. H
- *: U: p: u3 b+ o1 a2 J) J' ^
- * This file contains EDMA3 Test code.
' f* s) p" W0 b- Z! K- [ - *
5 J1 L- S; N1 @' O' X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ k0 `8 q; K& d; N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 h! z5 l' v! ~5 p" k& K& E - * TO CHANGE.
" K9 ^! e( U, ]. e- A - *! j+ \8 g# r1 k, L# u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 U1 O" d; Z. C2 }" A. T - *7 z8 d& y; u% v! T
- * This program is free software; you can redistribute it and/or( L# W1 t1 b/ L5 c0 x- P \* a
- * modify it under the terms of the GNU General Public License as
/ j# g4 s! _7 s9 Z - * published by the Free Software Foundation version 2.4 ?/ d( k+ z3 L
- *2 _; Z; I2 @. q, z/ U) h( c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* x; J* q( Z; `1 [5 ~1 D - * kind, whether express or implied; without even the implied warranty8 z3 L' t1 E& b+ J7 j3 B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; A$ Q) i2 A0 C* g$ v9 G2 T
- * GNU General Public License for more details.) U! p4 H" A- t$ b3 z, U4 \2 y
- */
z9 v/ Z& W- u, W: B - $ W6 B, B @" t7 H1 {
- #include <linux/module.h>
; c* o. S# k! s - #include <linux/init.h>
6 s; h+ U# m6 ]* O - #include <linux/errno.h>
( ?# F! v7 e7 e - #include <linux/types.h>- E! H' G# ~6 _9 Z; F/ p
- #include <linux/interrupt.h>, `/ \# c* W: w$ `9 j# d
- #include <asm/io.h>/ i! J" B" F0 |% A, c, N3 \2 F5 x. F
- #include <linux/moduleparam.h>
- z" } g* w+ X9 z - #include <linux/sysctl.h>
, i6 N* E5 C7 G2 h2 l - #include <linux/mm.h>
$ [3 M9 |, k# w5 Z - #include <linux/dma-mapping.h>
: S, j& E% W ~8 R7 }# U
7 ] M* r Y( G6 g- #include <mach/memory.h>
7 q0 d. q9 z! I' ]1 M - #include <mach/hardware.h>' ?9 q2 V( y0 s1 q" e
- #include <mach/irqs.h>% `3 {* ^0 P" B5 i0 t. }7 j
- #include <asm/hardware/edma.h>. p2 {) w( [3 }/ ~2 D, [% g x
- 6 V) w" O1 l; r+ w; ]
- #undef EDMA3_DEBUG
' _: b0 c9 S$ T& L( ] - /*#define EDMA3_DEBUG*/
! y. |! F, _' y! j6 G# o9 l6 m
' |8 ~. z& y2 j3 Z6 S0 N- #ifdef EDMA3_DEBUG
8 i% b1 V6 D+ w5 G0 f, n, B2 t6 ^; l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' F I( Q9 E4 Y8 n7 H3 J/ i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 ^( p$ \* [7 T2 P3 n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( A- K$ }& x' x" m5 l
- #else4 H% a8 ~, M4 Z# i, a8 d7 A* k/ }
- #define DMA_PRINTK( x... )+ E/ P9 x* [6 T) @& Q0 N
- #define DMA_FN_IN: ~$ e4 ?0 W' p1 h. J5 j
- #define DMA_FN_OUT- K5 M* M5 P0 ?5 Q. m3 k
- #endif
' C: Z1 d8 S' c/ g9 S- D0 D1 D" y
% R0 _, [5 o" W+ T5 d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 ?$ Y/ v! s. `' ?/ E6 E
- #define STATIC_SHIFT 38 n$ v9 p x( s. E
- #define TCINTEN_SHIFT 20
t% h1 _, V) X: T7 B' Y - #define ITCINTEN_SHIFT 21
# ~ `: l/ b3 P; N - #define TCCHEN_SHIFT 22
8 l9 r2 h6 m$ n* ^+ |8 v) M - #define ITCCHEN_SHIFT 23; @- e( E, I: I
- x2 v0 A, `/ v2 g8 P& N J# w% _- static volatile int irqraised1 = 0;
+ J3 ~( F$ ^. c L7 q. D2 h2 U6 j - static volatile int irqraised2 = 0;
6 y: I5 x, v/ e$ o+ { - 7 ?. \( X r3 g( P1 d$ @! X& J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" b- Y1 X& z/ Y3 g4 `3 V. J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- f7 L* Q3 Y6 T3 S0 w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ u% f; _3 V; y
+ n6 u u9 a6 F# X% h4 X4 D- dma_addr_t dmaphyssrc1 = 0;
, {+ _1 A7 e. @+ A - dma_addr_t dmaphyssrc2 = 0;1 N2 k3 ^* b H8 ]
- dma_addr_t dmaphysdest1 = 0;
0 [% k0 J& r. S8 N) \9 V - dma_addr_t dmaphysdest2 = 0;' p2 H( I n& g& ]
9 k% L- z9 e; Q/ S- char *dmabufsrc1 = NULL;) j! `$ w$ y0 b% e7 w( P6 \
- char *dmabufsrc2 = NULL;% } ]6 c3 r4 l5 L" W
- char *dmabufdest1 = NULL;
. y$ m- x, G& M0 _8 R2 P) ] - char *dmabufdest2 = NULL;, y0 H( g* i' O" d2 x# R
- . T# s6 x0 R' w
- static int acnt = 512;
, `1 S+ p( j( ~- u9 R) T - static int bcnt = 8;5 L( l l2 u) q& N0 Z
- static int ccnt = 8;; @5 u& l' t& W* u* N# j
. e' {% J9 v6 I1 m8 u- v5 Z- module_param(acnt, int, S_IRUGO);
: k i" R9 X% ^! z6 Q - module_param(bcnt, int, S_IRUGO);
6 E5 a) e$ N6 s+ \) l/ ~6 D9 r - module_param(ccnt, int, S_IRUGO);
复制代码
( m9 N1 |! G( C" ^0 O0 F+ [; c$ J: j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: J1 u" o5 p5 }' |, U" Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 X9 r X9 J2 q& f6 i: T& p, t8 J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( M: b1 m3 |( k9 F) y9 Q
4 _1 r. _5 W0 x( d
# Q" y$ Q9 u$ e |
|