|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 j- H1 w8 w: x- R0 e8 o
- [code]EDMA sample test application
: i& M+ P& X( D# W4 k7 l/ q - /*
$ ~& F# z* i+ T& N+ }& N' Q - * edma_test.c( o# Q2 i! h/ h/ ?' _( E
- *) C; U. j% Y/ ~' w
- * brief EDMA3 Test Application
( q+ [& u& H \( M$ @ - *
% Y* D, M0 n$ b9 G- s) u/ w3 O - * This file contains EDMA3 Test code.0 @* T9 I+ T% D/ M2 d0 |
- *+ w. C& a7 D$ o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- e, i) u4 l# Q1 X$ V# C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) ?8 E7 c+ r8 o; l" D( W6 ]( R - * TO CHANGE.
: J: I" p3 x. z( O9 `) |$ D/ A - *! P" p) `2 t) z+ l& C& v$ I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 k$ z. T4 e% U) ?
- * P! M! g8 y" B. F
- * This program is free software; you can redistribute it and/or& y4 G) W# \! T2 C
- * modify it under the terms of the GNU General Public License as: ` I0 v f$ A0 `; O4 z; j
- * published by the Free Software Foundation version 2.; n5 p$ T+ d! ^0 J
- *8 i$ h% I/ O% m! _2 W* d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. t. x. E6 r) ?4 _4 J# M
- * kind, whether express or implied; without even the implied warranty
( k3 A6 \, q/ w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, c! T0 p% T1 o: A ~
- * GNU General Public License for more details.
9 n( n2 s5 q7 }) E/ P" N/ A8 a - */* p# w3 g2 Z7 n" \+ m
- 3 A& c" Z& I! w) `
- #include <linux/module.h>' ]# x% f" e, y9 }) _2 U7 X# v& s" k* u
- #include <linux/init.h>& Y1 W& R$ Z, R6 ]+ E6 d
- #include <linux/errno.h>
. ]/ k- l! P, Y/ b$ P - #include <linux/types.h>
+ F& x0 Z4 q, s# Q8 f6 O - #include <linux/interrupt.h>
4 M0 n% ?4 m) ~; ?* Z' ~9 k. |( L+ x - #include <asm/io.h>8 r t' a1 `3 |+ i% {* x; U5 P
- #include <linux/moduleparam.h>
' v1 K6 w4 J$ ^* n( u V( L - #include <linux/sysctl.h>1 P& o% } @8 N( D; [* Q
- #include <linux/mm.h>; P; b/ ?' S0 H8 W: H2 d
- #include <linux/dma-mapping.h>
/ j3 \0 {; q7 H/ ` K
* g2 K- q& Z* P5 t" w- #include <mach/memory.h>( m% G# C4 d' z ]/ ` F
- #include <mach/hardware.h>; u% n/ ?4 E; {. a- _5 _7 c9 X2 u
- #include <mach/irqs.h>, T' |3 p. o+ P1 S) W+ [ \8 W1 a
- #include <asm/hardware/edma.h>
3 n& k, G; H5 P6 @0 X% c# D
: {& S" d/ @% W0 w* H3 m; J- #undef EDMA3_DEBUG
7 m0 J2 g/ p" ]( a) k: D - /*#define EDMA3_DEBUG*/
% E7 H+ U' N1 S, h6 o: `
" ], O1 R& H, u/ |9 R; \+ ~- #ifdef EDMA3_DEBUG h8 c- u; N! o. \" c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 T2 `/ l1 l+ b" d; b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: C1 D) |; ^9 @& G' ?1 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) e& T5 l5 J& M2 U5 o
- #else" ]/ O/ g+ z$ ~+ Y2 y7 V
- #define DMA_PRINTK( x... )* {4 ?: B8 l! v1 \9 U
- #define DMA_FN_IN* C* s2 o7 Y- O2 R4 j" Z
- #define DMA_FN_OUT, d/ q1 |( F; L3 N. @& g7 q
- #endif
, |2 l I ]8 b+ L2 k - : M* C2 r2 B. H1 u. `" U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): r4 D7 W# W2 v2 m% Q
- #define STATIC_SHIFT 3) [* v+ D8 O6 p, S
- #define TCINTEN_SHIFT 209 b g1 w) V0 V% m. k/ e$ g$ `
- #define ITCINTEN_SHIFT 21
! ?6 a0 ~: s" e# t - #define TCCHEN_SHIFT 22
. Y( F- T9 n6 S% R7 D - #define ITCCHEN_SHIFT 232 G! j f3 \7 n$ [
- 3 k2 }- j5 `2 e
- static volatile int irqraised1 = 0;
, [2 u7 }- c3 H; `) B# D1 N" P - static volatile int irqraised2 = 0;5 @3 |7 O) J- h$ ^/ q
- ! Z" `4 W" p' v% `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; E" R$ l0 K- |7 g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 C# O/ k4 z+ k1 e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! P0 o( y" n5 S
- . a" @; a* A7 F! @ C3 i
- dma_addr_t dmaphyssrc1 = 0;/ {, x! d! A6 `. f/ P2 F; y
- dma_addr_t dmaphyssrc2 = 0;& t t3 d$ W7 n9 d
- dma_addr_t dmaphysdest1 = 0;
3 j( i+ j' I C/ x0 A, O0 U) P - dma_addr_t dmaphysdest2 = 0;% H; n5 x3 A0 e( J4 n% W: K
5 N" g" F8 w+ [- R; G/ x- char *dmabufsrc1 = NULL;8 t- }+ W; E" m0 S) U# l9 v# Q8 P
- char *dmabufsrc2 = NULL;1 V* q0 v* h/ n; U6 U% l
- char *dmabufdest1 = NULL;, e' H& C: k! f, L
- char *dmabufdest2 = NULL;: `& T: b q" g: G9 F5 [
; M1 |+ w+ _6 m1 B- static int acnt = 512;' x7 D. a/ ?. f- d
- static int bcnt = 8;
1 M7 [. H& }5 n; O4 V8 O - static int ccnt = 8;
3 S1 c8 d# e0 Q0 q5 I$ T - & f2 k; ^) V S
- module_param(acnt, int, S_IRUGO);! G6 }9 v1 o: l+ M
- module_param(bcnt, int, S_IRUGO);
; `4 A3 |' A3 B - module_param(ccnt, int, S_IRUGO);
复制代码 . u4 q3 l8 b6 Z
4 n w" o" f5 m) { I% C& e* u' A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" ]) U7 e1 O L& ^7 I: H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
v8 d7 C; g8 O8 s( M" X$ P4 M* |9 o5 X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( J. x) @% p& Z5 i1 ~ n1 V: Y! K1 H; o6 [+ b) [ x# { i
" S$ O. _ Z, r' f! t5 S |
|