|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. P3 N3 l; \2 E7 ^+ j! c- [code]EDMA sample test application) s6 F% g- }9 R
- /*
, {8 A) M. V% N, X7 Q' v$ q4 X - * edma_test.c
# s) Z# u2 q# d1 h0 O+ a3 W- c$ N - *) L- z, g! d1 D* f& B: Q& C# ~
- * brief EDMA3 Test Application
5 O9 y$ Y/ ]2 R/ V - ** I" f8 r( c. f8 b9 u
- * This file contains EDMA3 Test code.
5 }7 ^$ D4 j- ^2 S5 w' t1 k+ e t - *
* n/ t: U! p" E* J3 _8 e' |9 P+ T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% l9 [: w U9 f U6 q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( y0 t& k: e3 _
- * TO CHANGE.# C1 S, g/ I q" m! _
- *
) j5 O" x1 V" ~2 a8 Q, ]- P! X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 a2 K4 ?$ }6 j- }) u, E - *
/ q- R2 d# D. e- X - * This program is free software; you can redistribute it and/or, {, \/ c i V, w5 O6 ?& _8 o$ S
- * modify it under the terms of the GNU General Public License as' {4 N |9 _' s9 M+ D
- * published by the Free Software Foundation version 2.1 s+ e/ U$ {( g/ y3 k
- *1 Z1 Q( K1 \1 K" t- s5 t% v/ A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# K' p/ V* O5 N5 _! J - * kind, whether express or implied; without even the implied warranty
+ ]% P2 K/ c+ Y$ g1 s. S2 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 \7 U7 g) _# A- ^7 `0 S/ i1 z' k
- * GNU General Public License for more details.
8 N& _5 Y; i9 ]' _ - */
# e2 D0 x7 N. v. V! m - , b& X$ A! L( }
- #include <linux/module.h>$ |2 R( _# y% D, G. ~
- #include <linux/init.h>8 |, v. \4 I0 D3 d2 b; s+ `( x i0 h
- #include <linux/errno.h>
* P* p% }( ]$ d) l! o4 v0 X( A' B# g - #include <linux/types.h>8 M5 T: A" Z% T( n2 `4 t
- #include <linux/interrupt.h>& M; ]% p( u4 k/ ]
- #include <asm/io.h>. ] }' `! A9 m
- #include <linux/moduleparam.h>
' g! r. G" Z+ E& n - #include <linux/sysctl.h>+ M- s' ~! @; i; a
- #include <linux/mm.h>
$ j0 P( p: Z" o3 T - #include <linux/dma-mapping.h>! |* {, N2 x0 c
+ a' ~/ m* A- f( y# }- #include <mach/memory.h>/ l6 u3 f7 P) f/ w4 y
- #include <mach/hardware.h>
! p$ K7 {( h6 t) A3 H/ F2 l - #include <mach/irqs.h>) @0 }* S0 W" d# k O4 B& y# ?
- #include <asm/hardware/edma.h>
1 l0 n6 F! K8 m0 N) X2 Q
* Z3 b7 Y! n r3 ?/ g; `: |- #undef EDMA3_DEBUG1 k0 Q. A; |" E3 J- m, T* y8 r
- /*#define EDMA3_DEBUG*/' F, a* y: _/ g' J: ]1 }
- : p$ q7 L x) _9 e t2 d) a
- #ifdef EDMA3_DEBUG$ x; ^; o" a. A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* U) f$ i( ?& {' N- B; }" Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' b! L8 S+ d7 [/ @& `+ Q( T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ w5 }5 I: B" p4 M7 W
- #else B! `8 ~/ ?" R+ p
- #define DMA_PRINTK( x... )$ Q2 d7 X$ D6 J6 e
- #define DMA_FN_IN/ F p; g$ h& N" z9 \; d( \% D G
- #define DMA_FN_OUT5 T$ _: e' n" i8 |, B( y6 w# J
- #endif
# @* B+ Q+ ?0 x. S. y% k/ J2 e- V+ } - . Q$ ^8 q5 y, }. y- t& A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 w# u' z; j) L9 w( a3 N; { - #define STATIC_SHIFT 3
* [3 @- H; Y7 i" k, V5 ^ - #define TCINTEN_SHIFT 20
7 A$ f1 b) P6 N3 W; X - #define ITCINTEN_SHIFT 21- g, [# i0 u5 [, Z& M0 O% w
- #define TCCHEN_SHIFT 22
: r+ B* o7 a/ A2 `# k! |& Y, S, w5 L - #define ITCCHEN_SHIFT 236 X2 }: o; j* g& G) f2 t- a0 ?( [; t
4 Y) k Z) S4 S( w- static volatile int irqraised1 = 0;$ m9 o: n" } P% N
- static volatile int irqraised2 = 0;
8 U5 v9 k+ G( I0 O w5 F8 z" k
: i# q# d' c% w2 p$ M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% b& Q8 C2 B( x$ s/ P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 W: X9 I3 O+ k- _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# j/ Y# u' y9 Q4 R
; L' [% c+ n K3 @3 t6 ]- dma_addr_t dmaphyssrc1 = 0;* f4 C) j( ^0 L$ t: u$ H
- dma_addr_t dmaphyssrc2 = 0;% ~5 D9 W+ U1 [; q9 X4 F. U! Q5 C
- dma_addr_t dmaphysdest1 = 0;
+ h2 V! ]9 R5 R' w - dma_addr_t dmaphysdest2 = 0;
( w2 A! B- g0 a4 O
6 J8 f& m3 D0 r( M3 u- char *dmabufsrc1 = NULL;
' J$ h, t0 V; A2 ]5 M" F/ I - char *dmabufsrc2 = NULL;$ V; _1 D$ \- c
- char *dmabufdest1 = NULL;
6 u* W9 {- w4 d. K9 W! N - char *dmabufdest2 = NULL;
$ Z7 ] w2 {- C; z& c/ S
+ G6 i. {6 S5 u9 ]9 z& w3 c& X8 C2 u- static int acnt = 512;
5 u; Q7 o" k/ B L( r4 i' L - static int bcnt = 8;; x# |0 @& o% C$ C1 ^9 S: E
- static int ccnt = 8;
" `$ a! G. c& b9 j$ h - 4 J/ r% O; O. G% s; D! ?
- module_param(acnt, int, S_IRUGO);
4 I: h& R- ]5 _) ]. A8 ]* i - module_param(bcnt, int, S_IRUGO);9 d7 ~# S: S4 U' J% N
- module_param(ccnt, int, S_IRUGO);
复制代码
3 d7 w" j8 o. q# v/ z; l% u2 C6 G R3 r. W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 w. s4 w1 V6 F- c! ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) v: V* q* Y5 } @, o' {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ w# U0 O" R; ?+ B2 m5 B5 }
) b* o* s. z, B ]# ^
$ E- `: T C) l8 w |
|