|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / k6 E8 z8 N8 G' t9 D- r1 I! Z
- [code]EDMA sample test application
: `* s# B2 J2 c f4 @+ R, `) V - /*
" I$ R) W2 D$ }! | - * edma_test.c) E$ P$ D" a S0 P0 Y
- *$ q1 w/ |4 w6 }* c! F
- * brief EDMA3 Test Application
) ]) c+ l' U, U L - *2 o5 B* \4 n/ o% J8 t4 I2 u
- * This file contains EDMA3 Test code.
4 |$ H1 G) U! Y% K - *
6 d! S0 T( L8 u! \4 x! E; Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 D5 x) S. a" g( |, `1 \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ W+ s' L! u' K* }0 i
- * TO CHANGE.' \- n# h% {0 ~- ?2 W9 ~7 N
- *
7 e4 |1 B% x0 h; ~% V2 @) b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- q$ ^% F0 O7 p$ V7 w# L& G2 I9 K+ C* i
- *% |0 T$ s" d2 S7 f4 P
- * This program is free software; you can redistribute it and/or
+ |+ c. g+ i& V- s) A* b - * modify it under the terms of the GNU General Public License as) u7 ], N, b1 Z9 b3 G; R
- * published by the Free Software Foundation version 2.# W) z5 b, Q) Q, R" D" T
- *
- \. \* o' S0 r& }, ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 R2 Y# r, B) n- v' I! a! }5 I. _
- * kind, whether express or implied; without even the implied warranty1 i! J n" `: w) f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; G- f! X+ t/ L' [9 R7 @) e7 u - * GNU General Public License for more details.: n/ N6 |6 Z4 K
- */! R( D0 A# u' y( e! h
8 H& T: Y8 ? g$ J# m- #include <linux/module.h>
0 B x3 D/ x9 \# t3 ? - #include <linux/init.h>1 \% i3 h: |2 T7 \3 d% T4 V M
- #include <linux/errno.h>
) [. ?; k9 j% p0 v+ J, R - #include <linux/types.h>
, |" b, D% u, i. E - #include <linux/interrupt.h>3 u B$ f4 J, q6 b- E2 A
- #include <asm/io.h>9 c+ n$ j7 Z5 A3 z
- #include <linux/moduleparam.h>" W8 W3 t: T# S; A* K0 P
- #include <linux/sysctl.h>+ ?/ y! C9 f. d- S& s- {$ U7 M: H7 x* U
- #include <linux/mm.h>& _. V& i- P9 p ?2 U/ _( E
- #include <linux/dma-mapping.h>
1 x6 Y0 J; R7 q. G7 J5 v; C7 r - 6 K1 s* k2 V! p0 c! z, p+ o
- #include <mach/memory.h>
. q3 f( Z1 M5 h I6 x6 @ - #include <mach/hardware.h> x4 |# p8 p/ d: a; j
- #include <mach/irqs.h>
( B- T1 t3 ?$ [# M, K7 P - #include <asm/hardware/edma.h>3 m0 N3 W" ^6 n# Z1 P
+ J1 H1 v3 R! X/ F- #undef EDMA3_DEBUG
; f# p/ Q. v2 c& k. {6 [ - /*#define EDMA3_DEBUG*/& X+ @: B$ q8 T& Q" c" m% n3 Z
- 5 S; g# C/ O4 w* P0 N+ J
- #ifdef EDMA3_DEBUG
/ t% Z0 {# h, C7 t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 k- l$ F0 H; V) Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& \" j, p9 M$ s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) t$ ]+ {0 U- K2 U
- #else
8 g/ ~, h; M4 ~- s3 w - #define DMA_PRINTK( x... )
) [* L! L, [ q, ~4 D. f - #define DMA_FN_IN1 n& O0 w7 ^, }+ A4 E! `
- #define DMA_FN_OUT
7 @* ^# ?, m/ P9 B1 s' | - #endif3 z* ]4 V& R8 s4 G
- # ^6 t: Y- C( l, ~1 H: G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ Y' G0 V& w2 e! k# P) h- E
- #define STATIC_SHIFT 36 d& C$ r) |: w' ^$ ?6 u% W' T
- #define TCINTEN_SHIFT 206 K0 A; @3 d1 g4 V2 q# d& w/ Q
- #define ITCINTEN_SHIFT 21- B$ K* ~, a" I
- #define TCCHEN_SHIFT 22% D6 |; O8 A5 l& A1 n% {* k0 o; [' q3 h
- #define ITCCHEN_SHIFT 234 v3 m& M) p/ U/ ]# d. ?0 t3 T+ T
1 r% L- V7 E2 F2 ^, @$ I- static volatile int irqraised1 = 0;3 |4 x; S1 `2 j$ f
- static volatile int irqraised2 = 0;
2 Q' [! [4 L( \, a; O) q - 7 u5 n) ]+ E6 I$ W. D D/ V. |4 w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ^' x, j" h+ E5 [& E3 T+ a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: p5 U- T( H# f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 o6 C9 r: T6 r( I- K' u2 b1 X
, h y# R% J) U8 B8 v- dma_addr_t dmaphyssrc1 = 0;
; f( B$ y0 i$ a O; P3 D" t - dma_addr_t dmaphyssrc2 = 0;' f1 n C8 H; q9 Q! ^ Y
- dma_addr_t dmaphysdest1 = 0;
& S+ ?1 _4 i, H) t, _& b - dma_addr_t dmaphysdest2 = 0;/ \+ S4 M1 ~" P$ I# i" @* K
- " w7 \7 a$ S& \6 ^& [
- char *dmabufsrc1 = NULL;3 \$ s$ k5 G$ e/ Q1 w
- char *dmabufsrc2 = NULL;% v; _( m- Y1 ?
- char *dmabufdest1 = NULL;
4 T( M6 ^! C. W7 T$ C, s - char *dmabufdest2 = NULL;6 l$ |& q$ x; X5 C% a
, W4 {3 P2 \4 g: }' x/ u- static int acnt = 512;
( l0 T4 L0 p7 w2 k0 ^+ r; p - static int bcnt = 8;) n' G/ J& M: M% B
- static int ccnt = 8;/ P+ N) A% F8 v6 Z( @1 B& I
- : k- f1 S( Z' ~4 k7 k$ ?
- module_param(acnt, int, S_IRUGO);3 E4 w/ F2 R6 i8 f) _) c2 l/ n0 m D0 r
- module_param(bcnt, int, S_IRUGO);
2 M; h- c' F! M4 V# f, C s - module_param(ccnt, int, S_IRUGO);
复制代码 6 a* o" L K, Y/ o) n0 }. k; \
" U! p7 L9 `4 ?) q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ w- S/ }6 G! D$ Z1 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 R( d3 O& `- K' w+ S9 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ I, c/ E% L$ g
. W+ p$ f6 k( d' p+ L+ h# M# d* z' a5 V4 z
|
|