|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 _8 [' l8 A9 ~
- [code]EDMA sample test application( g. k% |2 [/ I) M9 \
- /*) `. }. L7 n2 c$ f
- * edma_test.c( x" u+ e- G& D- t' D. X
- *3 D% I% {/ ?6 u8 E! Y1 m. v
- * brief EDMA3 Test Application
; _7 R+ K1 G J0 l& x" P' v* O) Q' } - ** F' |% @5 l+ A$ s. W* R
- * This file contains EDMA3 Test code.3 X: P' C! n) R
- *0 X0 G0 R* Z- |6 g( ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 u& h/ a' r, H: q+ o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ? ^* @- s2 U. X+ i3 b
- * TO CHANGE.
2 V$ @& f9 l5 S, U+ u9 s1 B - *; G6 W+ i/ {4 P- K: t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( Q- O8 Z0 B4 H
- *. F# r" z* H$ i7 _( b7 L. H
- * This program is free software; you can redistribute it and/or
! _2 G* M6 W E: z, A# F - * modify it under the terms of the GNU General Public License as8 G3 A. a. a3 j& e" T( k
- * published by the Free Software Foundation version 2.
& R8 u) d0 A! N - *
8 l! G. _5 a; `: g# W4 |5 a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 \5 M+ L6 n7 K1 f' Y# h: L3 m# n - * kind, whether express or implied; without even the implied warranty
1 j' }" ?, k; W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ I/ z4 ]1 F4 b7 | [ - * GNU General Public License for more details.
% W4 N8 g$ e& L - */
4 \8 ~# b" @; m: n- r
5 ]3 j5 \9 q3 e- #include <linux/module.h>
% U* D/ B6 d. {0 }8 g* L6 @ - #include <linux/init.h>
1 e5 s: x6 T: D& C3 W5 i* J! N - #include <linux/errno.h>
2 x8 \8 W- N; |) U! V" C - #include <linux/types.h>
) h- `, P2 `1 X* Q4 D - #include <linux/interrupt.h>! k4 p4 w! n9 P* G
- #include <asm/io.h>
+ t7 _) P9 R* ]. u3 {, V - #include <linux/moduleparam.h>* q; S. L: `: ~5 _" m! d
- #include <linux/sysctl.h>
( ?% I" C2 B4 N! Q: E - #include <linux/mm.h>
, X$ a5 w( o4 W" _2 ?9 f - #include <linux/dma-mapping.h>
' n; s. e, m8 a9 g# Z0 C - , J' B0 B* \. v0 [
- #include <mach/memory.h>
/ `# G* H% I; R3 G. R G - #include <mach/hardware.h>
1 V4 p2 {6 a! e7 c+ `' Z - #include <mach/irqs.h>
% ]! d: W) b5 ]- `& L - #include <asm/hardware/edma.h>
, R( B5 F! T: W2 ~ - , V. h2 x5 U$ U0 ~
- #undef EDMA3_DEBUG, r% I* X8 t* @. C% b0 N5 f
- /*#define EDMA3_DEBUG*/; z+ l. `4 P- O% h; d8 k) y0 H$ j& G
- + [. N; q* J/ o% H
- #ifdef EDMA3_DEBUG
* s' `0 G9 M8 C+ f) B2 M6 x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# T% `1 h: W. a$ r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ j' ]' ^/ R, A* w( p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& B8 @2 n0 J1 [ - #else3 t; `- M) m4 ?
- #define DMA_PRINTK( x... )- }5 _: `+ g# \5 v8 k) g
- #define DMA_FN_IN' }9 g7 ^! s7 Y
- #define DMA_FN_OUT& w6 ^* n& j: H3 H" |
- #endif
S" L; d! i' m# T3 S- V - ! q; `1 L5 L6 J) E( [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- S1 S5 U8 R. h1 e9 ] - #define STATIC_SHIFT 39 X* @! f) d& Y4 C/ m" w/ {3 @; z2 ]
- #define TCINTEN_SHIFT 20
X$ R+ X2 p( C: w - #define ITCINTEN_SHIFT 21
$ q' E- E. M& u' W+ C0 w$ k) M - #define TCCHEN_SHIFT 22
" L! c* X/ r, H' j& u# p - #define ITCCHEN_SHIFT 23
7 p' q2 Q) l# ~ - Q3 X" s/ p5 Q7 l( n2 s* M2 L4 G- K( G
- static volatile int irqraised1 = 0;
4 H* b U. l- S) p - static volatile int irqraised2 = 0;
) D) v8 w) w4 O5 v; n. A - , q R" V* M. I& D0 S4 |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- J, e( z7 i6 Y8 R- n$ |# _' L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# w* i+ f, Q2 @& h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ d8 L4 p4 H/ N/ q
7 {# m2 ~2 D* I" X- dma_addr_t dmaphyssrc1 = 0;
* o ?# | Y, B; ?5 {+ n0 } - dma_addr_t dmaphyssrc2 = 0;3 z+ K' g' X3 g! t) N
- dma_addr_t dmaphysdest1 = 0;& T2 h& s4 p' h f: X# g( s
- dma_addr_t dmaphysdest2 = 0;3 Q; P, X) m, }( u7 s2 g$ Z
- V0 [! ?8 }; F. K4 A& `
- char *dmabufsrc1 = NULL;! s8 |/ V0 a# Q( s+ v) D
- char *dmabufsrc2 = NULL;
[( P1 Y1 f {; Y n6 h - char *dmabufdest1 = NULL;
1 t' P% j I) v5 k5 Y5 p - char *dmabufdest2 = NULL;$ p% l$ H! ]2 B' V
- / `1 N" W4 q' p7 G5 T5 t/ E1 N
- static int acnt = 512;
1 |* Y% m7 E. {$ Z6 a% |' }4 d0 h - static int bcnt = 8;& o7 t. K8 v0 J t
- static int ccnt = 8;9 A" D5 c: h" M/ y$ M. N) z2 k
7 B( o4 R6 m) t$ i% b" k' g- module_param(acnt, int, S_IRUGO);4 p* s: j u; O, P6 j: q
- module_param(bcnt, int, S_IRUGO);
/ R9 Q7 y: r, l& y! T - module_param(ccnt, int, S_IRUGO);
复制代码
- ?, B# z: c5 Z2 l1 L1 k c) D. B( e) y3 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ E* V5 q) Q" [2 C9 s" ]8 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 Z( t$ h4 V% X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; Q" w9 Y8 @* G, H: A
* Z0 P8 P: z0 `7 J
) I @# z. X0 T0 w |
|