|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 G x \/ t0 e" Q# e- [code]EDMA sample test application0 K, ~7 m) |( z0 K& z3 c
- /*, @" @& {# w* _; Q! M* |
- * edma_test.c& c, m' ]$ `1 ?' g+ G! ]7 G
- *
3 Q( a- d. q! b; s - * brief EDMA3 Test Application4 \5 K* O5 Q, L
- *+ v2 {. ]5 r7 Z
- * This file contains EDMA3 Test code.9 c, ?( I. N0 q$ M0 w3 l `+ l# _: L& b
- *( d( N8 s. h$ z" R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" F9 N7 [, k9 t8 U% [& t* Q) R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 r& a4 q1 |+ ?7 o
- * TO CHANGE.+ F9 t9 s& i; t: i4 h" e! z7 R
- */ @" H5 D! k/ ~" R* A$ e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# i3 S) R; s, `& `8 Y
- *0 E0 ]+ `$ ~- F
- * This program is free software; you can redistribute it and/or0 @& w9 N: n( B& [. M' {
- * modify it under the terms of the GNU General Public License as- ^5 F: c( a, e+ g; c. S4 f
- * published by the Free Software Foundation version 2.
+ l' r: z* W! Q0 m - *
" d) Q8 |5 z9 Y/ I5 T! g2 }8 a3 S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: ]9 Z' i# i/ t% ]! t3 F9 U - * kind, whether express or implied; without even the implied warranty$ G. @; R& b7 J! g; {5 J* Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 b4 k- r* ?# \! _3 ~
- * GNU General Public License for more details.
- k! n/ n5 m, Q% I5 e$ n/ M' C - */1 y8 M' m6 N; t9 H& r2 D
- , |1 q' d$ H* f6 U0 h. X
- #include <linux/module.h>
8 \2 [& L+ V: w. ?* H% | - #include <linux/init.h>7 u0 k; z& P( t' q4 y) C
- #include <linux/errno.h>
$ F4 G' s1 P- L$ ]6 {8 f" j - #include <linux/types.h>: \# R. C+ s" E& P% p+ E8 d
- #include <linux/interrupt.h>
) r! B+ C# w/ |! N+ i7 @5 u - #include <asm/io.h> [& {: r" I/ j7 Q6 T
- #include <linux/moduleparam.h>5 ~4 L& c$ D& E. Y G9 L
- #include <linux/sysctl.h>) _; U2 M5 t. g# G$ `
- #include <linux/mm.h>
% _* w2 [4 D# @8 n9 Q - #include <linux/dma-mapping.h>
+ s- }$ Y7 W; {, J - " ^' m4 [- _6 T. g* Z5 a# R
- #include <mach/memory.h>: [2 i$ y7 o& ?
- #include <mach/hardware.h>2 r1 ? W8 y+ {$ P- v( M0 N G
- #include <mach/irqs.h>
1 k0 l) m) Z6 e$ Z! O# U2 |$ ?; s8 J - #include <asm/hardware/edma.h>7 F, P, L% O& w# {, S" S5 e% f+ q
% f5 s Q" r- z' p! r& t- #undef EDMA3_DEBUG
- ~( e9 v, d p# R( C- U - /*#define EDMA3_DEBUG*/
9 B2 ^2 Q% q& P1 `
2 |! [% D$ j; a% c- #ifdef EDMA3_DEBUG
, _4 W f0 V) Z9 h! u: F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 F+ C9 _& k1 |0 [9 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. v( W/ s& M6 r+ D/ R" c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 E# _8 Q5 k/ u s8 f9 I! h - #else4 z- p- y9 V l. O1 `0 v7 B
- #define DMA_PRINTK( x... )% Y5 C+ P! T) z9 c" U: N+ b
- #define DMA_FN_IN
4 o7 Z5 R$ q' a& B+ w - #define DMA_FN_OUT. |9 P% [* W$ S
- #endif* |3 a0 t2 H+ ^- k
- 8 M: y9 m$ x7 ]4 P+ H/ |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. Q: h4 ?( ^) e( c: h) P - #define STATIC_SHIFT 3; \4 B0 _# U& M* n
- #define TCINTEN_SHIFT 207 D( l" C# w: }& a
- #define ITCINTEN_SHIFT 21
" E& |$ W3 S4 T( C% F - #define TCCHEN_SHIFT 220 I2 E* C# N. F: ~' T5 j0 T
- #define ITCCHEN_SHIFT 23
5 i: l1 j5 m4 [
* x% \: y/ P( G7 C: e) f/ \- static volatile int irqraised1 = 0;7 h' I' K! J J3 N3 f* `
- static volatile int irqraised2 = 0;
3 U- c3 L# u* d' F0 x) b2 f9 i4 p2 B
- X: Q5 f& h: g( v0 R# J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ t @3 n4 ~ Z7 |" @# s8 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [ `2 y0 e+ x; l5 ^5 g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 [5 X9 F! } z: r* t+ X- D
- . `: w$ O F4 F( ]0 j7 y
- dma_addr_t dmaphyssrc1 = 0;
+ F% \, J* s' z+ s( f - dma_addr_t dmaphyssrc2 = 0;2 m/ Z' y( ^2 x L
- dma_addr_t dmaphysdest1 = 0;
% L/ Q( a5 C6 k$ p+ T - dma_addr_t dmaphysdest2 = 0; X3 r3 F2 I1 ^7 C8 A% W# Y5 ]
- % \, `# O( i1 t* _, g4 n8 I- `0 t; y
- char *dmabufsrc1 = NULL;0 @. k! F- Q0 F: [; L
- char *dmabufsrc2 = NULL;( N. |/ r$ k$ ^9 k
- char *dmabufdest1 = NULL;/ _( h6 J) P3 N- U6 K( u
- char *dmabufdest2 = NULL;4 Y; h$ f% q" B, p0 {8 e
6 }5 q/ `, q9 ]7 `- static int acnt = 512;
1 e+ y# H$ S. }0 b - static int bcnt = 8;
$ A3 H* {! u. Y: ^& p6 y - static int ccnt = 8;
2 \; t' c( J. @2 v/ C0 p
9 X9 C4 {5 |: `( X! E- module_param(acnt, int, S_IRUGO);
; @$ o: L$ _6 W# e: m7 G, s E - module_param(bcnt, int, S_IRUGO);# L0 [: H. D R) p
- module_param(ccnt, int, S_IRUGO);
复制代码 2 X7 W# U! C: {7 w: `
, [' k" [* O. q8 ^6 F j) a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* |$ j* n& O+ |+ U( @$ b- u3 F% Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. x x7 Y- j" ?0 |) O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* T/ Y+ E+ a. R% Y9 a+ ~; L
* N2 i: H6 ?; ]9 ?9 \+ r5 f6 Z# j+ z8 q2 b. I ]
|
|