|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
p6 F3 B/ U3 C" U3 \- [code]EDMA sample test application
; K q/ g S7 b - /*& I- {' l4 i3 \- @. [* L
- * edma_test.c
) f. ?- K* B' I, \$ K- I1 j - *
7 n7 e+ r1 W9 ]5 X- Z - * brief EDMA3 Test Application- Z2 z1 J/ ]* }. ^, ?& A3 z
- * k" D2 p% q& P) h
- * This file contains EDMA3 Test code.! K2 w5 F; i. k9 }
- *
. B1 K2 e+ b% U2 P6 y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE K$ m- s& }% G' H, a% w. m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT r: H2 X# r( Q: z3 u
- * TO CHANGE.
3 G- ] A0 W! q - *
" E/ t" b5 D: M- S+ z& M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 V# [8 m- T4 Z+ {+ G. [& q8 k& v
- *
/ g, A8 J5 @, G& h - * This program is free software; you can redistribute it and/or
9 D/ l/ l. i2 Z5 _$ g5 ? - * modify it under the terms of the GNU General Public License as% G3 }' z/ L2 K
- * published by the Free Software Foundation version 2.
9 l* o1 C$ c; ^# B& W - *: J9 [' R( V! r( G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! b3 S. M3 I7 d
- * kind, whether express or implied; without even the implied warranty6 U, A- L4 r& P5 r% W( P) ]3 N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 N* F6 [$ Q$ T. B& I# Z - * GNU General Public License for more details.
. a/ L2 C' p; @1 N$ a - */
6 M) T8 o# h% k: f5 f4 W/ q. A/ Z - ) p9 s7 H# t K3 U, _* ~( O4 t! n
- #include <linux/module.h>
v! D1 `" ^3 N1 K - #include <linux/init.h>3 l6 M6 s+ u- c& F8 [
- #include <linux/errno.h>
& L% l0 U6 N+ S2 \ Z& t - #include <linux/types.h>
( W9 U0 h5 b- k* k1 L h6 o - #include <linux/interrupt.h>
: m/ O5 g* a) X# h9 i8 c - #include <asm/io.h>
; c3 f3 i4 K o: R q- \5 ]3 `4 U - #include <linux/moduleparam.h>6 R" D# M$ b# W2 `
- #include <linux/sysctl.h>
! K% }# t, c/ B3 J p3 n$ M - #include <linux/mm.h>
2 k/ Y2 b' R, ]2 y3 Y8 P i3 O( m - #include <linux/dma-mapping.h>
8 A# _9 \, S. L3 M2 g7 c1 F- C - 0 H' Q% b$ w, Z6 u! t* V( x% d- q
- #include <mach/memory.h>
( W% P* @; F$ m8 z7 n# r - #include <mach/hardware.h>
3 e1 W; u# F* O( T3 V) H - #include <mach/irqs.h>4 a; o# x0 \3 e% A* z0 h( C
- #include <asm/hardware/edma.h>( v9 N& p& |2 T$ P, e7 L& a; D- @! R
- 5 _" l9 z) H3 K8 r
- #undef EDMA3_DEBUG7 _3 W7 r5 r4 N2 I; Q& f
- /*#define EDMA3_DEBUG*/8 Y3 M( i$ m" f/ m r
. w% P3 ?, n0 X3 V: K* L% @% v" m- #ifdef EDMA3_DEBUG8 Q; v0 k9 h2 d) o6 N. w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# `) c F( O; k' L5 G, d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 D, J9 g$ @9 h" s: c( S$ g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" m. M7 U4 a- u
- #else
4 V0 S2 L% |# V2 b+ W - #define DMA_PRINTK( x... )
0 g; b8 c+ A9 w% o5 B+ C, N - #define DMA_FN_IN
" z+ V: L" `$ b+ f; g5 X3 r/ _ - #define DMA_FN_OUT
9 D9 u8 ^. Q4 [/ J7 T! t$ E" s - #endif5 x i4 I' y! E
- ; x }, B# @& q2 N/ H) X. m2 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ M' X5 X1 }6 E/ o - #define STATIC_SHIFT 3
; O. U2 b, ]; R1 f+ I - #define TCINTEN_SHIFT 20
- O2 J$ L$ P v; H - #define ITCINTEN_SHIFT 211 o, D; w& i. {3 D
- #define TCCHEN_SHIFT 22
: N" k5 ?/ t8 {9 t9 n9 Q" Y - #define ITCCHEN_SHIFT 23) x& Q7 m6 ~( e5 C7 w( k" V4 ^
& c6 Y! [5 A* U5 _* _8 U6 G" m: a- static volatile int irqraised1 = 0;% d7 D& Q+ ?% ?4 l; {: a1 ^
- static volatile int irqraised2 = 0;* q# }' R$ w0 G8 F. x
9 b3 N; f4 \# r. ?8 @( _4 D# v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! e! r8 q. x/ k5 B: k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 e7 S4 P! B* E0 o$ e7 X( D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& k& g( d( C1 U- i9 y. s# P
- M/ }1 A' @( s% ^& B P- dma_addr_t dmaphyssrc1 = 0;
' X8 P( ]$ h6 a1 u - dma_addr_t dmaphyssrc2 = 0;. u7 f3 M% |- u5 A3 _* B$ T0 A& U
- dma_addr_t dmaphysdest1 = 0;
- M9 K- B0 O3 @- i9 J0 ^ - dma_addr_t dmaphysdest2 = 0;: H# D: ?, B ^4 _3 S
5 }" @. ?$ s7 c% B8 m* }" `- char *dmabufsrc1 = NULL;" Q2 P3 z2 J7 z6 W4 d
- char *dmabufsrc2 = NULL;
- ^6 o6 Q% p% a2 W' A9 |8 b- f - char *dmabufdest1 = NULL;" y, x& z! y! h/ h
- char *dmabufdest2 = NULL;
x/ b4 f1 \4 G7 S0 J- k - / b' o9 q0 @. _, `8 _7 J3 ]
- static int acnt = 512;2 }/ {- {4 v3 n! }
- static int bcnt = 8;0 k, O0 R& ]0 o+ Z
- static int ccnt = 8;; x. h( W* j1 _2 ~7 _/ Q, S$ s
1 t" q( \* V7 v4 ]/ [& k# v- module_param(acnt, int, S_IRUGO);1 _! p- S9 h8 L
- module_param(bcnt, int, S_IRUGO); x6 v5 q$ c4 F1 z: O) \9 M) N! g
- module_param(ccnt, int, S_IRUGO);
复制代码 ! Y6 h' P+ @" A
9 W0 S* k4 B/ V g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ @. u7 b& j6 Y/ Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
B+ z( S: \, z7 T- f, |+ j |3 X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! v9 H8 _2 b8 _! J; F
U' ]! f+ w' B' R# @
, ^6 e1 h, B& ~) u( N7 y. F |
|