|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 l) Y. X6 }8 H9 S0 @3 S, H
- [code]EDMA sample test application5 @( K( h. u( m
- /* x! `% r$ k3 \& t$ N
- * edma_test.c
- d6 T' k, Y( J8 Q, v - *
) b# Y2 d, N+ g3 I9 } - * brief EDMA3 Test Application1 p0 l" v, d& v; X# {- m
- *- `3 a# H( ]4 A
- * This file contains EDMA3 Test code.5 Z; r$ `8 ? d. ]% e) ?3 k! n
- *2 \1 Q6 Z, {& e8 L' q% P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- L/ w9 s+ [: s' K2 g4 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; Y/ d8 v, O3 q; {' t9 f" l - * TO CHANGE.5 Q! m0 z1 w: _
- *9 L" d6 X( ^( h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ R7 J8 K5 P+ I/ J# ^2 ?, |0 o
- *+ y; a9 O1 w, e1 s/ O( e8 t
- * This program is free software; you can redistribute it and/or0 f" ~. j4 b* X6 ?- j4 ^! l
- * modify it under the terms of the GNU General Public License as/ H" m. {" K+ X, `8 ?) E9 U, F
- * published by the Free Software Foundation version 2.& ~, a V" ?: b3 \4 ?
- *
' ?" R4 d% L9 w9 M0 b" W" A: R, Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' V4 h5 B4 v. C& A+ r/ p& n3 v - * kind, whether express or implied; without even the implied warranty
; d8 e3 c8 b: j$ I5 i5 Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" L H- C+ I6 [( Y! \
- * GNU General Public License for more details.
& z. x( G, Q: }0 b4 @: s& G - */
$ f$ Y( Q3 K4 o2 `. C
0 g" `, P2 ^% z! t F- #include <linux/module.h>: V) ^8 }4 O9 Z* p4 P
- #include <linux/init.h>
" s+ r T7 X( D6 h2 ]' h - #include <linux/errno.h>6 n7 ^* B8 A! C# }5 }
- #include <linux/types.h>
/ r$ X9 C* t( Z& X- X - #include <linux/interrupt.h>/ p- H b+ f- ]$ z$ X
- #include <asm/io.h>
; S# x# B* c, o6 g - #include <linux/moduleparam.h>* ]8 `" z* G4 T6 O, C8 c' ^0 ^6 H
- #include <linux/sysctl.h>
! b2 J9 k) H5 q1 u6 y - #include <linux/mm.h>
; D2 I8 x2 E1 K& d - #include <linux/dma-mapping.h>2 h- ]1 \- y: h6 q5 M3 N9 c* W
- 8 b k3 D! A @4 J- T% e& Z
- #include <mach/memory.h>: l. ]9 E/ }2 n# S
- #include <mach/hardware.h>4 b- n5 m3 m9 V" Y9 f4 C
- #include <mach/irqs.h>, ^; ^+ a9 e+ _) U1 r1 @
- #include <asm/hardware/edma.h>
2 B: |4 V4 D: d2 ^ - : d7 @1 r8 E( o9 r" @$ J3 G2 P6 y
- #undef EDMA3_DEBUG' z2 ?7 x; z1 M( e I
- /*#define EDMA3_DEBUG*/* w# g# s/ x7 r, x9 h" f; N( b( f7 D
3 r) G! x$ K( O- #ifdef EDMA3_DEBUG) _2 ]; Q7 ]' }2 |* j1 M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). p$ l. T1 v, o' V% W' C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): K4 N, q0 W* Z% M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& ?& t% p4 ?+ N, F4 R" E
- #else# P; y$ E- A) m. U
- #define DMA_PRINTK( x... )" f5 x$ v0 y* T) y/ A) X
- #define DMA_FN_IN# j: I) K- Y9 t1 |
- #define DMA_FN_OUT: W2 t0 J- {- n* ^# `$ x/ Z
- #endif
6 v8 l6 G! n9 r6 ?$ V
% Y3 D- {/ {! J9 I7 l9 O# k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 F& p# K6 f( i9 ^: U
- #define STATIC_SHIFT 34 t6 X4 s9 e4 ?7 D2 ?4 E; G5 F
- #define TCINTEN_SHIFT 20
r! S5 e3 M( ^1 @% |) c& h - #define ITCINTEN_SHIFT 21
7 _3 U% D# E& R - #define TCCHEN_SHIFT 221 a2 y" c* O) [( K2 S5 `. |
- #define ITCCHEN_SHIFT 23
T- R1 ^& H; ?0 y
! ^7 A' r! k; [7 |0 w- static volatile int irqraised1 = 0;
% R% I) R! z& R; X8 b/ Z+ Z - static volatile int irqraised2 = 0;
: y, N) v6 d6 T# x
5 T& F% n$ Y4 v) R& i+ I! u! M9 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( u' U/ N( ^% C ^: r8 j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ |$ E& y5 X0 P- N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); n1 X2 e. E, @! I3 ^
. B4 W% Z* @- D7 v, v- dma_addr_t dmaphyssrc1 = 0;
1 u$ S5 E1 q* l$ Q( } - dma_addr_t dmaphyssrc2 = 0;8 S3 s4 L5 y# M0 V6 d- c8 d: N( c# a
- dma_addr_t dmaphysdest1 = 0;
J( H) c" B0 I5 z - dma_addr_t dmaphysdest2 = 0;* i# A3 B" G. s4 S6 ]8 v( g5 U
, V' i; i" _7 k. s5 ^- char *dmabufsrc1 = NULL;, w1 f/ U3 t8 G. O2 b* P1 S* C
- char *dmabufsrc2 = NULL;+ V! [# T2 C- {
- char *dmabufdest1 = NULL;8 H- i e9 E8 C
- char *dmabufdest2 = NULL;
% e! }3 @/ w: o% l - 4 D: |% I0 ^, g0 |& r" }
- static int acnt = 512;
% g2 T1 V+ f5 f* B$ n( w7 [ - static int bcnt = 8;* s- b0 f& ?0 v$ ~ q7 P0 R- m
- static int ccnt = 8;
; l( L; C9 _# k6 m - ' R: n" g( n0 D
- module_param(acnt, int, S_IRUGO);
3 o* d# V6 Q1 }, N$ I4 c - module_param(bcnt, int, S_IRUGO);5 H8 w# P1 r1 Q" \- ^
- module_param(ccnt, int, S_IRUGO);
复制代码 & C, C. B5 `9 w0 h7 D0 @" D
4 M- \% Z. A! u8 @& }2 L: V/ Q& u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) J+ o% V" J. J8 G) P, m- T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, s: L2 j1 U% W5 k7 l; q* e/ f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" E2 e5 k+ f! i2 x8 W1 u& K0 t# Y5 o9 c
- ]. l' D, s+ m' o) M9 h |
|