|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 I4 _% m& U- ^- [code]EDMA sample test application- i$ X- K. T3 L l {1 ~" L
- /*) J1 h2 Z! ?+ {+ d& T5 C4 u
- * edma_test.c" F. a8 ]- y9 g# G7 T+ ?* H
- *- u B. i" r" l9 ]
- * brief EDMA3 Test Application/ I( J0 @8 {8 q6 X/ U( q6 m
- *; \0 l6 F% N# W$ {: Q, `! _
- * This file contains EDMA3 Test code.$ F: g) o$ O& a6 L
- *
: @1 x; ]: b& N3 [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 ?* h8 E7 p& i! h$ u; j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, R5 l3 N. \; ~& f" q V5 [ - * TO CHANGE.
! S" w4 b$ _3 x; Z" Q9 n r5 g2 B6 r - *! b2 E2 q/ @" @% Y" L4 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! Q |+ N F, n0 S% q$ \6 y- F o6 Z c
- *, F) R8 ?1 d- J; p3 p* p. N" @
- * This program is free software; you can redistribute it and/or% ]- p7 C* W. G6 |3 @
- * modify it under the terms of the GNU General Public License as. d. }9 O. l) l6 { \+ T
- * published by the Free Software Foundation version 2.
2 E% V# b7 F [/ x F7 `- e [ - ** w4 s; }+ i. |$ I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 B; X6 c* }; A, j5 T
- * kind, whether express or implied; without even the implied warranty) W; u, }$ z; R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* V. ]# s- Q4 q% i
- * GNU General Public License for more details.& }, N" r& R# f# i. A
- */ B }4 R: C( } d& Q2 y- N y: |& c
- 9 i0 I% r( b, M) h' P- A& y
- #include <linux/module.h>
% I+ Q# B, S) ]$ ~* n. G1 e - #include <linux/init.h>! u9 [9 A# }% W+ W ?' H- B" [
- #include <linux/errno.h>
" E) W5 n" X/ M0 {, N - #include <linux/types.h>' Y0 q9 \: F& p) p. x
- #include <linux/interrupt.h>, S, L0 C J2 {* }8 Q
- #include <asm/io.h>; c( J0 P9 Z6 e9 c: s$ j
- #include <linux/moduleparam.h>0 m. m$ e- O! o( ^; |
- #include <linux/sysctl.h>
; ^! o$ n* J3 T% t" m7 V9 A" T - #include <linux/mm.h>
) h* Q" q" l, O - #include <linux/dma-mapping.h>
/ Z# q* ^( I3 H
, D& g# e' g3 h" P. t- #include <mach/memory.h>' c- T. ^5 L% C' T8 V
- #include <mach/hardware.h>
" o/ ~/ H4 R' v7 l - #include <mach/irqs.h>, ^5 a2 J' j8 h; M- p {
- #include <asm/hardware/edma.h>" H M% k* m' A/ n
- 9 I6 |* z2 X" T" g
- #undef EDMA3_DEBUG
6 h d, @. D' ~, ?" |6 e M - /*#define EDMA3_DEBUG*/8 \$ v w1 B) W
B& Q1 Z- y6 H: ^" v6 e- #ifdef EDMA3_DEBUG. j2 c2 z5 o" D% i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% N. n* `2 f2 r6 r) d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) `( }& `0 U/ X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). p+ D* t, F1 t5 f4 ]9 F
- #else5 @( w8 y3 W ~0 B/ i2 |
- #define DMA_PRINTK( x... )
' N6 q2 D; f- X0 e2 c% n - #define DMA_FN_IN
h, P% p& @9 N S& Z$ T - #define DMA_FN_OUT9 v. N+ H5 X9 i# d+ H% e, B& {
- #endif! z4 H) N0 n- t: b6 U: C" y# H2 {
3 J& s2 m/ H6 U( z2 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768), z# P( Y+ t: K
- #define STATIC_SHIFT 3
3 W% H' V5 Y# X6 ~7 r8 w8 G7 r# V) d! F - #define TCINTEN_SHIFT 20; g: E) `3 S) |7 ^0 a* |# L
- #define ITCINTEN_SHIFT 21! X# W$ p% Y7 W) x: W3 |
- #define TCCHEN_SHIFT 22
3 b( i o. H3 _2 f9 { - #define ITCCHEN_SHIFT 23% S4 Y V4 Q: r6 M
- 8 [9 Q9 A4 M2 O1 c
- static volatile int irqraised1 = 0;: e3 P0 m" R& C
- static volatile int irqraised2 = 0;
4 P6 x1 T- \/ o$ F2 k: r7 q" r! f - + h' u) J" C' U* ]0 n1 y+ V$ \) ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* g7 L6 p; D' z0 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 G3 f) U) _/ ~ Z1 h# [, T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: e" \. A7 R$ P4 C( H - $ _# e/ R6 X/ Q& T
- dma_addr_t dmaphyssrc1 = 0;: |" m- P) p( Y3 n$ G8 L! q f, y+ k
- dma_addr_t dmaphyssrc2 = 0;
9 `9 n* o' M* E9 U - dma_addr_t dmaphysdest1 = 0; A/ w& |" H$ l4 E t; a
- dma_addr_t dmaphysdest2 = 0;
3 a5 A. O: E0 y# j/ o( q/ p - 6 U( R. l9 T3 X1 ~8 J K! W# }
- char *dmabufsrc1 = NULL;
0 v, o9 W7 O# y* A* G) A - char *dmabufsrc2 = NULL;
% y8 M1 a! s) @4 J - char *dmabufdest1 = NULL;
8 z C8 a0 a- f9 Q) r& y - char *dmabufdest2 = NULL;
' @0 `' @7 t E, [) u
% f. k6 T1 t! m! B/ V6 n- static int acnt = 512;
3 J; l5 b' f/ a$ b: f - static int bcnt = 8;
5 b, o3 }$ K# r* y1 `1 ] - static int ccnt = 8; k/ t/ N7 l1 d5 G( h: L5 {
- - a }& K* o, Y
- module_param(acnt, int, S_IRUGO);& w, p" a6 d7 H' a" x! ~/ I
- module_param(bcnt, int, S_IRUGO);
2 d: _) T* p9 r; D+ S& l a' A - module_param(ccnt, int, S_IRUGO);
复制代码 $ a3 L! q9 y. \( E
& H( b! w/ I6 W; H9 U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ x+ N B2 ^" k' \/ @, ]% Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* K0 [1 a, S% ?. F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& s/ U9 K3 n9 O5 [: L5 z
7 u* x% [7 U& i5 y X) Z2 h3 k/ R
; t% o9 f" H' [( Y( l# A
|
|