|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % e# Q- |' E0 v) g8 e( ~) [) \
- [code]EDMA sample test application/ p# K/ `* o% \* K: Z& I/ f
- /*
& _6 V* |! t0 I" r - * edma_test.c, ~) P( ?3 j. `) w/ W
- *
4 P- X% H" @0 g7 M) u9 ~ - * brief EDMA3 Test Application2 M+ v; J$ R, n) T1 g' t
- *, J K, |: ]0 b! r+ t* @
- * This file contains EDMA3 Test code./ E& j% a, @' W
- *
, S: B' J' i9 F% q! O* A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 d+ h+ h' d% U3 w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- q" w) O8 c7 z - * TO CHANGE.
" N% |. w% X3 e( _2 \: H - */ o+ c0 g4 @& w3 w, g7 l% I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 p3 m: D( X4 C8 }8 J+ Z' C/ X
- *
o* ]" J' c$ `5 D! y0 _; l - * This program is free software; you can redistribute it and/or
8 E2 a' ]' K* Z: i - * modify it under the terms of the GNU General Public License as% D8 D' O$ f, S, q
- * published by the Free Software Foundation version 2.
6 b$ m9 B4 u4 ^: _8 [5 u3 R/ p - *+ x# g3 N# k3 I2 X; w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 a0 `% n% J9 L& _7 w
- * kind, whether express or implied; without even the implied warranty2 w, m' u# b, O- }6 I! w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. j; ^2 b$ M" J5 l4 a0 G" Q
- * GNU General Public License for more details.! r7 m+ p$ C. V/ b% m1 r
- *// I! n9 R2 z; l8 n2 l. P* F5 d6 t
- 5 p, r0 @. x, B, ? I5 y, Z
- #include <linux/module.h>
, o$ n$ s' w. I/ j7 x' |( ~ - #include <linux/init.h>
8 V9 q* h% S7 Q0 R+ J - #include <linux/errno.h>
2 [% f" b. k, C0 m6 h) s - #include <linux/types.h>% h" w* Y1 N$ a9 B
- #include <linux/interrupt.h>
/ I7 N. r5 C. ~) X - #include <asm/io.h>
+ A: ]; e7 E, U- o9 X, T" _/ c/ Q - #include <linux/moduleparam.h>
# y* m, T1 Z% O) X9 K6 @; E - #include <linux/sysctl.h>
+ r! Q: _+ \6 K: p5 Q6 M% O - #include <linux/mm.h>
* ^9 V5 }+ I4 B& e6 Y; w - #include <linux/dma-mapping.h>! L, i/ R5 F0 x$ g+ b6 n, M! p
- , ]7 I* V7 A- z1 r a }! `* H7 Z
- #include <mach/memory.h>
% Q; s) T$ _5 ~7 C. C - #include <mach/hardware.h>: t/ Q; I9 f- e% d+ B' ^# Z
- #include <mach/irqs.h>
* o% ]# |6 {4 k8 ?$ L5 {$ ? - #include <asm/hardware/edma.h># r; {. T: x! L) ] {: V3 S
5 Z9 U" I8 _4 w/ L- #undef EDMA3_DEBUG& d' Q) c$ t; @1 Y( j' X
- /*#define EDMA3_DEBUG*/
0 P* \( M+ I0 {% T s _: N# _ - ( `" M+ p1 [$ ?( a1 b
- #ifdef EDMA3_DEBUG
- D1 V& L) }( ?2 D& w/ E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); Y! W' }9 A c- _( G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# @& n2 h' K) K Q2 v, y$ i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" }& P4 m7 n+ E, z
- #else5 n' G1 k( p/ A0 A. f! e* W
- #define DMA_PRINTK( x... )8 h: J& P4 s/ v
- #define DMA_FN_IN
6 k) T4 M3 c' \% q3 V) P - #define DMA_FN_OUT
; G6 u0 {8 _: _4 Q - #endif9 g1 X( f# y; `. j7 h
8 q: r+ w# t" Q1 ]9 }( h" f! T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 o( U: l+ t; Q - #define STATIC_SHIFT 3/ z) ~4 X0 l; l! R
- #define TCINTEN_SHIFT 20/ f$ k) v4 B) V+ D& E% b
- #define ITCINTEN_SHIFT 21
F1 e! D5 R2 h6 e - #define TCCHEN_SHIFT 22
3 p5 O9 H: d0 @- ?% v, R; V; U# F1 X - #define ITCCHEN_SHIFT 23
: Q% i7 K8 T5 B: y - 7 ^: r7 V# K$ n6 M" S$ _
- static volatile int irqraised1 = 0;
) `9 K+ A. j2 y - static volatile int irqraised2 = 0;; k. y$ F* \* L
- ) b6 H; |1 a$ E, K, d0 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- P. |5 ~; `1 y, B( e( E3 Z, p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, n6 g4 m7 i3 T) U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, y' N i* W) n h% m
) H6 j5 E8 s" ?; A* _- dma_addr_t dmaphyssrc1 = 0;
3 a! [/ v7 O" p2 x7 c3 T - dma_addr_t dmaphyssrc2 = 0;) W4 m! E1 ]6 u7 S4 ~* G |7 k
- dma_addr_t dmaphysdest1 = 0;
" c- T# `0 o3 V) Z" X - dma_addr_t dmaphysdest2 = 0;
9 k; e" q& g& P1 i( R7 z4 m0 j
: s5 |7 n( H0 Q( l- char *dmabufsrc1 = NULL; W) S, W$ F1 ]4 \: D0 N+ @8 ~
- char *dmabufsrc2 = NULL;
y2 ~6 K! }: i5 `& S - char *dmabufdest1 = NULL;
7 \+ X% C$ r, ~ - char *dmabufdest2 = NULL;
, h2 `/ _- v/ K* ]+ C
# D1 n) Q+ i2 y* @; h- static int acnt = 512;
* c$ ?5 u$ z5 p3 `, j - static int bcnt = 8;
" P0 s5 k; b; p* f1 D! q/ S- g. {6 \ - static int ccnt = 8;
# R6 C: e! _9 m% o
2 S) j1 Y4 L7 U9 s- K- module_param(acnt, int, S_IRUGO);* M" N" T0 B8 s; H) t: N
- module_param(bcnt, int, S_IRUGO);
9 |8 p; s8 r* s0 A - module_param(ccnt, int, S_IRUGO);
复制代码
2 ~: i0 `$ E7 d: C
; P+ f8 d1 A$ B6 S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 B! r; f! I7 ~% B+ L% e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, b7 T9 u/ Y. D4 [+ y( |3 [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" I7 q+ C" B0 W; S
9 \% B. N {1 ]. z% w# t, i+ M( @( j- b$ J7 ~/ H0 U2 J9 \" l
|
|