|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 ]2 b1 Q% \( S+ |- [code]EDMA sample test application
* ?* K* t# n5 g L9 b9 ] - /*& `( c" j- G. U9 V# Y0 e
- * edma_test.c# m# H, R% r! `+ ^8 Q- _$ [- V
- *
% `+ }% q a- A, a. @; R# q% [ - * brief EDMA3 Test Application
% O! ]0 U) P6 D' { - *
/ y& f2 G) \% r8 }$ E) x4 u7 G7 r - * This file contains EDMA3 Test code.
0 G" s9 b/ k3 S% d* I7 p4 G - *
+ m: J0 v. L- y, K- P6 P& [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 t8 t5 s Q* t$ T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 t/ }, p M W% j2 H# v - * TO CHANGE.7 ~, f2 _8 f/ }: G
- *: I8 O: w/ ~- s4 P) T: v) g) w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ t, i" x8 _6 q6 ^4 d# {
- *9 B Y( ^ S3 e$ e& j: w: K
- * This program is free software; you can redistribute it and/or$ [! L- U" `! \4 ^2 W D8 l9 H
- * modify it under the terms of the GNU General Public License as
/ Q" Y1 W# l5 n& z5 K - * published by the Free Software Foundation version 2.# ^5 v/ t, w, P0 H, \* Q
- *( E( g) R6 u6 o2 ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ X: X* }% g* [# o7 w! N - * kind, whether express or implied; without even the implied warranty) Y( k0 F$ \& S9 U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the q$ @1 |* L. a( I- T. J6 i/ |
- * GNU General Public License for more details.
- S4 x/ L- T( }$ X; H9 j - */- u. T4 D- p7 d0 r% B8 T/ b" D
- ( g& t8 g% X2 u' j- n! s
- #include <linux/module.h>; m5 [& ]5 ], s" P2 d9 z" s
- #include <linux/init.h>4 X5 u+ W+ i x2 R
- #include <linux/errno.h>
/ a" h+ A# `1 W1 G' w1 Z) v) p - #include <linux/types.h>' o2 A' U Q$ F' G
- #include <linux/interrupt.h>! F6 K6 d7 |$ ^6 ?7 j
- #include <asm/io.h>
# Y3 o: I" ? ]/ n/ _+ o; a - #include <linux/moduleparam.h>% y: b* j' V8 } e% @; _) V
- #include <linux/sysctl.h>
0 @! k q$ J8 c4 Z: p - #include <linux/mm.h>
/ W' f0 O& u: u4 S( O& [ - #include <linux/dma-mapping.h>
2 k( w- p! o- C/ }. |
7 F' d9 x, g7 s4 d5 V: ?- #include <mach/memory.h>
% E) p4 I, p# n6 _ - #include <mach/hardware.h>" g# U6 |; W; B( z2 x
- #include <mach/irqs.h>
' U2 ]: s! U% R7 M3 H% ~ - #include <asm/hardware/edma.h>) }4 Z# B9 a) L; v) V1 W& m. C- q
: Y, X0 K/ A. I, e4 y; f$ @- #undef EDMA3_DEBUG
1 @/ h. B$ n( @- z - /*#define EDMA3_DEBUG*/. p, E9 m) j2 O5 k
- ; K: @1 U' C) @
- #ifdef EDMA3_DEBUG
! [3 O$ Z# M1 P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), K& f+ D$ W; {8 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: E+ c( }4 \3 W4 m6 Y2 B K, n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" v l/ B# [9 m) t
- #else
+ R; v6 Z* q2 l) ^- a/ A - #define DMA_PRINTK( x... )' T0 m' Y4 f8 `! b8 ]
- #define DMA_FN_IN$ I/ b1 j, \3 i. u# p- E
- #define DMA_FN_OUT: O: }. |% V9 r/ D
- #endif! I4 N4 V* G/ g [2 E! t* v
- & t" R. Q# O4 E f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 E( f i+ @9 p+ o. L& { - #define STATIC_SHIFT 35 K+ Y! Y. n @$ d+ }5 |+ p+ V8 Y
- #define TCINTEN_SHIFT 20
! W- J; z: J' T! r - #define ITCINTEN_SHIFT 21" W% b( v# h' C5 |
- #define TCCHEN_SHIFT 22
* `1 N; h( K0 W% u3 @ - #define ITCCHEN_SHIFT 23
0 y, c% v1 y) v$ [7 h) K - / ] r7 ~: ?/ [8 V& w
- static volatile int irqraised1 = 0;% u. h1 C" x! f& {
- static volatile int irqraised2 = 0; N4 P- d/ n$ Z$ z+ a' L9 W
- / u4 {" t, H1 ], o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# d( ?. S0 F& c( a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 M- ?4 F# p! I* `. N+ ~4 d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! V- s* s6 A/ W1 j, U8 N( c' R& T - 8 J2 t4 | r, @4 S: J t) V
- dma_addr_t dmaphyssrc1 = 0;
- g v" q% _7 c! a, T* Q - dma_addr_t dmaphyssrc2 = 0;
* [& H& p0 x1 U& g9 d - dma_addr_t dmaphysdest1 = 0;6 D2 \: e7 p+ P9 i! S+ ?
- dma_addr_t dmaphysdest2 = 0;
0 t7 h* I& @: e) T
# H e ?9 x* n3 O- char *dmabufsrc1 = NULL;
* T) Y0 G) e: M - char *dmabufsrc2 = NULL;6 b5 d" J; x+ |8 H4 y+ \+ M! e, R
- char *dmabufdest1 = NULL;
C! h0 U& Z: N; e v - char *dmabufdest2 = NULL;
) p; V4 q7 ]( ^3 l5 j) H& f - ' v7 f, V8 f" ]- g3 w
- static int acnt = 512;/ O( d1 C1 n4 ]1 J# f% Y: O
- static int bcnt = 8;2 F, b( A1 _2 o- C, P
- static int ccnt = 8;! S- k4 W- w4 n/ M- v
6 t2 K% w( k! w1 j8 Z( h% r, W- module_param(acnt, int, S_IRUGO);
+ e/ a' x# k/ D! Z2 T+ J% U - module_param(bcnt, int, S_IRUGO);4 \: G. q: M5 e
- module_param(ccnt, int, S_IRUGO);
复制代码 ! R. `3 O. t( F
) f$ P0 h# f* U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* y. m/ v8 l1 j/ [2 J& l8 Marm-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 g8 D! `8 u8 |7 U2 U w- Z. d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
`: R. T7 u% v% z8 O: w( ^
" o) m, s P/ }" R% u% N! Y4 T! p- n( D- w
|
|