|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 W. R1 P' d$ \* x
- [code]EDMA sample test application9 y; k4 n- V/ M) t: s$ s
- /*# V- V. C$ z3 l6 z2 M
- * edma_test.c+ L" G: x! ]6 d3 ?# H4 j. V2 ^
- *- H# D8 B4 J9 a8 y7 q3 ? t
- * brief EDMA3 Test Application" \4 K+ a4 u, k o+ O3 n9 @4 T2 J8 H
- *3 X& u) K1 C- Y H6 p1 M$ N
- * This file contains EDMA3 Test code.8 H! J3 y) Y3 f/ j) M8 s
- *
0 N4 f. [& q0 E3 L3 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 C Q) r0 H7 H& `7 @% g) l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( O+ g, A, E" e9 r$ d - * TO CHANGE.
% W+ H6 D+ @$ j - *7 { U. s$ C( K" ]5 q& H5 {* {5 a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. \& ^* B$ d/ L' z - *% U& o, @$ A m u- r# R6 Z
- * This program is free software; you can redistribute it and/or
' D) f" C& V2 g& @, ~5 w5 T - * modify it under the terms of the GNU General Public License as
8 {0 e- m: S6 p Y3 Z( S - * published by the Free Software Foundation version 2.
% n( ^# \; h$ m, r% n9 z" w& V9 B - *
+ S, h# L0 F# j/ y; u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' z8 u: g+ k: L8 j" |, k8 o - * kind, whether express or implied; without even the implied warranty& y( c$ E5 m8 }0 ^7 U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 g: |" M Z4 u% A0 ^ - * GNU General Public License for more details.- M: u1 j" e1 u. E
- */- v, Y0 v6 ^+ q7 g
: i" p- a8 |* w7 J) o% F- #include <linux/module.h>& q# a3 _; e J+ i/ Q3 q
- #include <linux/init.h>: [9 [/ y( ]& ?- |/ r
- #include <linux/errno.h>8 L3 f- T; u( e% @. e
- #include <linux/types.h>5 ?2 c6 R, f$ t, u) I
- #include <linux/interrupt.h>$ ]% T% `* e/ y1 Q% [/ W1 h4 J
- #include <asm/io.h>
0 K8 B% W6 M# g- r b - #include <linux/moduleparam.h>( K, ^1 ]7 o: \# o1 L/ Q! I
- #include <linux/sysctl.h>9 K; r$ E6 g& T5 V. T; a. b Z
- #include <linux/mm.h>
, O- P. d! t6 l e - #include <linux/dma-mapping.h>
" S" p8 f( `) w& k+ ]" h# U' N - ! b6 m9 ]& b- K8 d z; T
- #include <mach/memory.h>
( H) u# D5 N' u. ] - #include <mach/hardware.h>, U7 B, W8 E9 c3 o2 z' N
- #include <mach/irqs.h>. _% l5 U5 k5 h% T6 X
- #include <asm/hardware/edma.h>
6 M' Q9 D# h' C3 B; _0 a) z
' R: ?0 S: O! \2 R( S" w- #undef EDMA3_DEBUG! ~. G% ^7 @. V' k$ p2 V5 C1 X
- /*#define EDMA3_DEBUG*/+ g! I& n! \. L
\+ n* W- z" U7 W! j! O+ e9 Z- #ifdef EDMA3_DEBUG' ^. P1 M$ N+ L9 d% h) j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); q, a" c, F1 K8 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# v$ q+ s) ?, N6 C3 N1 u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' w) F) F0 f/ ?7 U& j- z- A; y, _
- #else& R0 U. [$ ?/ C. B2 b5 N8 g! a
- #define DMA_PRINTK( x... )
% d7 F1 H* L: ~) i - #define DMA_FN_IN6 H" ]% u' ]4 M- K
- #define DMA_FN_OUT
% N& e9 u6 D# }1 t A/ O - #endif6 W3 i% Y7 [& @+ U% ?6 L" b! S+ V o
& m3 Z' [8 o# V2 Q" T* A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 [9 A! N8 |1 P+ Y5 }1 w4 K - #define STATIC_SHIFT 3: z6 f7 N0 P; h' d2 @0 M2 S& A# J; T) u
- #define TCINTEN_SHIFT 20& Q& x$ p0 \! o( F6 q# X8 B4 W
- #define ITCINTEN_SHIFT 21$ H# ?* E1 [0 \ X, x- @
- #define TCCHEN_SHIFT 22
9 V; W. P8 `4 s6 q5 I - #define ITCCHEN_SHIFT 23
2 V/ C- p8 D2 P; E - % H9 R9 e+ |) p9 N s- r
- static volatile int irqraised1 = 0;
' ^3 y3 l, t% V- P! h' @# v, O/ f - static volatile int irqraised2 = 0;" Z- X9 Y: U+ S0 U( J5 h- _
- & x, a3 f3 x9 i1 i( H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ I7 K; n% A& p5 p. ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ A% F! F. ]7 ~$ H; i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ [6 ]. i) c6 v8 h
- / F" h9 R* Y( \9 V
- dma_addr_t dmaphyssrc1 = 0;
2 D) E5 R0 ^. k3 v - dma_addr_t dmaphyssrc2 = 0; K( N/ \; E& Z0 T7 W9 Y8 A
- dma_addr_t dmaphysdest1 = 0;$ {. a3 F1 f" }- ]! ~( ^
- dma_addr_t dmaphysdest2 = 0;- j$ _. x; w7 x& T& C! ~) O) _
- / f# n) W# s0 y& v9 E- f
- char *dmabufsrc1 = NULL;# m r) m+ B: S& s1 k, A! Y
- char *dmabufsrc2 = NULL;
; v- b0 E& H6 { - char *dmabufdest1 = NULL;4 Y) O* n9 j$ k5 o8 V! j
- char *dmabufdest2 = NULL;
" c. Y2 T- }" Z - % h7 T& }* w( `2 W* S
- static int acnt = 512;
" f% m, A- W8 w% w' ~) \ - static int bcnt = 8;# j! k- T z5 h0 c3 ?* E; }
- static int ccnt = 8;
8 k: O$ z* S. k, I - 4 m* q: `0 e$ T6 S! r
- module_param(acnt, int, S_IRUGO);
% c& |" K9 O* w2 v9 C - module_param(bcnt, int, S_IRUGO);5 z. s' }2 _, m, D
- module_param(ccnt, int, S_IRUGO);
复制代码 0 e: Y1 B! i$ ]9 S
. I% |" G0 k6 y u& [- |/ d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
S& X0 k* b3 e" ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 O8 `) o6 m1 i- o* B3 k0 ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! k" [5 u4 B! ]" s1 O1 |, f2 M# m. h; L: j- {. b
. }; A9 ~1 Z/ T7 D, y! H) T# t% i9 q" \ |
|