|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / x4 a, v* L. i* E, s9 W8 w
- [code]EDMA sample test application$ U$ G# Z7 X4 n+ c3 i) ^# m5 v0 M
- /*
6 V; l' K, _6 [) s - * edma_test.c( A3 r7 N( i, r! x
- *
7 h# w( V* V. d - * brief EDMA3 Test Application, N+ ^( k9 c, f% ~- R
- *5 y1 S6 h2 o( y4 l
- * This file contains EDMA3 Test code.. d; c" g4 V# _! N1 P/ a
- *
/ @! N, u' t* I6 Q. k% @; h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Y* y7 |1 o- Q9 P. Q0 d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- t. C) D4 E' J% `& N
- * TO CHANGE.; ~+ i% e2 |2 g# v0 _3 {
- *
% g( Z" X# F9 W8 _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: v* c+ h1 q9 m6 r a
- *) C: b# _* Q. Q: d. x
- * This program is free software; you can redistribute it and/or% N1 H/ a/ k, @7 j* L
- * modify it under the terms of the GNU General Public License as: h7 l6 J: t* h) W4 c! N9 q
- * published by the Free Software Foundation version 2.
! \% p8 \/ x/ e3 b1 y H R$ w) R: w - *
# T E: r6 G# d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ e3 t/ q1 [! ?: u2 S" a; q2 I2 p% ? - * kind, whether express or implied; without even the implied warranty v' j N1 P3 D9 L$ `2 ~) R' O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' B! o. X, A; D1 x. x9 d4 s! Q- {% r) |- P - * GNU General Public License for more details. G4 Y8 d, m9 w! }* H! X
- */
4 @. _: t1 }, P; B - 0 |' ?' Q- e6 ]: H+ |" c# `
- #include <linux/module.h>2 w2 c# s2 O! ^# x: D6 n2 Y2 l9 [
- #include <linux/init.h>
f! _' `5 T3 v7 o; e - #include <linux/errno.h>* L1 T* g! ^( H/ m2 I. y
- #include <linux/types.h>3 f' P7 l( d7 C0 s# C1 [, Y
- #include <linux/interrupt.h>" v( {4 n, T# a8 a
- #include <asm/io.h>
2 S+ {9 E- h8 r& M9 C& N - #include <linux/moduleparam.h>/ M3 [9 X- n H* o. W$ m/ f. b
- #include <linux/sysctl.h>
* T# |* G' L( {1 ~ - #include <linux/mm.h>
7 a- q0 i) S- r$ l5 W4 H - #include <linux/dma-mapping.h>: B/ Q1 j# c B2 k0 y) {* a
7 p5 s' Q V7 |' G! X I: M0 e- #include <mach/memory.h>
$ u' v* g \& B& E9 _4 G% H1 I/ ] - #include <mach/hardware.h>5 X6 r$ |1 W) ~ J
- #include <mach/irqs.h>0 P3 J; p! R. ]) E
- #include <asm/hardware/edma.h>/ s0 ~$ b$ l# D! f6 }
- - Q! _6 J+ I9 Q
- #undef EDMA3_DEBUG
# m0 _1 X6 u+ Q, h4 B& ? - /*#define EDMA3_DEBUG*/
, l# E! s3 H4 ?, r' }6 @+ ? - 8 n* S8 J3 ~" T) b
- #ifdef EDMA3_DEBUG
3 \9 R* f, A- _+ F' s/ P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( ^; w) W q0 S4 Z$ N; ~, i7 e) A; ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# A/ [+ h' M4 I6 v. F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 R5 R8 l4 t8 P3 F+ F- V
- #else1 ]" O" B r! p$ p$ \
- #define DMA_PRINTK( x... )
3 k# h/ f3 ? ^3 }# x - #define DMA_FN_IN# l% L2 y" Z/ P" x: Y) d/ t, g
- #define DMA_FN_OUT
( I6 v, @7 M+ `# P' H! F - #endif
! G' v+ [8 v7 k7 Z - 7 S+ ?5 p0 ?* X' X; r+ U5 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; D4 D# N0 ~$ ` - #define STATIC_SHIFT 3
. F: U% ]* p& b! O! I2 _* L6 z - #define TCINTEN_SHIFT 20
- G% E; f l+ m' X( j# |* H+ w7 G - #define ITCINTEN_SHIFT 21# O) J& |* ]! l4 ^& h6 ]6 {( \. e
- #define TCCHEN_SHIFT 22
{ `; T7 z( [( c" e) R3 G: Y - #define ITCCHEN_SHIFT 236 E& c+ S# @$ v6 Y+ H: y n
- , t% C9 m% b1 |. X6 ]3 H' \
- static volatile int irqraised1 = 0;
0 Y: F M1 e4 y' c$ s2 c - static volatile int irqraised2 = 0;
( F+ f+ C1 n- f; q' M b
8 ?) I/ b# J5 h1 `! }& I/ l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 f# _; C: W: ^, ^2 s* z* {/ n" M a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) C- m7 ~5 e0 B/ x( x$ L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# c7 F5 e7 }( G" ~, S* C h2 X - 2 X Y/ e7 q& D* p* }+ k
- dma_addr_t dmaphyssrc1 = 0;
/ v( g* p, L7 A: b- F - dma_addr_t dmaphyssrc2 = 0;
8 T; }! ?9 q% p5 H# }! S - dma_addr_t dmaphysdest1 = 0;
4 y' [' ^. o/ A( f* W$ k0 [ - dma_addr_t dmaphysdest2 = 0;
, y# |! A7 f9 @6 a P; {3 N
0 G$ }7 x7 P* ]- v! }8 m- char *dmabufsrc1 = NULL;5 @2 e @9 v: L( z
- char *dmabufsrc2 = NULL;
: @. ~2 C& w$ m9 R* y; l- r$ G - char *dmabufdest1 = NULL; D! e% }" s4 I+ G$ H) y
- char *dmabufdest2 = NULL;
2 n1 H# @& H2 f, x$ D8 d - ) w2 N6 F$ @5 h" ~
- static int acnt = 512;
z6 U5 F3 z& O q9 z - static int bcnt = 8;! R! c7 G5 o/ y7 {5 i
- static int ccnt = 8;! M+ X0 u& f X7 f' n3 q/ F
. k4 [5 ~2 `0 {- module_param(acnt, int, S_IRUGO);
P% Z$ y! f; k4 n$ T5 P - module_param(bcnt, int, S_IRUGO);
9 ]* [3 d- x- I" r( _( A. U& _' c - module_param(ccnt, int, S_IRUGO);
复制代码 ( G/ G |5 s0 Q% a
5 p1 N* {) m t$ D t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 R) Z) t3 H9 s3 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- H9 d% T7 P1 C, U6 P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 ?/ q- n6 |' _" g( ?1 P1 M3 U& u! m1 t Q% Y* t) e
/ g6 J* z4 C' L* J; u" a |
|