|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 A( T4 \0 e! b( P; z
- [code]EDMA sample test application
; F6 k% p9 G2 o2 j# w( o/ |& G - /*
% H: V. n* R( F1 u- Y - * edma_test.c; ~: ~/ J- o4 _: ?/ E) U) [
- *
. `! I5 F& ]/ U! `* a) {% h. ] - * brief EDMA3 Test Application
! l( v* p @4 v - *: \' @& V; O" U
- * This file contains EDMA3 Test code.
+ `) h4 v# W6 M, t+ { - *. ~5 p |* ^/ u1 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- j. n9 j3 @- v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 ]: E( F4 W+ O' _$ g4 E - * TO CHANGE.
6 N# U. ~' f1 E0 O! {3 R9 W - *
% I- z' J7 }( S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ O9 F' W) o0 a5 S - *
5 q* X/ b# G) @9 Z* n6 u - * This program is free software; you can redistribute it and/or
( | j% a$ A( Y/ ]* _5 M - * modify it under the terms of the GNU General Public License as' `) J! O" {2 R6 T: l
- * published by the Free Software Foundation version 2./ ?. p' B$ n# t& S& I/ F# d6 W+ T& [
- *
7 V0 K. Q+ ]) W F& e: N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 e9 W8 f" M- M$ \" {9 }- }2 P U( J; G - * kind, whether express or implied; without even the implied warranty! @% n7 o$ I1 f) N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# B7 c! n2 V3 f7 D+ i7 k* J - * GNU General Public License for more details.
8 e- j U) c; S - */
$ Y( K+ h6 @* H9 n; u4 l, L - " M( G2 `/ j& E u2 b
- #include <linux/module.h>. e: K8 w0 @% @3 n
- #include <linux/init.h>
$ I7 U* H- B" S" f: Q* s - #include <linux/errno.h>5 @/ P; j, z$ G% F
- #include <linux/types.h>
; Q9 q' a( c! n, R7 I - #include <linux/interrupt.h>
1 ]; ], @3 m! b, Y+ | - #include <asm/io.h>9 p: a5 a/ M, A* k) ~9 W6 ~
- #include <linux/moduleparam.h>8 \# O# t! [' s( \, R
- #include <linux/sysctl.h>) X- h s. B3 F0 M' ~8 W; \. H
- #include <linux/mm.h>
+ I$ j. G0 Z, `' h3 _ - #include <linux/dma-mapping.h>( s2 T* \7 a5 `- @- F
2 L/ V, h% n5 m* ?0 K c- #include <mach/memory.h>
+ ^; N. M; Y t# n' v - #include <mach/hardware.h># m7 f" d. }0 _# O! w
- #include <mach/irqs.h>
! W6 Q) M9 d% ]% R - #include <asm/hardware/edma.h>! b4 @: P$ p2 `( X& e
. \" b: M/ I% d0 |- #undef EDMA3_DEBUG7 |: J0 `! \6 D5 c# u
- /*#define EDMA3_DEBUG*/9 a% X& G X' u* J1 _% M" T
- - ^# G. ?4 P. v5 M0 ~
- #ifdef EDMA3_DEBUG
1 R' Q6 [% w; M& ]4 A2 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- `# {$ X3 G0 `# u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& w# T$ ^" v7 v( u1 r/ x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 Y- \" J2 N: L! o- v3 @! h
- #else# F6 V- g7 |* X; y9 l
- #define DMA_PRINTK( x... )* E& |0 i& {+ c- m! u' [
- #define DMA_FN_IN" k' N2 x' O. y ~ R
- #define DMA_FN_OUT
9 V0 E& s. i% N( T1 w6 A! _; |" { - #endif I* h$ o& \: J4 N5 P: J8 `0 H
8 K/ o# Z0 D0 ^ [1 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# u$ k& M k" x6 Q9 z. p- G
- #define STATIC_SHIFT 3
7 |; L; U( c; W1 v - #define TCINTEN_SHIFT 20
) z; s. r) l1 I. j. I: U5 P - #define ITCINTEN_SHIFT 219 c% d4 i# g6 a
- #define TCCHEN_SHIFT 22
& S, m0 e k* R5 @5 W8 ]5 r - #define ITCCHEN_SHIFT 23
0 O( ?' T o$ b) `3 g& o+ W! {4 F
5 `, ?5 W- P% V% N- static volatile int irqraised1 = 0;
! ^- N2 f1 a) }7 H9 e3 Y/ A - static volatile int irqraised2 = 0;7 q% ]% W) U* h% E: X6 e: H
- , }! L/ r; P! @' U% m5 v6 u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 \: p, ?0 T$ p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 m1 Y# V( o7 Z" N6 Z6 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# o+ r1 b, X- ^ - 1 v2 j3 j6 |; w. Y% _
- dma_addr_t dmaphyssrc1 = 0;
6 I4 Z. t3 o% w, E# y y( U" v - dma_addr_t dmaphyssrc2 = 0;) Y$ l/ J# h! u& |. Y* L
- dma_addr_t dmaphysdest1 = 0;
! }- B$ n+ L" ? c. }& T" { - dma_addr_t dmaphysdest2 = 0;9 c1 P7 P. @1 s! p
/ }% e- H1 }# u- char *dmabufsrc1 = NULL;( @5 O! o5 H- }
- char *dmabufsrc2 = NULL;- H2 C" k4 H+ g8 I+ }
- char *dmabufdest1 = NULL;
/ U; c. S2 E6 e! w; S, f) c( v - char *dmabufdest2 = NULL;% M- ]% L1 |; r7 a2 q
- - P7 F- L; \& _4 b$ e3 @7 u
- static int acnt = 512;
2 n- H. Z& A$ J1 c1 l - static int bcnt = 8;
# b$ y; c9 b' q/ u7 A" m4 r+ k - static int ccnt = 8; s" s& t+ z2 w2 Z+ w7 N
( x4 i* ]6 \& R- K, w- module_param(acnt, int, S_IRUGO);7 E, [# T. |. L& R! Y: X
- module_param(bcnt, int, S_IRUGO);- P) e. h! v7 |5 C# V- x. t
- module_param(ccnt, int, S_IRUGO);
复制代码 " y: _6 V. x- D4 V) u2 I: i; G' W
3 M' o7 m, l0 o3 K/ g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ ?% ?4 b* f5 y3 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( j+ [1 H; T5 i4 @7 b$ y: ^" g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 `3 W+ x9 c' a2 B% w, K7 p3 b5 n! m1 D
& T5 E% R4 x2 E2 s0 `
|
|