|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" z8 t; p+ V j, @- [code]EDMA sample test application' n# Q3 F4 z2 f3 n& o) X+ U
- /*
0 k& Q$ m- X/ `" U9 O- K; a5 N: ~6 \ - * edma_test.c9 t! @! l8 N" |% h, X; f' u
- *, z* }( @% z! H! Q0 @( X1 w
- * brief EDMA3 Test Application. B8 D& W9 N5 D
- *& f% d- W4 r5 l/ k0 h- O& \1 Q7 \
- * This file contains EDMA3 Test code.
, f( R7 g0 [4 B& ]! f+ T - *
) S5 }8 |6 N9 Z- S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: K( ?2 U8 u0 L: t a0 T e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" ^& ^+ M( O& ? j. v - * TO CHANGE.
- c, S- b9 ^9 n& T* W - *! K! f0 X7 b9 Z" Q$ }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' l" e) o- o2 D N - *
( {- b1 ^' P6 y2 Y - * This program is free software; you can redistribute it and/or/ n7 T* d' }4 {# f' d& E8 w
- * modify it under the terms of the GNU General Public License as9 T' S! K4 R# B B* X" S
- * published by the Free Software Foundation version 2.7 {* y3 \; U# H. V
- *9 k7 @+ m& D- M) U7 V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 v# e3 Y* p. _, j, D - * kind, whether express or implied; without even the implied warranty
* V n3 q' s1 d! _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ }: q, |; V4 L0 E G9 H - * GNU General Public License for more details.
4 C& e ~5 l5 g+ o6 Z: a - */
& B. `' \ H1 u4 r9 E" I
2 D. o6 Y+ q- p, z8 n, O- #include <linux/module.h>
$ |: K/ V4 |& c - #include <linux/init.h># D6 b5 P0 v. Y; g5 M1 u
- #include <linux/errno.h>
4 {1 Q4 ]7 ?7 `1 f* h% V - #include <linux/types.h>: p! G5 T) o- w/ ^, T- b
- #include <linux/interrupt.h>
9 Z0 \, a) e6 r - #include <asm/io.h>- w5 ]1 `- w" Q# R7 z3 H
- #include <linux/moduleparam.h>
+ V% e( w) x9 S i. T - #include <linux/sysctl.h># i5 _5 @( g( s" o1 H9 g
- #include <linux/mm.h>
+ g6 h# [" y9 c3 G8 y - #include <linux/dma-mapping.h>
9 J j( }' n& M9 ]' ^6 [
1 f4 S, l: e8 q- #include <mach/memory.h>
$ Y4 _' w& G$ i, T2 o Q7 j( @/ B - #include <mach/hardware.h># ] I+ d8 W' [; O! e. e
- #include <mach/irqs.h>+ j: @5 h9 j# [4 Y" P
- #include <asm/hardware/edma.h>
; K; b. B, j; N7 ]" U" _
7 \* k# [: O# ~8 O9 [- #undef EDMA3_DEBUG' \& |3 V, P$ l0 p( I
- /*#define EDMA3_DEBUG*/
( G2 }; i7 A6 S: D, D* l6 F - 2 p+ X \/ ?2 E% i, L9 y
- #ifdef EDMA3_DEBUG5 V+ L8 \0 [1 R- c2 i/ O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 D3 W1 z- U3 Z" R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 R3 }# H1 p. I1 W& r& k9 t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ U7 T8 a, ?6 o# v+ } - #else+ q0 L# j5 C5 n1 U0 \+ l' |
- #define DMA_PRINTK( x... )
- ~* ?8 ~2 c7 \- j! c( ]- X, u - #define DMA_FN_IN
$ \/ p& u" `! f2 a$ O. B4 N) ?( f; a$ S - #define DMA_FN_OUT
& v8 B* {9 n2 _9 r" W9 _ l, _ - #endif5 b! Y' j K0 Y# q
- \& [4 s& h) ^2 W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& I9 I# D: S' N4 D; @) z% j& q+ {7 u
- #define STATIC_SHIFT 3
8 {. U7 t9 T' `9 |& J - #define TCINTEN_SHIFT 20. j! t6 g- W! \, t
- #define ITCINTEN_SHIFT 21, z( n; {7 N9 _4 x3 V. i& J
- #define TCCHEN_SHIFT 22
; M0 g9 l* P+ c. e$ Y - #define ITCCHEN_SHIFT 23* {' G: E1 k' l+ W% S$ C
- 6 l* g6 d' Q; d' L$ |: P, y) }0 X" m
- static volatile int irqraised1 = 0;
/ K1 W& S2 d" @' ?) m - static volatile int irqraised2 = 0;
4 E1 z2 `0 [. t2 H1 b n2 P - 5 y- c3 L4 @" `/ a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& t1 i, v0 J+ q7 ^( W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, k" H4 d. Q! h0 p7 X9 G) Q& I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ]4 C0 V8 a& K4 s% J
, P# N L% X9 n- dma_addr_t dmaphyssrc1 = 0;8 s4 m! b, M% E/ Z9 V
- dma_addr_t dmaphyssrc2 = 0;6 U+ S# k6 U+ I( n
- dma_addr_t dmaphysdest1 = 0;
: u) C% J& ]! `. d- e - dma_addr_t dmaphysdest2 = 0;6 ?) `# F8 V# r7 F: U% M
6 z( H+ d4 H. W7 [. K- char *dmabufsrc1 = NULL; T( {1 P9 N' _" Q x+ A: N
- char *dmabufsrc2 = NULL;
, M1 v; [& ~) S - char *dmabufdest1 = NULL;8 o- g9 S" b2 t) }! b
- char *dmabufdest2 = NULL;9 S( {2 l% b i
" Z2 f" k% n2 k- static int acnt = 512;
1 s$ b+ g W* a0 H W* W k/ c - static int bcnt = 8;
4 ?5 U. K6 B) c" _7 W/ z - static int ccnt = 8;
- }" E9 r' d2 ^! z - ; s9 D j. v+ X$ V4 q( e/ P: t
- module_param(acnt, int, S_IRUGO);
# r* i/ e; l- U. m m - module_param(bcnt, int, S_IRUGO);
# a# ^& ] J3 s% a - module_param(ccnt, int, S_IRUGO);
复制代码
: H+ G5 t9 L! l( u3 G* ^. A% O- d# o* \/ S3 t, @2 _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, H4 L! K+ _) `4 t* A3 C$ I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 L/ E3 N( q# }8 Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* D: x7 b% |9 m5 r" r
1 i) j- U% w+ f S0 c7 n N, W
( ~% a8 ~9 {) B3 k. @8 q' B. ? |
|