|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 E1 x$ Y. ^9 t3 A5 j' Q; w* K, ~- [code]EDMA sample test application
1 g) o3 R; Z t- g2 @ - /*: O& W- j/ E5 O1 }
- * edma_test.c
3 W% w6 o1 I' n" ~' K - *6 k0 n h4 O- M; r% ]; }: Z& `
- * brief EDMA3 Test Application8 Y a* u$ l9 E
- *! s6 I# q5 E. E% A6 o
- * This file contains EDMA3 Test code.
( ?" T" w/ d" c# T: c7 l0 F* s& I - *
. C' X, U6 Q7 E( F$ w# h+ ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% b* l5 \+ g" [8 V* b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! U: |; ~5 @! P, m5 R- P - * TO CHANGE.6 D8 P4 u0 c! ?" r! R: ^
- *( V" S9 A: `4 Q8 {1 X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 ]4 A5 F' [+ G* |: H6 m* I - ** C$ ?/ s1 |9 g% T/ o4 B9 X! |
- * This program is free software; you can redistribute it and/or
% Z3 A! a* S9 ], C9 D - * modify it under the terms of the GNU General Public License as
* I7 j; v4 H, `' w4 p- \ - * published by the Free Software Foundation version 2.
7 a9 q8 \/ d, M$ _1 H: X - *1 Y: M; y. ~$ l3 S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! \& s+ [' a- q
- * kind, whether express or implied; without even the implied warranty
" y/ c; [% f _$ e& C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# w. H7 Z- t( J - * GNU General Public License for more details.
$ `( e- p& a- _+ @& s0 Y5 I* u; J9 n$ F - */% ~! D8 T9 x! ~; S; Y, Q" X
4 |, ~3 {4 ?! U+ P6 D* N1 Y# f- #include <linux/module.h>0 c( F# d5 _5 A5 K- C
- #include <linux/init.h> q, i8 F- ~; e8 g8 t( f
- #include <linux/errno.h>& ?: S7 `* x1 Y' N
- #include <linux/types.h>, u" ~9 o" G! E/ m9 M
- #include <linux/interrupt.h>. N" T- D) K- r Q9 U
- #include <asm/io.h>
& {+ Q, E1 V! E5 u s0 X - #include <linux/moduleparam.h>) Q/ e" b9 [* y* [5 s, y. u2 {% L
- #include <linux/sysctl.h>( O; S7 r0 r4 l% X- J" z! ]1 U
- #include <linux/mm.h>; V) ?) u: z- T, ?! N& @: K/ ~: r
- #include <linux/dma-mapping.h>
, M3 i% l$ t5 N; x& Y9 q; a0 ?/ x
# q- c0 s; a/ t; I, Y- #include <mach/memory.h>
7 C+ S( ]5 {& B) _6 d! ~$ Z - #include <mach/hardware.h>
$ l J. P, A. Y# w$ q# F - #include <mach/irqs.h>: q% h( x' j( V/ @
- #include <asm/hardware/edma.h>
0 U! [/ Z! h: g9 z
& ~4 M# e3 a! I- #undef EDMA3_DEBUG3 i$ ~* A* p( p: c3 h0 [: V4 }/ Y G
- /*#define EDMA3_DEBUG*/7 z+ T1 P) g. D7 F* ^0 z: D/ U
- e8 [* r% u: _0 P/ t2 }- #ifdef EDMA3_DEBUG0 w0 r9 m, c) P' l3 B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( G+ `# w i, }+ _, K% K y& i) m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 D7 Y9 i/ q2 m6 B& R$ W; h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f+ ~8 t0 l X% y# S1 s
- #else* K. ?, H+ P+ Y; V- u& Z
- #define DMA_PRINTK( x... )3 A+ [; S' P0 |
- #define DMA_FN_IN$ @, m$ N. ?1 |& t' j: V
- #define DMA_FN_OUT
" _( T4 Y0 H1 ^+ e4 [) ]$ p* A+ S: Q( X - #endif" |% R3 Q3 j# A1 s1 |; z2 G% d/ ~4 T, }8 x
8 b) Y4 p* D* P; \7 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& N7 u5 ]' V+ H# N& J; F - #define STATIC_SHIFT 33 }: V' X+ v6 @% |
- #define TCINTEN_SHIFT 206 V4 s' `: B% V& ^" L; I9 T8 A+ m4 G7 J, Y
- #define ITCINTEN_SHIFT 21' ]+ e. ^6 ~$ `/ p/ t3 Y. k! C
- #define TCCHEN_SHIFT 22
7 n l4 g6 W2 @ - #define ITCCHEN_SHIFT 23
, `# J& \' E& y. ] - & [0 k' P" H' O' F
- static volatile int irqraised1 = 0;+ W0 ], `! L( Z% F: G8 S
- static volatile int irqraised2 = 0;
+ p( W( O* f1 H& V a* n
v7 ^9 P# q0 D; r8 k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* h% O9 Q4 @- s, n) S u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( S) r+ T. y5 ]: A0 s; F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: L- b5 T& n$ w1 W
- ; v* r+ o6 h" [. d& n
- dma_addr_t dmaphyssrc1 = 0;
+ ] n1 ?3 N" | q - dma_addr_t dmaphyssrc2 = 0;$ k( J5 e7 h% y; J& H6 ` a
- dma_addr_t dmaphysdest1 = 0;% q( o) S! d, z/ g
- dma_addr_t dmaphysdest2 = 0;
2 G* ?8 |0 r' i; ^3 Q. k [
4 r& u" ?" `. n% h$ P6 j- char *dmabufsrc1 = NULL;
: a9 u N4 S9 Z0 W/ e( |7 Y - char *dmabufsrc2 = NULL;
! N* Z. e: W( r' g2 h - char *dmabufdest1 = NULL;4 u5 S. c7 \+ J
- char *dmabufdest2 = NULL;
9 u3 e7 x+ g/ Q n7 d6 k - 1 q2 D- D: W/ l8 r: Y {
- static int acnt = 512;; A/ v7 s( z, B w0 M8 x' e$ o
- static int bcnt = 8;
. s1 k' [/ u+ u0 b - static int ccnt = 8;- I( O+ K3 @% j; }: h2 c4 s. U
- ; g l7 Y" v& H2 P
- module_param(acnt, int, S_IRUGO);
6 E M: r* B$ y( b5 L# m0 ^$ h - module_param(bcnt, int, S_IRUGO);
& b2 X% e5 B. a' f7 s! c+ k' f# \ - module_param(ccnt, int, S_IRUGO);
复制代码 " I# `' y% b8 `8 R6 x1 C* ^+ i
8 m4 L- M. F4 z- g1 v% v, e( z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# V/ s/ m! J( ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) @4 B \8 U5 I* Y/ H6 {$ ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 R- p" Z0 `* c* e/ j
3 o5 Z3 m& X8 K) D1 ]* Z+ W4 }: ?* s- n! B
|
|