|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 q$ z D! y2 Q& C. K
- [code]EDMA sample test application E7 [7 G C, e# S( C8 V' q" w2 R
- /*+ O& ^: V3 r' X$ ]' q+ _. M. k
- * edma_test.c7 T1 ~' Q4 S) i4 M. d
- *9 M1 F# f* ~: L; g0 C3 o' F6 [# V1 }
- * brief EDMA3 Test Application5 Q5 a8 M! J$ z" u8 _& ?8 f R4 m
- *
I0 J$ C3 I& b: I d/ X - * This file contains EDMA3 Test code.+ R2 s! U+ Z8 W8 }: L/ | e* X
- *
2 a3 z8 U4 |# n, k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 \" o& E' f+ Z5 N0 l7 X& R: ^& h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 N1 ]" J9 J1 F" Z" O8 ~) E9 K! _ - * TO CHANGE.
2 m2 ]2 r; ?+ \ - *2 w# G- R& {2 t- z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( x5 w# Z5 R6 W% z5 v( q
- *
6 u& }3 s0 D5 k7 ?! b i' s - * This program is free software; you can redistribute it and/or# x0 @. R# e2 n t" h
- * modify it under the terms of the GNU General Public License as. o1 s e. {4 Z8 M
- * published by the Free Software Foundation version 2.
$ J* E8 u4 d9 r! a - *0 a- R0 [( b, I2 F( K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" _; t; W9 T6 M) h+ o q# @; t% A
- * kind, whether express or implied; without even the implied warranty% D. @; E8 d7 @) T' h' x: g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: _# `* d/ I1 }6 {( S9 K P
- * GNU General Public License for more details.# j5 E+ p! t$ c. r( n" T( V# ^
- */: W6 `8 k1 v% [5 P* s
1 ^! n8 P0 ^+ h) d2 D- #include <linux/module.h>2 d1 M" z/ Z( p2 C: n! Z
- #include <linux/init.h>
9 b' ~5 ~" Y0 T5 p - #include <linux/errno.h>
# l: A5 W8 U+ d* } - #include <linux/types.h>
6 F* s+ k( i* { - #include <linux/interrupt.h>
: J# @+ N! S5 X& t3 O - #include <asm/io.h>' Z( u: F( w( F
- #include <linux/moduleparam.h>* V5 @; z6 H: B' j
- #include <linux/sysctl.h>
4 f/ z4 @7 ?8 z" P7 {" n9 Y; P, T - #include <linux/mm.h>
/ F8 {, C! o: A, j6 g% {5 E* k - #include <linux/dma-mapping.h>
6 T" M' a5 o1 m4 N+ c9 y6 ], D' Y; _! ^
3 l7 s& j& K1 c! S% L% J- #include <mach/memory.h>9 K. _/ j+ T$ w# U) {! @% F
- #include <mach/hardware.h>+ `' U( d% K& e5 D" G
- #include <mach/irqs.h>
* N0 Q. f% p, w9 `; J h - #include <asm/hardware/edma.h>
% @9 l" P! _0 d" f6 P7 c - 1 m5 U# A* Y/ R, R/ q! o$ b
- #undef EDMA3_DEBUG4 w' ?/ c8 G) y4 D5 Z+ T
- /*#define EDMA3_DEBUG*/
* Q0 Q# S8 N- v: Z& M) P/ U3 n+ f' v; Z - + J. _. c- N- k* Z- @
- #ifdef EDMA3_DEBUG, |$ h6 t4 v, e3 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 l6 ?+ T* Q* K* n1 y! Q0 k9 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 Z& w! C! Y( t8 u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 f+ V9 T0 J' ? - #else' g/ O* i) k w* [
- #define DMA_PRINTK( x... )
2 b8 q8 I& ~9 I$ Z8 c( r - #define DMA_FN_IN6 X' p3 p& _. E+ b: q* B
- #define DMA_FN_OUT
3 {) U. y# n( s9 j2 V. h - #endif
4 F5 A% r- t, t0 [- m
* p8 W0 {' W1 t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ M2 g. ~" K$ c6 m; C - #define STATIC_SHIFT 3
- J& C3 w% r; W g - #define TCINTEN_SHIFT 20
0 _' M' v; r c3 ? - #define ITCINTEN_SHIFT 21
2 o, q9 Y7 Q) a - #define TCCHEN_SHIFT 22. @7 K5 Y- Z/ t+ o$ ]
- #define ITCCHEN_SHIFT 23
Z1 v7 K( M5 W- } m
! m4 b2 }4 S Y; U) x- static volatile int irqraised1 = 0;
1 D( @3 o* q7 e x" } - static volatile int irqraised2 = 0;. K9 t6 t. `; D, A6 ]9 u+ W7 E O
- B% h8 q% q4 r0 y+ b: Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# w! E1 Y, _" Z, z+ ~ i- X$ z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( B7 C' n! K7 K) @& I8 E1 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ w* J( D7 J# {9 t1 Y a" I" H
9 R2 \% z Z/ k7 ?7 l- dma_addr_t dmaphyssrc1 = 0;
) P _' Q4 H; X. Y: t6 _; Q6 O - dma_addr_t dmaphyssrc2 = 0;
) @9 V! f, ^( c' @, Z9 K - dma_addr_t dmaphysdest1 = 0;
% } z) M8 d# v9 ^# G* d - dma_addr_t dmaphysdest2 = 0;5 S# I6 o. b& T8 X7 D
- , q- x, a( V* p F" U6 j8 D$ k1 w
- char *dmabufsrc1 = NULL;. l5 k9 a* S6 t; |$ O5 h& a& g, g
- char *dmabufsrc2 = NULL;% k1 C, Y1 C0 o. I M( a6 s; j
- char *dmabufdest1 = NULL;
- u( Z5 @' e1 W9 r+ [' W- | - char *dmabufdest2 = NULL;
U( R+ M9 s0 k K8 O& I9 y9 y9 K- G+ Y
9 ^4 P$ D7 A6 R4 k# s& t& H; e- static int acnt = 512;
& t# X3 |( ]9 j+ p+ i+ H6 F+ k - static int bcnt = 8;
# A8 F* H1 I `8 a - static int ccnt = 8;0 a1 c3 u9 J& p- J" K
# B+ ?9 }) x$ z! k) f, }- module_param(acnt, int, S_IRUGO);8 {+ S5 }3 k. n& @" `6 ?7 a6 X
- module_param(bcnt, int, S_IRUGO);" i) P, i0 O! v& a: S# x. S, F, v/ Z: K. k
- module_param(ccnt, int, S_IRUGO);
复制代码 . y, s8 x0 n+ y8 q8 C! B `
$ S' S8 ?* V& H/ h6 ~; d4 b l! z! v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 M) [$ h7 }! ~4 c' Z8 o; V. @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. [/ V* j. N. a9 i S1 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 C1 [0 M; R6 _6 t8 b& x8 g* B$ H9 y5 w! Q
- w; Z+ F: [7 j" c |
|