|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( J! t! \, `- f4 U3 y
- [code]EDMA sample test application
2 U) i. e0 u0 b8 }) S; k - /*
5 i( Y& E. t8 R9 x7 G" l$ e1 g - * edma_test.c
& R8 j: S. f3 [ - */ ^: u) S9 \2 Z- F7 U
- * brief EDMA3 Test Application
, a" e% u! D4 x& c/ G3 L - *7 L) b# H# T a0 {
- * This file contains EDMA3 Test code.
9 Q! ?% _- ?7 a* B4 M! p3 V - *& u9 p( M" z* ?4 H( j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 D( |% q3 w6 ]* P4 T9 E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) [ S1 Q, l4 _0 E5 `
- * TO CHANGE.
: p. W: \3 ^3 N1 |$ w - *
/ }7 D, g/ H N1 Y% V4 |( s; p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 [/ H5 B# W3 o' T - *
0 U% B4 J- i" c [8 F! D5 [ - * This program is free software; you can redistribute it and/or) {5 B0 e1 e9 X4 s; h
- * modify it under the terms of the GNU General Public License as: j2 M+ q2 @" `# ?9 ~1 r }
- * published by the Free Software Foundation version 2.( T L# u' s& h2 Q' o1 u
- *
' I6 e: K4 {! Z# M. p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, v3 Q, {# }0 f) _! o# R; z - * kind, whether express or implied; without even the implied warranty
! [3 `& [1 p+ F6 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 K) O/ A% o/ I9 b( f" c; J
- * GNU General Public License for more details.
- ^1 { W, r O2 {6 W3 h. E- r( m c' Y - */
]. c* p1 r0 B" e; U
* c6 u- J- v* R' L- #include <linux/module.h>' K0 t2 G2 M' O1 C7 B, x
- #include <linux/init.h>0 B% ? v5 Z2 e5 ~9 ?% L U- F- i
- #include <linux/errno.h>
7 g- y6 ?, ]0 P( _, _ - #include <linux/types.h>
8 f6 R! u( F1 H! l - #include <linux/interrupt.h>
: U7 G- E! L. y5 d - #include <asm/io.h>
$ |+ f; D" v4 @! O - #include <linux/moduleparam.h>
& h, R8 a- w1 n$ } - #include <linux/sysctl.h>
' F, R) P8 n- Z4 g - #include <linux/mm.h>
. h; Y" ?. E' [4 b) b - #include <linux/dma-mapping.h>9 W( f H7 P' L! ]" w
8 k3 a2 s- g5 k( O& o0 u2 T- u- #include <mach/memory.h>. a6 _- A4 k' L; W
- #include <mach/hardware.h>
( X& [) s8 V9 ~& L' K" Q - #include <mach/irqs.h>
/ m9 \8 m# m4 H - #include <asm/hardware/edma.h>
0 j6 e* ^0 K+ K4 J4 {* U; B - ) {, ?$ V. q1 m9 k6 a
- #undef EDMA3_DEBUG$ L1 D( B. r: H! d' k H. p% W
- /*#define EDMA3_DEBUG*/
5 \9 C3 X, |; H" `( X; U+ @! D - 5 M# s p* r. `+ y* y
- #ifdef EDMA3_DEBUG
! [4 I. R4 a( f- O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 G. O8 _& L, t% G( G- b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 _0 O. b$ G) U& |* h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& M& A, s( A" m- Z - #else. b+ B, q: U7 T+ R
- #define DMA_PRINTK( x... )
9 m! {, I& R. ^2 c4 R - #define DMA_FN_IN
( C( ]/ @2 X& M1 h+ D1 f - #define DMA_FN_OUT
" i( V( r7 |4 G# g* Q1 Z - #endif
! D# \) T8 x! H% Y7 K& W& R
4 U0 a4 H- b8 m' |1 }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 c9 \7 ]' F4 ^( |" A4 i, l - #define STATIC_SHIFT 3. t P7 A4 ]+ c0 j
- #define TCINTEN_SHIFT 20& a' C* J5 I1 A0 }1 u! j
- #define ITCINTEN_SHIFT 21: ~. w! ?* |3 g; s7 U. X' D; e
- #define TCCHEN_SHIFT 22
5 Z. J6 v$ X! d u# r - #define ITCCHEN_SHIFT 23/ P9 |* Q8 {! y' @4 ^6 j
" Q0 z' ^, l% Y: `1 @7 t, c( L( f- static volatile int irqraised1 = 0;
* H* o& M! Z- B" P; q; R - static volatile int irqraised2 = 0; \3 `8 J* @# f9 S5 X
" B( _- T( O, k6 x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); D; B5 G8 y* m& d- j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( m' w- J# D- ]/ l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* \) ~ s3 g$ q5 c6 d - 9 t! T8 m4 x4 d* G* B
- dma_addr_t dmaphyssrc1 = 0;! L/ m, [5 D" m" d6 t1 Q& ]
- dma_addr_t dmaphyssrc2 = 0;
# y3 y8 U: r- o& v7 e& a% @ - dma_addr_t dmaphysdest1 = 0;
, ]7 a0 N' o9 e, n Z: V - dma_addr_t dmaphysdest2 = 0;% v& T4 Z7 c* ~$ ~* O4 m: T
- : C8 f4 V9 \5 q# L4 m
- char *dmabufsrc1 = NULL;
2 l, O, n# K0 {2 I6 l, |& y - char *dmabufsrc2 = NULL;
$ Y2 V8 @1 P# z, n5 e/ q+ Z - char *dmabufdest1 = NULL;
1 t; q. _9 ^8 Q% j! \8 B% _ - char *dmabufdest2 = NULL;3 a( r- U7 h6 I" X
- : s$ f( Y9 E# K% o" I
- static int acnt = 512;
0 a5 y8 u+ \4 [- U8 H - static int bcnt = 8;& o& A! x ?( r/ R9 G% A
- static int ccnt = 8;
. ?9 e) m2 l2 ]# u! X% ?
; e/ ]9 d7 x: Z8 |- module_param(acnt, int, S_IRUGO);) R+ o& x! m. U
- module_param(bcnt, int, S_IRUGO);
& D; X- j) ^5 D1 X( Q - module_param(ccnt, int, S_IRUGO);
复制代码 / |' @. [" w* K( t/ l0 O1 |3 z2 g
9 F$ `/ a" P3 T$ e! e d+ y: p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& Z1 W: W8 W! Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) u4 }' M9 m. ~2 K( l$ b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& T' @6 Z: T/ E
( {' B9 @( h# D3 J; T$ |5 F9 B( b
1 p& j3 X5 b* _7 T
|
|