|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ^8 i2 @: j! _( p9 M
- [code]EDMA sample test application9 x* x- _) F6 S1 x) B; ]
- /*
5 [' ~% G( p" t - * edma_test.c, I, s1 v7 X/ z1 m" e
- *: w( u' E5 j1 F f" R0 e
- * brief EDMA3 Test Application: m; A" S% c: ~9 `: q
- *! l1 l' r7 `* [- C4 r
- * This file contains EDMA3 Test code.
) v. v3 Z% q) [+ z/ w. x7 ?& A - * d5 |. k# {$ C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ b0 r1 e4 ?3 W( |/ p0 Z7 ]9 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
Z) ~3 a! ~% p3 s& f/ f - * TO CHANGE.# s* [3 I4 D3 f4 }7 K
- *
( n! C y( \+ p% O) C u* q' D7 A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% j- L' ]: j) v) s* o - *8 M: k \% _ L! [7 c: U8 Z* I6 C9 I
- * This program is free software; you can redistribute it and/or% p. l' X) Z3 {/ a
- * modify it under the terms of the GNU General Public License as$ W2 u. u( @' E7 _8 _& W# y
- * published by the Free Software Foundation version 2.
# Y. `, S0 J$ `) {" t. B2 h - *2 M0 l" K1 H' e5 E! p' x O1 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 V" Q9 X) z v- j8 R8 g! G
- * kind, whether express or implied; without even the implied warranty
& k& Z! A# J( N! | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 U* \ O9 u, B( e1 f - * GNU General Public License for more details.2 H2 h% b- a- t) w( n- q
- */. U; v9 Y/ k$ x$ S7 c* H
1 @6 M+ z% z# z8 P' Y9 O3 q) }; q- #include <linux/module.h>
% s! q+ `& X! H - #include <linux/init.h>2 h% Z7 {9 k' ~9 w! |9 `
- #include <linux/errno.h>' B/ o7 |% }! Q% ^, X* x! V
- #include <linux/types.h>3 a" t% ~/ q3 d% ~" I
- #include <linux/interrupt.h>8 i+ ~/ N" D: B6 }; w1 J; y( B
- #include <asm/io.h>
1 Q, V; G2 G0 d# T/ r% T - #include <linux/moduleparam.h>. V7 J# ]* V( R3 u. F
- #include <linux/sysctl.h>: M! _! V/ T2 T! V' k
- #include <linux/mm.h>
8 n8 E& S, t, h+ D+ x - #include <linux/dma-mapping.h>! s5 m3 x. S1 l; w
8 O: K2 L* K. t# a$ P, D- #include <mach/memory.h>% u4 B* s8 {2 X0 @
- #include <mach/hardware.h>$ r( l' F( U3 b& O/ x
- #include <mach/irqs.h>& N$ |3 |* N1 V' u
- #include <asm/hardware/edma.h>
! J: W) F- T) \& c0 ]
5 v. m8 H1 ` W# s( @$ [0 {- #undef EDMA3_DEBUG* _9 D1 D1 q7 P; J) R
- /*#define EDMA3_DEBUG*/# `) y6 t; \& F1 p! Q1 X. L( K* M; @
- 1 |( N8 z1 T' P2 g9 C. G
- #ifdef EDMA3_DEBUG
+ q( q3 s0 | i% l" x4 D) K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): k8 ^ F5 [/ G9 R2 \+ \5 {5 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 @# k6 v' `) F7 ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 G2 f8 z& q1 b
- #else- ~4 s. ~$ o: ~
- #define DMA_PRINTK( x... )
% G+ K' d2 ]' ~ - #define DMA_FN_IN
$ d) N3 Z e- ?2 c1 I2 B - #define DMA_FN_OUT( u2 p% Q: N. H
- #endif1 l- D, p& o% k* d8 @, b7 _
Z; O' P6 D' Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768). x* B, x( ^: \# ~! `
- #define STATIC_SHIFT 3; a$ q! p5 H6 P0 ^* N
- #define TCINTEN_SHIFT 20
5 x! q; E9 x& O' w& {. b% R- h - #define ITCINTEN_SHIFT 218 e$ E+ S( v' F5 h6 S
- #define TCCHEN_SHIFT 22
. }4 a8 g0 U; K$ J" x- d- ] - #define ITCCHEN_SHIFT 23
% S. }+ f% t! Q5 w9 d/ [5 l' {( z
: a& ]9 Y Y) n* w9 z# l) l c( m0 _- static volatile int irqraised1 = 0;
% G# Z# G4 L! K7 b v( e - static volatile int irqraised2 = 0;5 H9 z- T6 f% E
. N6 }: [' [% c; T V0 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* t) z4 w- x0 o \! f. t8 j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r, r8 i0 K- B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; M3 q O8 S* o# D& F/ W! D' {( F; c
8 x3 g# m* E9 p/ f7 e" L% S- dma_addr_t dmaphyssrc1 = 0;
) [4 P7 ~) \2 ~2 ?- J' Z, T - dma_addr_t dmaphyssrc2 = 0;" X; Q( Z: S$ |' l1 K' z
- dma_addr_t dmaphysdest1 = 0;- G4 E5 v8 p7 ], L8 }! c6 [
- dma_addr_t dmaphysdest2 = 0;2 O* m0 E4 a" R! r" w; @+ U9 h
- ' d) V( t7 ]0 G5 n( }' {( i. ?! w
- char *dmabufsrc1 = NULL;% X. R4 X& ^+ \
- char *dmabufsrc2 = NULL;
+ s! b4 C* ~, l% i. n2 F - char *dmabufdest1 = NULL;
% P7 A: m3 M4 s( V$ G - char *dmabufdest2 = NULL;
% {, A, D; w& f: i
( i6 T* X0 b5 a: H/ h# d- static int acnt = 512;; w8 ^3 N7 Y0 v' o1 R5 O \- B
- static int bcnt = 8;
6 ?/ z: @9 a3 ?: K/ n - static int ccnt = 8;; U% I; `$ E @0 m% G/ n
( O9 T Q7 ~6 B! K- module_param(acnt, int, S_IRUGO);
6 v* l1 H- ~) A* i+ c- O- E5 k6 x& G - module_param(bcnt, int, S_IRUGO);9 _" ]# i* M; v
- module_param(ccnt, int, S_IRUGO);
复制代码
9 z5 T0 `# I Y5 d( n: R: G8 C" T9 w) G4 I# J5 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ U# P% h6 q8 ~% r# Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 q8 B% ^9 Y1 N* q3 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) ]6 O8 I) g& j6 ]4 F/ M$ M2 E
* d* s1 j" u+ s: y* T3 X0 F4 |
# j! P( r* y# g" r9 ? |
|