|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' x6 t1 H! U6 f) h( x. u1 r- [code]EDMA sample test application q) G7 p; U; {$ k8 _
- /*
: x+ w8 h- v y+ `9 n - * edma_test.c2 C9 d+ Y' `: l
- *% p- e0 t- V1 |& n
- * brief EDMA3 Test Application, s% N+ T) z' o+ I7 [+ |6 T4 V3 w+ n
- *
8 |5 {7 x( t/ p" R9 b% e+ l - * This file contains EDMA3 Test code.
: i) |3 q4 h4 `/ V. v# S# ^ - *# P6 a; n$ ^9 s) D% V) k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! n: A& |' ~+ N; x, t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT A# z2 y2 D0 T4 {
- * TO CHANGE.
* R, b, E8 Z' _* `2 X; @ - *
& ?4 b( E8 }9 i1 @% `' o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" E* d& `& Q( {
- *& N; j8 } e6 Z0 Z9 v
- * This program is free software; you can redistribute it and/or
2 G* ~% T$ m& P - * modify it under the terms of the GNU General Public License as
( Q. ~) m& t( A- s% E - * published by the Free Software Foundation version 2.8 q& G$ f4 ` O" J
- *
; x9 F) h2 U p* Z7 v, f) F' J3 m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 r$ t% t8 O4 z4 ~- f; N2 \ - * kind, whether express or implied; without even the implied warranty7 i5 H$ e- _5 o) }, x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 E m& j: e. q ~7 G7 ]4 Q - * GNU General Public License for more details.( ?' @+ U0 ^" T! r6 f h2 m: s
- */. @) x3 f1 e7 n2 W% R0 B6 Y
- ; ]$ Q" ?3 h% b$ }0 h
- #include <linux/module.h>
+ w+ x m( S8 |) p- W - #include <linux/init.h>
$ U) u3 b# ^$ E( G4 [9 r - #include <linux/errno.h>
* o+ F' ?$ S0 a5 s; N - #include <linux/types.h>2 {2 ]9 k, I% I- V' z+ W
- #include <linux/interrupt.h>: X7 J- z& }& P& _/ }
- #include <asm/io.h>
0 w5 Y( S8 D7 D$ [8 d8 G - #include <linux/moduleparam.h>
% D% ]! W( i, \ - #include <linux/sysctl.h> S! d6 ?, l% A m- o* T2 C
- #include <linux/mm.h>
; K5 X6 Q& u+ i9 j5 C( U, ^ - #include <linux/dma-mapping.h>
/ f% p' f5 z* m$ \+ I - " A6 ^& z6 x* A" T. i
- #include <mach/memory.h>
* R/ G# U0 C2 n2 C4 [1 D - #include <mach/hardware.h>" ]0 ^. Y8 A/ I, {+ U
- #include <mach/irqs.h>
* D# R4 b3 _7 F$ H* W: y+ O$ ?. A1 z - #include <asm/hardware/edma.h>
. @- u1 {/ d0 u
" d, s& t/ I3 ^, [9 k& k. F- #undef EDMA3_DEBUG0 G# l5 I$ L& D7 P# g/ u- K/ g
- /*#define EDMA3_DEBUG*/
4 I9 l: v7 O# e( T
( M4 x+ R* `4 h& X- #ifdef EDMA3_DEBUG
) o% h% Z) h% w. n( N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& T9 `6 Y$ |! K/ @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 d" M0 g& ?* ~; I7 z: H1 M/ P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) q" g1 G7 k% ?) W5 \, @$ w
- #else
' g7 U3 s/ R6 B& N1 { - #define DMA_PRINTK( x... )
! `1 B& Q' O. N - #define DMA_FN_IN
9 h2 v) R2 {7 h! Q/ a3 W - #define DMA_FN_OUT& Z2 ?- Q: S+ q
- #endif
5 [: J# k% R( c) i7 z
7 ]% [+ |7 ?- _- @& L6 l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
Y( i `# g9 A: \6 V4 |, U - #define STATIC_SHIFT 3
* {$ u9 K) m5 {9 ~ - #define TCINTEN_SHIFT 20
! h% }. `& T/ \# v$ S - #define ITCINTEN_SHIFT 217 {1 L0 E1 T0 o6 A2 g; z6 T
- #define TCCHEN_SHIFT 223 l2 U/ L7 c2 y: l$ \
- #define ITCCHEN_SHIFT 23
3 v. |+ c' N {% U; W' x6 v3 {! ? - . W7 N2 J- \, [7 k/ k
- static volatile int irqraised1 = 0;
$ w' n: D0 n7 P1 N' }9 b - static volatile int irqraised2 = 0;- P- L% X& |6 x
- ! `* H5 K+ ~9 B+ ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ~2 ]; T" O% N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ P8 ~2 \( s- g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 C g0 h/ R2 `
+ d+ P7 `9 p+ C, w4 V. n! j% _' [- dma_addr_t dmaphyssrc1 = 0;
6 \/ |/ x, Z1 J3 W( o - dma_addr_t dmaphyssrc2 = 0;! w: p$ r' ]& P; t, c$ S
- dma_addr_t dmaphysdest1 = 0;! T) ^( V# F0 ?) }8 k" a% d
- dma_addr_t dmaphysdest2 = 0;- A* ?7 y* A9 b% v$ A& O
- " y! _' k( T; G9 e' s; j: E
- char *dmabufsrc1 = NULL;
. r5 p1 L! S. @4 G- h( v. G- s# e - char *dmabufsrc2 = NULL;( Q& F. n, G3 F
- char *dmabufdest1 = NULL;; t2 J& \- V+ n n Z# Y
- char *dmabufdest2 = NULL;4 i& I( V7 W4 S8 {
- ' P7 ~& v8 V$ j# W f6 p
- static int acnt = 512;
7 {. v- B$ r# w3 z4 t - static int bcnt = 8;+ W4 C: B& m) N
- static int ccnt = 8;, N/ J- J- z# _
& { t: c: R+ k9 Q1 a- module_param(acnt, int, S_IRUGO);
) N+ e% R5 D- B7 c& q* m - module_param(bcnt, int, S_IRUGO);7 ~2 A( `) C) p. [; Y
- module_param(ccnt, int, S_IRUGO);
复制代码 7 j( ` W4 ]! V
9 N3 [1 c# v. X# G. y" x9 {/ o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% D& E3 J( Q; D7 B: Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 v6 [- {! q8 D% }6 @ V9 ]( Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 V' s0 [8 Z# b- G. T/ N
5 F- q2 ]% @2 W: ]* H
. P. s# z9 ?" W8 G- L6 Q! m0 Q! Z |
|