|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) }+ _( l% b! x
- [code]EDMA sample test application
. M$ s% H1 R& g8 q3 H3 E6 L - /*
! F, S* R9 P( U# Q0 U9 j: E - * edma_test.c4 F9 H4 ]. _* X: o
- *
% c6 \2 n3 m2 b! K; u - * brief EDMA3 Test Application
1 r1 V7 T! }% y4 ^* S. \ - *
* x J( z/ x( }! L+ E+ @3 b - * This file contains EDMA3 Test code.
% l7 p3 Y$ o: P9 ~1 I, |$ r - *8 ^4 | L$ V% H. H5 S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# Z& U' X, m7 D4 M! R W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* p, e# K+ f: ]" x: T, k - * TO CHANGE.
7 P& _; H/ G% F, t! s, g4 F0 V - *
3 U* o/ a5 Y! W0 Y% n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, E) Q4 e8 o7 E
- *
9 Z+ O( K8 U* {6 {! U9 D - * This program is free software; you can redistribute it and/or
# t( p m/ E9 } - * modify it under the terms of the GNU General Public License as
h7 k( `2 m1 f3 u" C - * published by the Free Software Foundation version 2.+ ?" r+ T7 u- X8 E$ u3 Y7 O }
- ** h* D& [ D {8 D3 G% F2 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any X; B1 z K9 h& V4 y
- * kind, whether express or implied; without even the implied warranty8 a- J$ ]6 C" G- P2 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, \: E( R4 j) u* g% [+ c
- * GNU General Public License for more details.% }! P8 u, l7 [4 g; M- ?1 g1 E
- */
% w S P8 o4 U - X: Y b' t! i. f
- #include <linux/module.h>
( N0 s- G2 |3 W - #include <linux/init.h>$ X7 i6 C5 m7 s/ {( F* q
- #include <linux/errno.h>
" g6 r3 Y. p" v. ~. o3 { - #include <linux/types.h>
: p4 N7 Z3 w5 l. ` - #include <linux/interrupt.h>- E5 b5 y8 f' S* r6 q7 F/ h2 Q
- #include <asm/io.h>1 U% C# x8 x5 z4 I
- #include <linux/moduleparam.h>
@( Z6 G! M% E$ Y4 [9 x - #include <linux/sysctl.h>
- @0 a; T4 I2 `$ K - #include <linux/mm.h>
7 \3 ^( N/ }& Q% x, y6 }, r1 ^ - #include <linux/dma-mapping.h>6 M1 e6 l; l1 c6 {+ h/ E
- 9 l E# V' K1 @6 G. N# ^+ R8 t" a+ N
- #include <mach/memory.h>
; {, q h7 o6 l' ? - #include <mach/hardware.h>
% M+ f) s8 {9 a5 ]" x- G3 h - #include <mach/irqs.h>4 }8 \& R: o& G6 u3 I. ?' Y ^- }
- #include <asm/hardware/edma.h>
V4 e# q y( c" @3 G
' k4 H" q: X8 w( V: A- #undef EDMA3_DEBUG
; w2 @5 K7 m, x - /*#define EDMA3_DEBUG*/) \& u% V* i7 c4 u
- ; b1 f X' a2 R7 U, ]6 ~
- #ifdef EDMA3_DEBUG
! u j# a/ V* D2 _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' c7 @, r, ?+ E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: t& Z9 [: I- H! g' l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- @1 H6 ]1 Y+ i8 x D; ^! V
- #else9 ?4 t" f/ m+ [" {
- #define DMA_PRINTK( x... )9 V+ e: T3 A& |; U( v; t
- #define DMA_FN_IN7 m3 g& h0 u* E8 _
- #define DMA_FN_OUT2 {( r5 S% n9 E
- #endif Y8 z2 M4 J3 M9 z
d$ M% o3 G% d R7 u7 |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 i( ^' W3 n! T2 B* D1 p2 H
- #define STATIC_SHIFT 39 u, k: K/ I& _* S" U( g
- #define TCINTEN_SHIFT 20
p. D8 G8 a9 `6 d; W) y$ s" p - #define ITCINTEN_SHIFT 21: Q' a. c6 ]& `4 ^ @
- #define TCCHEN_SHIFT 22$ w4 T0 w: W% ~5 F2 `
- #define ITCCHEN_SHIFT 233 a, m: g9 f5 I6 n
! T' Y- A3 n/ [; H0 H; n- static volatile int irqraised1 = 0;: q% M# s. p0 e0 l/ D1 \+ Y9 V
- static volatile int irqraised2 = 0;( T% j7 r- p, m+ N
- Z {$ \5 h: q0 [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); |( J2 h) [- o6 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 |6 A3 O# p# R3 i' ~% ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 F4 I2 B) I( Q0 _
- 2 F: A' g2 W2 j/ ]
- dma_addr_t dmaphyssrc1 = 0;
+ l. s U& z2 p( I, h) u - dma_addr_t dmaphyssrc2 = 0;$ e, M5 w) |. Z0 Z6 R
- dma_addr_t dmaphysdest1 = 0;
- r# J N0 v3 T# y3 p6 Q! E - dma_addr_t dmaphysdest2 = 0;, f7 y1 R' F; Y0 v; Q. o
3 F# o5 D- s1 S9 d. f! M: S- char *dmabufsrc1 = NULL;
) Z5 I; G$ @5 k! h. j& z+ T - char *dmabufsrc2 = NULL;
: _/ ^, f. H5 y& N8 G0 V) _" F1 R" X - char *dmabufdest1 = NULL;% g% f; W9 X9 d8 `, S1 T
- char *dmabufdest2 = NULL;: w5 j" [* ?; l E- S# P
9 Z E" M7 [! y0 x* N( N. k- static int acnt = 512;; G# W% P2 }+ s4 l3 }( P; i
- static int bcnt = 8;* [8 Z+ E+ b: w9 u
- static int ccnt = 8;7 u! {! u2 R" k* ], D$ D( F7 N
* O; E, E0 ?" n- module_param(acnt, int, S_IRUGO);
8 o p! X" m9 r7 z' q5 [$ O p+ D - module_param(bcnt, int, S_IRUGO);3 a2 O- \' v4 o( y: [
- module_param(ccnt, int, S_IRUGO);
复制代码
v" f/ a. N( l3 h7 i5 x2 ?/ A, t. ~6 h" M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- m0 @: d) ?! | carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( P2 t, z- c. r$ J* } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) |7 L; r2 g. W: b7 j
5 x4 b: N( r" z: N! P( o
' ]& N+ A) X- x/ r! ]2 Z
|
|