|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * B N8 G# s; }2 q& R7 Q+ ^" @
- [code]EDMA sample test application5 {6 M6 x# V/ _+ b2 h, U% q) V4 D3 v5 g
- /*
* B% @4 E+ o, t% k - * edma_test.c }7 D* C4 G/ l9 W
- *3 W5 x: U- h6 ~* o/ w
- * brief EDMA3 Test Application( q# f+ B# @! B( k6 K7 }& m( _
- *& V D- v8 o; z
- * This file contains EDMA3 Test code.
/ q p2 n+ q( ^ - *
, G+ n4 m3 s3 _# j7 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
`: Z; F2 r9 Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) X8 V' a1 q2 w) Y+ w7 M4 U
- * TO CHANGE.3 Q7 v7 R6 T" Y7 z- D) V
- *
% @$ }. g9 K9 ^9 e+ E$ g( Z; K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" h( ]& ~) v$ V7 Q4 z( I - *
2 ?. ?+ u. m- N1 X+ d1 ^; \ - * This program is free software; you can redistribute it and/or
0 h& V8 v& i6 O# Z- C. ]# { - * modify it under the terms of the GNU General Public License as
+ ?) Q( j/ R* }8 y/ I7 V3 V0 A - * published by the Free Software Foundation version 2.: V( | a7 T/ j2 j/ G2 S
- *
' ?* |" A0 T( {' J( j& u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 z/ S1 V8 l. o8 M# d) _
- * kind, whether express or implied; without even the implied warranty
w8 k; B8 {6 _1 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- Y9 C( Z6 ~6 h& K1 r9 f
- * GNU General Public License for more details.- C3 w: O: t0 M } A1 m3 ]
- */# t& e5 w3 D7 T& |+ v& R7 e) c. T
- - y/ `6 s$ h r! f
- #include <linux/module.h>
9 w5 m- Q7 S6 F9 A0 X' Y - #include <linux/init.h>% D. ]4 r" J( u; } y
- #include <linux/errno.h>! }9 ?, E0 s C! _
- #include <linux/types.h>
, e1 R, r1 X) ~ - #include <linux/interrupt.h>
- c( R8 [$ S4 V1 G" I- r - #include <asm/io.h>
3 V3 s; B2 q. b& ^4 R5 Y- S* V. _: I - #include <linux/moduleparam.h>5 _' Y& g' E& ?+ p, y5 Z: j4 k
- #include <linux/sysctl.h>
4 l3 g/ l3 V$ w Z( l2 J' J - #include <linux/mm.h>( q9 R1 F1 ^( L; t$ ]
- #include <linux/dma-mapping.h>8 n# v+ ~# _& g1 [8 r, |, g) w
: G6 E4 a, _8 I- #include <mach/memory.h>
+ C% `& k( v8 L% L4 u# G: W - #include <mach/hardware.h>
4 f3 V0 _8 K- C- W$ I9 Z - #include <mach/irqs.h>
. @/ U- Q- t2 L3 v V - #include <asm/hardware/edma.h>3 c+ y. ?; V4 y) e7 N
% k" U" c$ i9 [2 \' t; E h- #undef EDMA3_DEBUG8 F2 O& a) @4 w6 Q$ w% H5 K
- /*#define EDMA3_DEBUG*/
6 h, K5 w2 A2 Q. R
# ~1 c5 W% |) x) S0 g/ I- #ifdef EDMA3_DEBUG2 x- D" D# ]* k3 B D1 R" r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& Z9 o* O! h7 M* D& j& S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) a+ J+ P$ l. A1 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 J8 {6 \1 ~ [7 B$ o - #else
5 F! t2 V/ M( s# D) M# E - #define DMA_PRINTK( x... )
4 Y' }$ ^2 }! z+ j/ F4 ^# r6 V! B' B - #define DMA_FN_IN3 ~3 B% u" t8 J0 o+ ~) s
- #define DMA_FN_OUT/ h: e2 Q' L/ u9 p" ]
- #endif
9 f" F3 i( N K6 N* v - - H4 J; J% t Q+ B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): u$ [; F$ L5 m; Q: C
- #define STATIC_SHIFT 3( Y$ O3 g/ Q4 c, b" t2 ^
- #define TCINTEN_SHIFT 20
1 P R2 \/ T& M9 X2 g - #define ITCINTEN_SHIFT 21
" t7 t) M5 q# r5 @+ e! |: y; w - #define TCCHEN_SHIFT 22" }) w& S+ x6 |* o
- #define ITCCHEN_SHIFT 23
5 j8 H9 k" B3 G1 Z8 S; e2 E' h - % z- n+ h' h* U) F
- static volatile int irqraised1 = 0;
9 m! O! Y2 k# O2 v) q - static volatile int irqraised2 = 0;2 \) S8 w8 I; U, @
' W' ~) x6 A. w9 \4 c" w& n6 S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 v2 g8 b: l: p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ r- Z' ]& B+ J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [; U' B) r# p, m: {% M& U
- 0 H" S3 L# G' D/ E
- dma_addr_t dmaphyssrc1 = 0; y2 M [$ X# l& J
- dma_addr_t dmaphyssrc2 = 0;
; m6 V( q; C: y* y% A) Y9 j6 V - dma_addr_t dmaphysdest1 = 0;
1 j' `& |0 ]! g+ t* I - dma_addr_t dmaphysdest2 = 0;& b' s* i# z8 w* r% r
- & g6 s$ F, o8 D# M! V4 a% N
- char *dmabufsrc1 = NULL;
$ |; T" q' e+ `2 {" D! W+ C - char *dmabufsrc2 = NULL;+ @0 ?0 N$ Z4 b
- char *dmabufdest1 = NULL;$ s- |! m( L: \! B
- char *dmabufdest2 = NULL;
2 L( z/ V/ J0 y0 K( @ - 0 E0 q2 I# G/ Q/ b& d/ g
- static int acnt = 512;% D0 q9 N* R5 h# O
- static int bcnt = 8;! }5 C0 C d5 ~; g1 c
- static int ccnt = 8;; L# S" w- W' f& T; {
- 9 S$ E# o$ W* k+ @9 ^
- module_param(acnt, int, S_IRUGO);
. Y1 |8 K$ h( C/ ~ - module_param(bcnt, int, S_IRUGO);7 z! T0 q) G" s' x& y9 J6 h
- module_param(ccnt, int, S_IRUGO);
复制代码
+ f% p8 ~0 f0 v) T y) [6 B) h+ O& @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' l6 n+ P; L! D karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# \7 H2 ^. [7 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( F7 V2 B0 I9 V. g. L+ Q7 f! v- [
& w$ {* u; f$ j0 D9 { D
|
|