|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 u( k2 D# h( o; V8 k/ l
- [code]EDMA sample test application" j' q" s1 C" V+ j% d& Y! f
- /*5 O7 c4 G9 A( L; S0 {+ H* I5 \/ ]1 F& K
- * edma_test.c) s& B$ V/ k# w# m: ?. p( T
- *% X6 o* a, G7 m. t4 c
- * brief EDMA3 Test Application
5 I0 o8 K, L# H9 Q- p8 u9 C; o - * n% {6 e: A- |. F7 U
- * This file contains EDMA3 Test code.
' w4 }" P, p: ? h3 _+ ` - *: \) x- r9 ]+ Q( s. l- S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ D7 Q; n6 N- q8 N. ]% [, C) j( l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; r- @; r+ `4 M1 e - * TO CHANGE.+ X4 f( e; a# K# i: p' b' _5 o
- *& V# v7 n5 w+ c6 {; u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( ]* i% f d0 u x+ E# L - *
9 R! g' W/ j. H2 @/ ]$ W6 } - * This program is free software; you can redistribute it and/or
9 t5 F, T3 o* n, X - * modify it under the terms of the GNU General Public License as6 S' d; h8 q6 e( A/ {" R
- * published by the Free Software Foundation version 2.) Z/ Y! W' Y( z6 _/ c E* b
- *
. b E. B( F+ J6 Z& s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- ~9 F$ f) _; s- f" W; `7 |0 G
- * kind, whether express or implied; without even the implied warranty6 }7 H, h2 C% G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, m$ H" F5 I! |, f
- * GNU General Public License for more details.
5 A" ~* h0 O2 w. L5 @ - */
5 k: w# ~/ V9 `; Q1 A1 i0 n& G4 L
/ M& M9 \/ I) H; l7 }6 V- #include <linux/module.h>- j. Z% a- A4 ~2 c% O
- #include <linux/init.h>' T. Q% {2 T( M
- #include <linux/errno.h>9 h* V8 z+ y% Z# P6 z% d
- #include <linux/types.h>. t" H* f) E( e9 A
- #include <linux/interrupt.h>6 X0 K2 ~) i5 Y0 z0 {
- #include <asm/io.h>
* A+ m1 ^: g0 L% B$ X1 e7 j: L - #include <linux/moduleparam.h># k2 m8 b4 L% }4 H. T0 o) W+ o( z, c
- #include <linux/sysctl.h>- D9 C6 Y8 r+ Z/ j. @: A
- #include <linux/mm.h>4 t6 j! y- D9 D5 I5 c
- #include <linux/dma-mapping.h>8 C& P% G2 g- q; }
4 _) k$ V7 E) j. I1 _8 `* L- #include <mach/memory.h>
3 U- m. @, W! b9 v( s - #include <mach/hardware.h>
+ E3 Z; X/ R& x/ d - #include <mach/irqs.h>' u% k9 m6 N9 u" \* |4 B* }
- #include <asm/hardware/edma.h>1 ^0 \% ^$ I# R, Y
- . X3 o0 C" B) I% m) D
- #undef EDMA3_DEBUG' N y* e2 \- J7 m$ @
- /*#define EDMA3_DEBUG*/, A$ h: l& m! h! K: h, x
: q+ Z& X, I2 q8 ^- #ifdef EDMA3_DEBUG5 C% ]+ f$ h7 H7 |# a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 ]. n' U+ d8 t1 E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& [) O% v9 s. _' z1 K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): E" ~/ Y2 L/ h9 c
- #else" K- h! N3 X0 y9 y8 u; n
- #define DMA_PRINTK( x... ); ^: B/ `1 S; }, G, S% e- B
- #define DMA_FN_IN5 G3 [2 M' ^0 b& R& e
- #define DMA_FN_OUT
( r" G; j3 r! T$ x% `& X$ ^% | - #endif
: ~+ z/ |* E s - * E4 v* F0 W5 F; w5 ~7 Y A# u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ A- v! Y, j% P4 |; T - #define STATIC_SHIFT 3
! w) U n/ O' k: y, f$ f, s - #define TCINTEN_SHIFT 20+ ~) W/ [7 W" C2 c' L
- #define ITCINTEN_SHIFT 21
# l2 H X2 i' r* T$ A. T9 L - #define TCCHEN_SHIFT 229 y: h- p) ] ~+ e. {1 c. V" T
- #define ITCCHEN_SHIFT 234 @0 l: m# B h
- 2 t3 K% ?7 A( R# l& q2 J
- static volatile int irqraised1 = 0;/ R: p/ L2 j7 _, q8 s
- static volatile int irqraised2 = 0;, l4 }( y; ^+ J4 e
- 3 m- w- m4 W; S2 j$ I# g# W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) D0 p! ^* b% X6 @3 F$ g8 A$ |! W9 ^4 g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I9 X3 n+ [5 H, P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 e* Q+ `* ?, | - 8 `+ J. M2 j, |! I5 E Q. ^
- dma_addr_t dmaphyssrc1 = 0;; m. a" W6 Z& K( p& d b
- dma_addr_t dmaphyssrc2 = 0; v1 s1 E3 ~3 e( P! D8 B' y% S" U: y$ P
- dma_addr_t dmaphysdest1 = 0;( X a7 b5 x) T, ~& z, w
- dma_addr_t dmaphysdest2 = 0;
8 G5 i0 u& w( h2 K: h - % v9 f* C6 u: v1 k9 a
- char *dmabufsrc1 = NULL;
+ f7 Z/ S# G7 k/ p: w. b2 ]* ] - char *dmabufsrc2 = NULL;
6 C3 }/ t L! [8 j1 o - char *dmabufdest1 = NULL;& C& I6 n2 Y& x$ K
- char *dmabufdest2 = NULL;
/ m7 F$ E0 E4 e C5 i6 ~
/ e* { o: k0 D1 G- static int acnt = 512;
8 E0 l6 N. m7 M- d3 p( F - static int bcnt = 8;/ V" _8 w. I6 G9 ~: E
- static int ccnt = 8;
" \1 ?9 ~0 t/ |" {& J6 a
, H1 g! D- k! T3 u- module_param(acnt, int, S_IRUGO);
3 ?9 B! ?4 b8 i) ]/ K* N n - module_param(bcnt, int, S_IRUGO); x) i$ P* r9 N: b" B& ^
- module_param(ccnt, int, S_IRUGO);
复制代码
3 j$ }. \. y8 K( E/ G6 Q% _) W/ c0 }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* y2 V; p+ f5 [1 s5 d( i5 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* e( s7 t4 a+ r a2 j y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* N. y( S' @3 u' {3 ^1 e, `# G
/ p. m7 L% c- u7 D& L
+ ?$ e5 t3 g' @) M% f
|
|