|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 A. ~& X! O3 K- M! ^+ u8 B
- [code]EDMA sample test application; ~' _+ ?, \ v8 x6 F5 c; c+ |
- /*
: H b. X, n$ R2 L8 `5 q8 q% m/ ~ - * edma_test.c
9 \- |/ l* B# k1 |$ D: [ - *
/ a# j* V) Y& P2 S4 l0 S - * brief EDMA3 Test Application2 m" Y2 q" ` z5 c
- *# K( ?! j7 `! f/ N9 _
- * This file contains EDMA3 Test code.
( {+ j9 h$ ~. H# g' H6 q M - *$ K1 O- n% Y& \$ x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. R [* l$ ~' ]* f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 U% p/ o0 \, v# a" s! Y* L I8 J - * TO CHANGE.1 I. _2 ?; l# Y* J& D, g
- *
& @3 _ A& t0 J0 K6 L/ u3 b% Q5 b) V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ g# E2 T6 b+ [( J$ h - *
$ r1 V+ D Y+ M8 k) {! @+ D& `8 Q - * This program is free software; you can redistribute it and/or$ x0 p5 I% j; D( U/ }
- * modify it under the terms of the GNU General Public License as K6 H" C% Q2 u% s# A1 n
- * published by the Free Software Foundation version 2.
( g7 D- v! l1 E1 P g2 J& R5 X - *
' E9 t9 L% E! N: a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ \$ N! {9 z0 @1 O
- * kind, whether express or implied; without even the implied warranty
, j! U) \4 Z6 Z: K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ R, ?: `( a$ f u - * GNU General Public License for more details.% K' w) S: j, A
- */" B1 A2 K$ }7 G' J
- ( J4 A2 T$ \" @
- #include <linux/module.h>
/ I0 |. B$ _" ` X1 K% O8 y - #include <linux/init.h>' \# E4 _+ @7 K5 u/ I3 O: N
- #include <linux/errno.h>( Z, ^* \+ j+ ^* T4 A( Q
- #include <linux/types.h>* J7 }9 @! I5 z# _: F5 m
- #include <linux/interrupt.h>1 y& s, `6 C* h3 u9 I# a
- #include <asm/io.h>
: x. ^( w0 g7 {5 l) M5 f - #include <linux/moduleparam.h># z6 M6 T- ?7 s8 N
- #include <linux/sysctl.h>
# I4 J: L4 `. O/ j6 @2 Y - #include <linux/mm.h>
( a+ C: \ x$ J2 w. q6 R$ [5 n - #include <linux/dma-mapping.h>" G& V7 ^( {: ?$ `( p
- + M( [$ w: b, N1 K! ~8 o. M. N
- #include <mach/memory.h>
/ F' o# L. V, |* S+ I) i2 K - #include <mach/hardware.h>
1 g8 q) r+ S' l+ t - #include <mach/irqs.h>
& S3 { Z" k7 q8 R - #include <asm/hardware/edma.h>! S; x1 V5 m7 }1 a. P3 b4 Y$ Z
* W; }, n& T& y+ e) P2 H- #undef EDMA3_DEBUG' s2 t* I; B. H
- /*#define EDMA3_DEBUG*/
8 i+ a! i: ]0 V R2 }9 l" d - 3 _% k; O" D9 d
- #ifdef EDMA3_DEBUG, I: V* a' m- n8 W1 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& j0 z9 [$ u) D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); M" ?8 r+ V Y0 F' k( g9 W0 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 d" {+ \5 T* |$ e u1 X; y
- #else8 a2 P1 _1 {2 o1 ]9 w
- #define DMA_PRINTK( x... )* K: a0 T9 g; W
- #define DMA_FN_IN: m6 ~' d3 {( x
- #define DMA_FN_OUT. a" p$ C) N- t5 @6 x0 U$ h4 i
- #endif
7 d5 X( @$ O( e3 X5 H; \. p( S" @ - ( X0 m( M+ \0 o( _/ B- O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 \! P% `3 P3 p4 ^( O
- #define STATIC_SHIFT 3. K% k) A3 p, D; g0 Z% ?/ w
- #define TCINTEN_SHIFT 20
~3 J- D( _" l2 p# e4 G+ C - #define ITCINTEN_SHIFT 21
, E" h* u `8 {9 b, `" l - #define TCCHEN_SHIFT 226 Y, P, }. \; `& ? A& E ^+ C
- #define ITCCHEN_SHIFT 23, @- \* w4 M. a: l7 m; o
- R! H, Z9 [* d, [% Y- static volatile int irqraised1 = 0;/ ^9 p& f- j1 J! l, z' U, U
- static volatile int irqraised2 = 0;
, D/ e* ]- w* Q# C# R. |. e - 7 c/ ]4 o" u" x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) C' H4 J& q {0 r6 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S0 B& l1 {) n* |) A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' C! a' a0 N* P5 B p" Q
' _# k8 I( P, R9 J0 [- dma_addr_t dmaphyssrc1 = 0;
+ ~% K5 n# K. g' z/ i1 T - dma_addr_t dmaphyssrc2 = 0;
4 H6 i) e/ G7 @* S& r. s. j0 N$ R - dma_addr_t dmaphysdest1 = 0;( ?" g( m8 T, c2 e, m, G
- dma_addr_t dmaphysdest2 = 0;
4 E+ @0 F% E! f$ M! m% }8 g
4 g, u. E5 C ~3 j2 F- char *dmabufsrc1 = NULL;
5 W# a. Z3 p' G3 ^/ d! u; |" W - char *dmabufsrc2 = NULL;
8 l* ?7 @- R$ {4 m6 x( u/ a - char *dmabufdest1 = NULL;! }& k; u/ |7 ?* r; ^
- char *dmabufdest2 = NULL;$ F1 [! \2 N# Q) {7 ^
- * M: T5 s5 {; L4 @$ e
- static int acnt = 512;$ b5 J9 F6 w' l" V& ]: y
- static int bcnt = 8;- }8 W* {& Z5 z+ k& z1 G! N7 u
- static int ccnt = 8;
, r3 B. P8 w& |) i - . H4 u0 y c% m, F( J3 B
- module_param(acnt, int, S_IRUGO);
% m' w1 Q, T+ m' C- w& d: `& I* n - module_param(bcnt, int, S_IRUGO);
" i1 E- z* b$ s( ]# W* S8 e# J - module_param(ccnt, int, S_IRUGO);
复制代码
3 e* N/ |% j' H+ n5 t \) ~& a# ]# t7 O- y h: P* F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# g# K( Z% y. ]* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' L& c* M* k. f/ q# s3 @* z' d W Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) D% c: c* J9 O+ |2 Z) ?4 U0 P/ I% M9 b6 i' c1 F
! `2 [' _4 V4 F U0 v7 ~4 ~
|
|