|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. A2 u# N% X n% v4 U- [code]EDMA sample test application: O, t" X' A9 D. n0 @) r
- /*
L. @2 n! S. S& u, @ - * edma_test.c! _; `8 n/ X/ S) J, c. V% A
- *
5 E" N5 m8 |5 w9 Z4 j1 H - * brief EDMA3 Test Application$ `4 W6 U1 i8 L. d
- *0 P5 Z: D2 W1 o* z8 C. G
- * This file contains EDMA3 Test code.
+ `: `0 B% D/ W/ q, D8 t - * S9 \* K4 D6 r! h* U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' q: |1 L1 |" t' }% s* m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: q/ X7 m2 l; |
- * TO CHANGE.* }- J' \( `; x0 @
- *& H0 \" l! M t" g w9 \; G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 c4 E9 W1 y1 |9 l M
- *
; N4 U4 M; j7 G - * This program is free software; you can redistribute it and/or7 Q" o1 s- x# V& r$ {- `/ i
- * modify it under the terms of the GNU General Public License as
+ J. R+ M" [; I6 r2 @" i2 ~ U - * published by the Free Software Foundation version 2.% ~. `& I, X n' ]
- *, ~/ U+ J( Y$ d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* B4 T0 Q7 q' U4 Z; s5 m8 M4 n$ |
- * kind, whether express or implied; without even the implied warranty& j! y- T$ B2 S6 ]* z: x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" L( f7 G$ I7 w" P
- * GNU General Public License for more details.
0 g: G2 u0 Z% T2 h- Z - */9 J8 I% ~( m+ y* m; G( _( Z% Q
- 9 U! n; ?0 v; ~& L% W0 ?
- #include <linux/module.h>9 ~3 J+ L. n- y+ L V
- #include <linux/init.h>) o/ J$ ^7 ]: l+ n
- #include <linux/errno.h>! v/ l" E _! a' T! n# g: [% P7 H# ^8 R
- #include <linux/types.h>
6 ], H- Q/ n* `: q/ \ - #include <linux/interrupt.h>; H9 T) X5 v6 {3 ~7 S0 E) ]
- #include <asm/io.h>7 _, P' J' J Q; X' R3 ]
- #include <linux/moduleparam.h>
& H6 v- w! X3 p; r% t8 v - #include <linux/sysctl.h>/ m% Z0 A* F( t5 H; U* S
- #include <linux/mm.h>6 ^4 @9 X9 T2 |5 K
- #include <linux/dma-mapping.h>& a/ [5 h) F( j5 R7 P
) c3 o6 r, \' W- v( w- #include <mach/memory.h>
8 j6 U, r r }6 Q - #include <mach/hardware.h>
- B' U7 w- A) m' o0 x - #include <mach/irqs.h>
# }5 E4 ~, A8 w6 j; o D - #include <asm/hardware/edma.h>" N2 N% @; S6 w/ A: N
" k1 t0 ~7 {# ?8 ^- #undef EDMA3_DEBUG
$ E8 ^2 c- P6 A* Z; F9 V8 Z% ~ - /*#define EDMA3_DEBUG*/
3 a4 O; b1 l3 V z* n - & ]1 K% J# K5 t! w* a- W. n% q
- #ifdef EDMA3_DEBUG
, a" J+ S& K$ s2 g" Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ F5 R( B+ S- N# W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ O' k( x5 m+ x, f9 V1 u* o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 K2 R# n i( H0 W
- #else2 ~/ ~+ J! S' j9 P/ A
- #define DMA_PRINTK( x... )
( |) |# i5 {( E1 o' j - #define DMA_FN_IN: ~8 F: I+ `/ u) v; j! ~2 S
- #define DMA_FN_OUT$ T) h/ W) I/ T" B# D
- #endif, z6 h( r) g& i5 s
- $ ^2 M( P. j8 D3 |4 \8 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 I. m! n) N: a# f" T/ F7 ^ - #define STATIC_SHIFT 35 M5 c2 }6 i1 L4 V; Z; M
- #define TCINTEN_SHIFT 20
/ N9 Q A0 y m* H' ~ - #define ITCINTEN_SHIFT 21
9 q% }1 [2 W: D+ n& f# ^ - #define TCCHEN_SHIFT 22+ a: q* o! s( X! Y/ @/ K
- #define ITCCHEN_SHIFT 23 E [ s9 }& K, O, w# {8 C
- ! Q/ n; o" {/ H; `- }, _" K3 I
- static volatile int irqraised1 = 0;
. \ T8 ~6 t- V+ z) m) }4 ] - static volatile int irqraised2 = 0;
, o6 o8 ~( @$ L7 p" `6 T( K - , N6 q/ b6 z+ J- ~! B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- B& ]' c+ L& T7 t+ ^; ^" t& t) I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* V) V4 b2 v6 D6 r# B* d4 y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r) {" d& J' S$ s
. E4 _4 Y, \6 L% T, [- dma_addr_t dmaphyssrc1 = 0;
5 u7 X" w5 [8 E2 X7 p7 j - dma_addr_t dmaphyssrc2 = 0; w" c6 O! m- z: g# @
- dma_addr_t dmaphysdest1 = 0;
9 R! z- ]6 b5 L, Q* W - dma_addr_t dmaphysdest2 = 0;' E/ g+ E2 e+ r6 a
- ; J$ p' z6 w9 c! ^, h8 Y% U
- char *dmabufsrc1 = NULL;+ e2 Q" d" i5 J8 ?4 L% `
- char *dmabufsrc2 = NULL;
, d7 S; \$ l" U0 u9 u - char *dmabufdest1 = NULL;- h2 h/ c' D5 m
- char *dmabufdest2 = NULL;& E$ [+ h' u) T7 B' {, ?6 T
/ S- n9 K" a* w2 `3 D+ B6 u- static int acnt = 512; L7 ~/ j" x+ m: R! Q
- static int bcnt = 8;
5 h7 C1 I2 r' w) g' w* s' v/ m - static int ccnt = 8;) A6 K/ z, |( O& d9 w; I
4 F* S# z7 y9 b8 r) i; `1 a- module_param(acnt, int, S_IRUGO);/ Q- J9 e1 w% n' |
- module_param(bcnt, int, S_IRUGO);
- u D8 H5 k- N/ F - module_param(ccnt, int, S_IRUGO);
复制代码 ; t+ ?( N& K$ s
0 z) m1 c5 G7 B @1 w% `' K4 b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 {$ ~- z, K# K( o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ N2 l' j+ F& W$ q5 U8 a+ R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" |2 p/ g3 N, r$ ~4 D7 a4 @, j [+ A" C4 }+ m
+ D8 E* j4 H" D9 Q. Y) F2 X# P; v1 w |
|