|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ R7 U1 D$ A4 ]- [code]EDMA sample test application. D1 z6 G" \& ?* F
- /*6 s" l6 f4 `( |# ?
- * edma_test.c! @( v; T1 u& }
- *
' _6 t% e& i. W - * brief EDMA3 Test Application2 N& x8 `2 |' N: z: U% k- t& }
- *$ o$ f) ]" }3 n9 @% g$ @+ m
- * This file contains EDMA3 Test code.: I1 H% q2 V! K( u; m8 ]' h
- *
# j$ X3 d2 ?+ n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ x) ^$ }' _5 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' I* `) l% c7 o8 i) y7 G: } - * TO CHANGE.3 U" X. A& P+ a# y% t; n
- *
( A4 l0 z1 M3 l1 h2 ]. B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 I. G9 a5 O) y: A: ?* ]" y9 | - *' h( Q& [" r3 A4 z- C. \
- * This program is free software; you can redistribute it and/or. `+ [1 o/ n+ A9 l) @2 C; Q7 d/ n3 x
- * modify it under the terms of the GNU General Public License as
- f+ ~! {8 |# q! N6 d+ m - * published by the Free Software Foundation version 2.
5 U. x# f. |7 s3 C0 [- ` - *
' ~5 R$ B6 ]6 A# d3 ~' l7 y- { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 Z" A* b G! a6 W; f - * kind, whether express or implied; without even the implied warranty- J6 w6 d8 u, I! W: D8 r2 u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* N0 q6 K) W0 Y$ Z C {2 [1 K - * GNU General Public License for more details.$ f" @5 s) N# c
- */
% k: p( U: B* s1 s
2 Y! ^3 V3 V; l% y& B+ X- #include <linux/module.h>
; k" \' [" X6 |( [ - #include <linux/init.h>
7 ~$ h* @% v$ N0 s0 X9 E( Z5 j - #include <linux/errno.h>, u& P. i* \0 V, ~9 ?
- #include <linux/types.h>
( [- r8 @, X6 I! ?2 H) D - #include <linux/interrupt.h>+ j9 L& r, O, _5 b" d, H
- #include <asm/io.h>
+ n3 \0 t+ a) b8 ~7 z. O - #include <linux/moduleparam.h>* P: L( R, C9 S; M$ m7 t
- #include <linux/sysctl.h>
, [* C3 l4 [8 ?% J% H: N - #include <linux/mm.h>
- r; B9 l: L) A( J0 f - #include <linux/dma-mapping.h>& p8 t+ E0 d% Y' O0 X
) S x% u& q) @( e5 v2 f! W- i- #include <mach/memory.h>
) D1 B" B% m% Q6 D( P7 N6 s - #include <mach/hardware.h>- E" s& \* H& ?( {1 w) c
- #include <mach/irqs.h>4 r. N* d1 I f5 s5 c5 Y) |6 y! t
- #include <asm/hardware/edma.h>
; K/ G) b8 c8 T3 o( t- ~9 y$ N! P! f - , ]$ K% w: Y% {, f4 f
- #undef EDMA3_DEBUG
5 {9 ]5 x3 c1 E2 z- |# Q - /*#define EDMA3_DEBUG*/
- }' e( J* P4 a6 s# c5 w - , S8 S& }% Y( ~$ I; q
- #ifdef EDMA3_DEBUG# }9 ~' M p2 n6 H$ W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ B" Y" q7 N7 E7 n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ O$ }: ?8 U: t- Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( v, ^# C& [/ n( V% l - #else
3 p$ X( @ m% E0 U; T: G# E - #define DMA_PRINTK( x... )! d: ^+ M0 r' g5 x s$ K
- #define DMA_FN_IN
9 W& j+ p$ A6 W5 X6 m2 g - #define DMA_FN_OUT
. c. f: s+ _5 m3 X7 y3 C - #endif' z$ _& p8 y( X, p; c7 N+ f# b; z2 h. C
- $ C; [# E- w r% `0 c( d- \2 } J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) K0 r# Q$ k8 o% d4 u - #define STATIC_SHIFT 3
+ h6 S) i! j! b3 x. Y - #define TCINTEN_SHIFT 20
( X6 Z' C) \. C- s. o) W/ x - #define ITCINTEN_SHIFT 21
, Y: u1 `; X# ~4 l: _ - #define TCCHEN_SHIFT 229 ^0 A; B+ p) t! ?
- #define ITCCHEN_SHIFT 23
" O& o. k! O7 |, [5 E, _ - 4 {1 w( o% e$ M! |
- static volatile int irqraised1 = 0;
+ [; H' m% S$ G - static volatile int irqraised2 = 0;
1 S2 I, B/ d8 z6 O, S* \6 D# r, ]) e# @
9 F& T4 b' Q2 k0 O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, v0 F/ I. ^" @3 E$ v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 n& Z; L _3 n, g, n! b# ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ V% \# Y9 u' C8 [1 n- F
- 1 s+ V0 K F2 T4 @; q2 j
- dma_addr_t dmaphyssrc1 = 0;
0 H; J E+ L' F - dma_addr_t dmaphyssrc2 = 0;1 _/ j" c% j. [; F: p
- dma_addr_t dmaphysdest1 = 0;' r% K7 y+ |& r- T& X
- dma_addr_t dmaphysdest2 = 0; W9 V% L' f: b1 A! N
- y; _2 r, _! [, R, \2 C8 r! T4 R/ b- char *dmabufsrc1 = NULL;- y6 r: H5 f9 `$ U8 x4 i4 d
- char *dmabufsrc2 = NULL;
! I& [( g& W7 p8 ^2 v; F& U8 b1 p - char *dmabufdest1 = NULL; V: q. {3 o7 k4 `1 I* r9 O/ k1 J
- char *dmabufdest2 = NULL;) u3 i! s1 w5 I% ^& O
- 7 o5 W. @' G9 u. J
- static int acnt = 512;
( Y8 q- i, C: L1 j! X' e( r R8 O - static int bcnt = 8;
/ E7 v& L6 F8 H: K6 t( y7 G - static int ccnt = 8;
/ y4 e8 U: a& {) A( t - 5 L/ g1 |6 M# I& ?
- module_param(acnt, int, S_IRUGO);
8 y$ a% z, D5 N/ n1 W1 o6 f - module_param(bcnt, int, S_IRUGO);, c% i; V6 R& N
- module_param(ccnt, int, S_IRUGO);
复制代码
# ^: v# ^( G D+ D# r3 N1 D4 U
) q1 N7 C" x! i( j) e* t N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' N1 s$ t; \/ A! _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% Z. I: z, s* d3 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 j4 I5 w1 H2 k+ \2 `+ @0 f+ T! O
% T0 D3 J8 {$ T0 ~' h; d |
|