|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 K) j( g4 R- }! V! d- f
- [code]EDMA sample test application( R8 Z( y2 p1 {+ p* u
- /*8 K; K+ w5 h* J; H. |
- * edma_test.c
4 g* F4 W1 g3 I6 a) Z3 D* ]. u - *$ o2 E7 Y) q: @
- * brief EDMA3 Test Application
0 \2 A' x' j6 e" O: B! D, t$ @ - *5 b" H" ^3 i3 C/ |1 ]
- * This file contains EDMA3 Test code.
' O* B8 i% N6 n. ]/ K - *0 G5 Y8 R5 o0 a$ ]* \! [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 y% T- y. S; n1 L* S# q0 A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! `6 Y K& f9 M# m( Z! x ?; z" K
- * TO CHANGE.0 T! \9 u9 e# j0 W5 s: y
- *
" f" O% ^3 l6 J$ a) S0 }/ ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) j: S1 n! l, o8 D3 c" _0 A - ** n; C6 G7 c7 v- A. G, k
- * This program is free software; you can redistribute it and/or( J* s1 Y: n5 n& t- V
- * modify it under the terms of the GNU General Public License as
' `- d& p& t) `. U" H - * published by the Free Software Foundation version 2.) Q# s( ~/ F) W& n3 A- \# T' N
- *
# y- ?) f: d: s# b7 Q: a. t: z' J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# ~7 A/ C9 P, T% b: A4 C - * kind, whether express or implied; without even the implied warranty7 c4 [ b. ], |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 c. p+ [" j$ [ - * GNU General Public License for more details./ M( T- p- j# n3 O* z: f( X7 E
- */8 [% p6 O1 S1 C, N, g
- 0 N- j- e9 T' |! |3 f0 r, N$ A
- #include <linux/module.h>
! ]5 z0 F: ]+ }! ?9 y2 e, R f - #include <linux/init.h>
) r. s5 p" p- U6 X" I - #include <linux/errno.h>; a% n' ~- l9 S0 d) J% q8 G3 ?' z% ~6 }
- #include <linux/types.h>
! D. H; n& `5 I+ W! C9 Q# X - #include <linux/interrupt.h>- q- O2 A* j9 ]" z
- #include <asm/io.h>& P1 L: P) Y9 m3 ]
- #include <linux/moduleparam.h>
& x; U8 w8 ~9 L) } - #include <linux/sysctl.h>
. T L. E; Y8 w9 O3 r - #include <linux/mm.h>
2 t1 e9 g+ d6 S+ y2 K" _ - #include <linux/dma-mapping.h>7 _& w8 y/ p3 S6 j
1 V0 u2 |9 [- X- #include <mach/memory.h>
/ G; @: w9 s& Z/ t - #include <mach/hardware.h>
6 P9 I2 T! q. w - #include <mach/irqs.h>
1 X2 A) }5 o* r4 H9 k - #include <asm/hardware/edma.h>6 L8 S) E3 x" t
3 k Q0 R& F" ]' @! `: ~- #undef EDMA3_DEBUG
2 J* g- _# A, K! G% U; L: O. l - /*#define EDMA3_DEBUG*/
+ c& m: k$ X4 A& T. a$ l
' E: c, T: `: G2 s' P+ o2 }$ ~- #ifdef EDMA3_DEBUG
: X4 B: ~1 ]# c) a+ Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 Y( \. I9 {4 x. x, [6 ?) k. i2 B5 p5 R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( D1 @! y m7 l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 s$ x* @% a; z- U% _# u! Y" G
- #else
' N0 {4 R% z; U& ~4 [ \ k - #define DMA_PRINTK( x... )% l* z' Q3 F% @1 q; L% k! O
- #define DMA_FN_IN
( s+ ~' a+ S: G6 Z - #define DMA_FN_OUT
- t5 y! P: F( Q# p+ i - #endif) @. @% [( j" n% V
- ) c# C! ~& t- G* c5 a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& L2 I1 ~5 T$ q0 Q - #define STATIC_SHIFT 3
4 f9 g3 l+ w* _4 p W& A - #define TCINTEN_SHIFT 20
: V" Y# x5 z, @* R6 _' f - #define ITCINTEN_SHIFT 21: z: q9 i* y+ k( E( E
- #define TCCHEN_SHIFT 22 L2 N. \( Y5 E4 M+ [# x; H
- #define ITCCHEN_SHIFT 234 F D4 w ^9 Q' W% R
- # Y1 Q3 d$ @! G* J$ k3 I2 Z P
- static volatile int irqraised1 = 0;
0 V8 x1 j- P$ {0 A1 C/ A - static volatile int irqraised2 = 0;
* Y% o( o r' }) J3 o: E
# L; {3 k. H, X3 ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 d" r. S. k1 V: j: C0 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 m& B0 N" X3 }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 {, l) a4 o* w# C5 }/ b# o1 x
- & E7 [& i: ]0 h6 o) |) [
- dma_addr_t dmaphyssrc1 = 0;6 K3 V' k' k' B$ e3 c6 C+ m1 T
- dma_addr_t dmaphyssrc2 = 0;
$ [8 z1 _) L' l' k. ^. {+ ` - dma_addr_t dmaphysdest1 = 0;
7 x5 {- ]% A( w& u0 S - dma_addr_t dmaphysdest2 = 0;' h* \( r- V! `* Y: g' V" O6 h; \
6 V! f6 B/ X4 ?5 ]' @) n- char *dmabufsrc1 = NULL;% f# S, l, {" ]9 A6 S2 ~" L
- char *dmabufsrc2 = NULL;' n7 E0 X7 ?6 j1 ?/ G3 @ g2 ~
- char *dmabufdest1 = NULL;
1 c) B+ g3 g# q- B - char *dmabufdest2 = NULL;( ~7 @8 Y% @0 Q( o+ G8 ?5 ?
* [ r0 @5 T* L* L# l+ h2 B- static int acnt = 512;" q6 \8 K6 B \6 X9 Q7 I+ I, E
- static int bcnt = 8;
8 B Q6 W7 [: x) Z! m6 Z5 G& T; p! X - static int ccnt = 8;
9 O6 y' u9 ~$ V6 y- O, f# D) N% U6 u - " f6 r3 a% R3 d( l3 b3 U
- module_param(acnt, int, S_IRUGO);! h7 j- ^7 r( e
- module_param(bcnt, int, S_IRUGO);0 a' l1 i3 O9 ~
- module_param(ccnt, int, S_IRUGO);
复制代码
; p9 `( U2 d l+ W0 S6 E
8 K. a2 C$ E; s$ u" Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ E5 U% |( i8 A" b H
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 j9 g4 O9 ~4 B; j+ E9 W4 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 F! O2 [2 t Y5 H' x
" J6 B% v0 z* K8 X( m
3 C' A& @ C e' ^. s |
|