|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + x$ H" `4 L+ p6 o: W
- [code]EDMA sample test application9 [$ p) {' @* ^' H
- /*6 u; M7 K0 @- C! {: b
- * edma_test.c
, i3 L; V F; T o$ l! c - *
+ `0 j0 J& ]7 d2 S+ F( l( G# h - * brief EDMA3 Test Application
3 \% n$ w( K" ^) Q - *% i" |* _+ A! Y( t4 g+ h
- * This file contains EDMA3 Test code.* j- G. R. ~+ [! c
- *
# W4 i+ |* V8 {+ n; p" B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 ]8 n \, W: Y$ I$ s6 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 h1 L5 ^. l: i1 i' N. a
- * TO CHANGE.
' J" e* n& K `! W - ** a9 n5 }; K) F% B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ d+ l ^) R9 H/ w
- *
5 M& S% P- R* G" z - * This program is free software; you can redistribute it and/or
/ Z9 D G# \& F" S7 R - * modify it under the terms of the GNU General Public License as$ A+ l( k2 l4 Z3 f1 `
- * published by the Free Software Foundation version 2.
' E% Q, B5 A4 ^5 Q2 @8 u - *
; ]! D: f z3 _4 t: {1 n/ U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; n, W( o" b" X9 m - * kind, whether express or implied; without even the implied warranty+ W, p, Z K0 k8 L/ Z5 c+ F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: |1 k" X+ p# ]* O% e1 S
- * GNU General Public License for more details.
5 h/ g* a3 j2 H. E - */$ A x% b4 q0 a+ Y7 o5 e$ |
: \2 m$ X$ S6 X6 @2 ^+ V- #include <linux/module.h>' a( J) a- \: ^
- #include <linux/init.h>
( T% t7 W/ {" f - #include <linux/errno.h>& u# l( l& N$ Q( ~- `8 L
- #include <linux/types.h>
" X1 h$ }+ n! i& s' a; s9 Y - #include <linux/interrupt.h>
9 S7 k; t: G$ _6 L2 a, L - #include <asm/io.h>% f) {/ d( L2 F0 x8 B: e- r
- #include <linux/moduleparam.h>5 ?1 ]3 f1 X1 u! N3 R7 w
- #include <linux/sysctl.h>$ E) ~6 j2 s& o4 F; Z
- #include <linux/mm.h>1 k$ K3 }4 x! O
- #include <linux/dma-mapping.h>( }# {& `$ A( x+ o) J, Q0 f- d5 I
0 I/ z) f+ q$ f) c: [& d- #include <mach/memory.h>" ]- v, B8 w q3 r; k' L' G
- #include <mach/hardware.h>5 F- R4 X) ]: ?9 h( U
- #include <mach/irqs.h>
; ]8 @8 b1 h) Q+ t* ^- r - #include <asm/hardware/edma.h>
7 h0 Z: n% }+ d4 | - ; q: O# G" {3 v2 c, B7 ]
- #undef EDMA3_DEBUG) D* J6 U+ |6 y: E1 t
- /*#define EDMA3_DEBUG*/. \# z" U, s, V! F
5 b) Z8 d$ y6 \+ @- #ifdef EDMA3_DEBUG7 Y6 M u8 j5 W5 V+ [7 p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' s5 L y) |1 W* N9 p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) e8 b" o- M, p8 [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 V9 p5 r4 r. L
- #else9 c) V: X" m; `
- #define DMA_PRINTK( x... )! i1 O+ X. s5 w% F% q/ j
- #define DMA_FN_IN
+ t2 w# J7 a+ Q6 S: E3 ^. P9 e& {6 X - #define DMA_FN_OUT) J+ P& Q5 D$ m
- #endif
4 O6 Z" O, L+ P% t+ k `4 d( W - : V. Q, I9 @4 a2 R3 Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ @$ `+ M x. f3 s* X2 q( { - #define STATIC_SHIFT 3
+ i1 N+ H. H: [" ]- e! a3 u - #define TCINTEN_SHIFT 208 n U9 k, `* N" m/ s
- #define ITCINTEN_SHIFT 217 Y0 O2 s T: |2 ?! u& N0 D8 N3 W
- #define TCCHEN_SHIFT 22& @. L1 U- s4 F% H+ Y# L; `
- #define ITCCHEN_SHIFT 23, E d9 U. Z4 n5 \5 Q, e3 @
. H- L9 K" Y; k1 { s$ C- static volatile int irqraised1 = 0;! ^, N; N0 |. f% x
- static volatile int irqraised2 = 0;* k6 B. A4 p& q9 ^
- # S. @0 s! j. w+ W' W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: H: c/ W/ K+ m* r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ r! s+ U3 C3 X5 n7 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% d; @6 N6 U- s$ h - " G3 u7 g! h% m( J) \; p/ x* |, s
- dma_addr_t dmaphyssrc1 = 0;
5 {8 K8 Q' b- ? y - dma_addr_t dmaphyssrc2 = 0;
+ [; M% w6 ]" d% i: H - dma_addr_t dmaphysdest1 = 0;( _$ ^- A4 u: w! Y$ p8 G4 ~
- dma_addr_t dmaphysdest2 = 0;7 W2 g/ e! ?4 g$ n3 B
- S' |. J( I9 [% ^5 ?$ i3 Z
- char *dmabufsrc1 = NULL;
% ~, }7 A0 u% }& E; e - char *dmabufsrc2 = NULL;
& o& ], r- ]6 s - char *dmabufdest1 = NULL;$ O; {$ b' g4 R/ c7 H+ g* x8 e
- char *dmabufdest2 = NULL;2 c+ k5 K+ w; h5 C% ^+ \! L8 `( H
2 y8 K! D# W" d3 {- static int acnt = 512;
/ Z, N" b: I' ]+ S) w - static int bcnt = 8;1 a- J* K) Z: m% x- V# G# I4 V9 V
- static int ccnt = 8;; e8 K; j" ~& _& z5 S4 T
- : u* b8 ?, j$ f+ R' Q; C) Y' `
- module_param(acnt, int, S_IRUGO);
: I! b6 ]3 T1 v2 O( x - module_param(bcnt, int, S_IRUGO);
, e. U9 N" U: u" C* j - module_param(ccnt, int, S_IRUGO);
复制代码
{; H9 [& }# H2 E: I
! X+ @* x; s4 G* W i0 D+ K$ {3 A2 l' w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ k2 B6 v! _+ ~) M2 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 o/ e) `5 J% ^0 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! n4 [/ h/ B7 a1 Z
4 Z Z8 w/ _8 p2 k f
1 B- v; J$ W/ e. h* m$ i" L |
|