|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' G0 w" l# e7 [* D6 ^# V
- [code]EDMA sample test application6 m5 m% e( `* F3 o- L( _7 d% [" o- C
- /*
: m- @: j; z5 u2 h* [) c - * edma_test.c
1 N$ R) j4 _+ } - *) l- |* }! V! O$ G, ^
- * brief EDMA3 Test Application
M1 ~! E7 \; P9 ^1 a - *. k. E" v$ l' Q! w# j4 c
- * This file contains EDMA3 Test code.
, n0 g X( v2 r! U! @8 ^ - *
0 V" F% ^& Q1 q; Q2 ?2 ^/ K/ m$ l- W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 a7 Y- \: z; g& X8 P+ j; ]4 [+ p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) [9 y4 b0 {" _4 u- Y+ p - * TO CHANGE.
% }) S' T* N* U2 n W1 m, h3 |! ~ - *
7 w& S; ]; t# U* J$ S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! y6 a$ ~ C1 s2 F
- *, L; d- H! K. y6 F6 O
- * This program is free software; you can redistribute it and/or: }6 ^# g) x0 V4 S* A
- * modify it under the terms of the GNU General Public License as; h9 E3 v t9 c3 J2 @
- * published by the Free Software Foundation version 2.
9 U2 G0 R7 @2 H J- { - */ k! e! D/ V6 _1 e, _3 \7 c1 { E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 E( @2 G, v) m. j
- * kind, whether express or implied; without even the implied warranty2 r/ K2 @: p3 Z/ C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 {2 L, G3 q7 m! O
- * GNU General Public License for more details.2 k/ g K9 E+ \! M
- */. d: j4 |1 O- r' ^
- $ M0 [! p6 g( [8 Y9 [; [
- #include <linux/module.h>
, p* d6 d+ Z' p0 y! k - #include <linux/init.h>* C% l3 _+ @' M; y# G3 R& Z1 R
- #include <linux/errno.h>
( l% _3 W5 q& R8 L, U3 x1 { - #include <linux/types.h>5 [; J) x* C& X O2 \' y- c
- #include <linux/interrupt.h> }" B9 R# y$ I' u7 y& u
- #include <asm/io.h>2 _! m* e4 K: |1 b9 H. c
- #include <linux/moduleparam.h>) j. c& ^# ?9 s/ P8 q
- #include <linux/sysctl.h>
W% x! N% Q. K3 e; u# N - #include <linux/mm.h>
5 a. ]2 X) H2 {( C/ P) e8 q - #include <linux/dma-mapping.h>
$ ` L y. V+ H+ Z9 z
. }! C2 ^( m; A9 h+ w- #include <mach/memory.h>
# k$ Z5 R- e y) V; {- q6 ^ - #include <mach/hardware.h>, ~* L# \4 I9 c2 u$ b" h* z
- #include <mach/irqs.h>. @) E! y/ t( S n+ s( d3 R+ I
- #include <asm/hardware/edma.h>& T- c( x& g: h6 i
- + p4 z5 Z% O! H: r) m( d
- #undef EDMA3_DEBUG
$ A5 U9 S- ~5 _! h& g; U( V - /*#define EDMA3_DEBUG*/3 [- U2 V2 k8 S; K
) \+ \8 f, f! g2 p- z% i% n- #ifdef EDMA3_DEBUG2 x* L" s d: u5 j; y0 m8 E3 M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; w" G2 }( p' J: g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& U6 z4 x L# O9 u6 E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; y( I/ E: E- @1 w - #else) i3 c3 M, W2 F0 X" }0 P
- #define DMA_PRINTK( x... )6 b! R4 J$ u+ j8 b; X9 H6 C6 t9 c
- #define DMA_FN_IN. c9 O) }) i1 X, H) }
- #define DMA_FN_OUT
+ `$ d5 t3 g; I) e - #endif/ q* t6 i( P$ `# V
- . A4 q1 r3 c: l2 K- H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" b( W: p% P3 g/ @) _ - #define STATIC_SHIFT 3' e# ]: R* K3 ^" ]% v4 @- f
- #define TCINTEN_SHIFT 20) Q( l) s0 s! B! Z" Q. U: k
- #define ITCINTEN_SHIFT 21
# _( p O! j+ r0 Z - #define TCCHEN_SHIFT 22$ _/ M5 F! b7 h& I- L: L' [
- #define ITCCHEN_SHIFT 23
& I( r7 j( F7 }+ S% I
5 t8 W& |% T3 b4 A G/ ?- static volatile int irqraised1 = 0;
# g# _; y* R% N+ L3 E - static volatile int irqraised2 = 0;0 R/ U) \6 [* A
; h) `7 H8 |$ z" `0 {; n5 Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 [6 n8 G1 N1 u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Z' a9 p/ s( M8 r- c4 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( y, {- L' ^7 `! O; u) L/ e+ g
7 C2 G8 w X. }) K- dma_addr_t dmaphyssrc1 = 0;
4 `$ n3 L* g- K: p' J3 j+ k - dma_addr_t dmaphyssrc2 = 0;& o7 m' C1 J- S" n1 h
- dma_addr_t dmaphysdest1 = 0;4 S. J- B% e$ E
- dma_addr_t dmaphysdest2 = 0;9 W2 c2 T* ]8 b. {5 X
- " g; h: V0 G R% Z2 `! [- ^" J
- char *dmabufsrc1 = NULL;4 O* f: m( u; o
- char *dmabufsrc2 = NULL;
0 g3 x1 H: t( j# \2 a, o+ H - char *dmabufdest1 = NULL;
; W5 m, q5 m. Z - char *dmabufdest2 = NULL;; C s8 N: |/ C" C- h$ L
- # T8 {/ G+ V5 ]% `* V9 p
- static int acnt = 512;. |% z* ?. T8 v+ p5 N( [
- static int bcnt = 8;
0 G: S; I2 Y5 T( [ - static int ccnt = 8;2 m8 Y* n$ B6 m1 S
% P/ s, T6 R4 _ _1 n; m- module_param(acnt, int, S_IRUGO);& W. _0 I- k8 F' c
- module_param(bcnt, int, S_IRUGO);( ~7 r. Q' l. Y) z, V
- module_param(ccnt, int, S_IRUGO);
复制代码 3 i6 k$ q. {9 v" y; y( ^$ H' m
. j: d; b1 L0 p+ Q7 t3 B6 [% F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ L) \- ]+ Z" e; k6 P1 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( O( |' A2 K2 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ] U, i3 a3 c. g$ F
$ g$ j& W( v- b5 Q' U$ h
$ Q! u; I( H. d* t* ~; O `7 D |
|