|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 U9 A i* v' h. Z$ |) Y
- [code]EDMA sample test application2 e! z! K* f" o# m0 X! B6 Y
- /*
$ u' G3 e$ i0 O, E k - * edma_test.c
7 a2 h0 S- ~- ]0 Q( A' S) v - *$ w& u' b/ `5 D* \
- * brief EDMA3 Test Application
4 A+ z% e* ~* g! j; D% V - *# q: a7 n. z$ R$ ?2 c" }4 B
- * This file contains EDMA3 Test code.
! a! u' r$ ~& t/ f6 [* P& J7 W - *
! I( X% N d4 F. t! U$ I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- `4 x/ N) m3 ], H5 ~- K: Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& ]( H% s0 M* O/ ]3 n1 ?) W3 j: N
- * TO CHANGE., `" L- i3 E7 g4 N3 s: v
- *! C5 T- f5 M& l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 m3 O" T3 k3 e3 n1 s& T8 x7 G
- *
: s4 s0 Z$ g4 Y+ r! _) J& V - * This program is free software; you can redistribute it and/or- `, G) d f) d9 \ N
- * modify it under the terms of the GNU General Public License as [8 j7 R% n8 ~/ ~" e, E3 w0 m
- * published by the Free Software Foundation version 2.! }5 l. W! }7 a5 r) Q
- *
. l2 p* Y# e5 y; I! @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ I: U* h2 `# K# x8 C2 Q8 ] - * kind, whether express or implied; without even the implied warranty
+ x2 o8 c" S9 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 W" Y) K8 Z5 Y* b2 | - * GNU General Public License for more details.
& b# B Q9 q4 D) Z" ~4 b - */
$ W1 e; ?3 h. E5 u
: A0 V1 a/ V$ g2 T3 ~0 m- #include <linux/module.h>. v: G& v7 l5 g0 ?, |7 f4 m
- #include <linux/init.h>$ a$ q& J* L. I+ }. }
- #include <linux/errno.h>
7 m8 L% `' S- K - #include <linux/types.h>
5 O: q& D* ]: m. I - #include <linux/interrupt.h>
1 i9 K+ e& _& i2 J( _ - #include <asm/io.h>- ^- [+ S# O; M0 u$ {: G* [
- #include <linux/moduleparam.h>
- }- f& u u; D V9 c; |* ^ - #include <linux/sysctl.h>
3 k2 t8 P9 t; F/ P5 j m - #include <linux/mm.h>
! ]/ G( s* v8 w- q+ n, N' E" X) X - #include <linux/dma-mapping.h>( F ~+ M& X( U5 w8 {2 {8 B% ?2 I
; A* O" s! d3 s- #include <mach/memory.h>3 R1 A2 @2 e2 w3 z: \$ W4 v3 e+ N$ N
- #include <mach/hardware.h>, a7 B$ b& t" z& X/ ]5 n
- #include <mach/irqs.h>9 f* f% u4 e8 x# D
- #include <asm/hardware/edma.h>! B- }- I' l& u4 C' ~
- ! T& R" [9 \5 Q% e. X2 O
- #undef EDMA3_DEBUG
. p, y+ N1 h- F8 b$ a9 K# z - /*#define EDMA3_DEBUG*/
3 o W! T0 _" T; a - / |/ { [; _2 |) H$ V& ^, ?
- #ifdef EDMA3_DEBUG
8 ] m$ x6 e- c8 g6 W" i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 w2 P: w" F3 Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 q; E* Z1 K9 `8 H9 s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! r# L. ]4 n; f- Z5 |! H - #else6 a1 `( I' }) Z- y* O( }. n
- #define DMA_PRINTK( x... )# m* P: x# o8 o1 g6 y4 i
- #define DMA_FN_IN$ Y2 s& H- J4 u1 c8 Z+ M
- #define DMA_FN_OUT- ?. y4 P% x; C- n- e
- #endif4 @4 ?, B6 V% z! E+ c* d
* N) J$ L- x0 `' ]$ r( ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 Y$ l' T) f A# m7 ^# ^! _ - #define STATIC_SHIFT 31 f: Z6 ?5 r. T+ v" [/ | l
- #define TCINTEN_SHIFT 20
" T m: ]3 {* o; u - #define ITCINTEN_SHIFT 21
( p. K- c1 A+ D4 B9 ^& q; w - #define TCCHEN_SHIFT 220 b! D4 V4 w" Q
- #define ITCCHEN_SHIFT 23
' b8 W6 s$ g0 E2 T - 9 x1 _7 L+ t8 f' M+ S9 _ G+ ]6 U
- static volatile int irqraised1 = 0;
/ B: j& S+ a2 I4 z' Y - static volatile int irqraised2 = 0;
" i& _/ [8 H, ?, Y3 W. S5 ?* H - * m D! [, J+ v; h( a0 I$ L$ M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 N$ E3 ~% w3 B; E6 g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( f# A7 n9 ^; n! [7 B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 s% K7 @ y m+ V9 u7 T1 P
; A* o* l/ b% Q1 m: g/ c- dma_addr_t dmaphyssrc1 = 0;& X% l- v! a& i5 y# G. T9 O5 m7 Q
- dma_addr_t dmaphyssrc2 = 0;8 A# S& X" \; \- T
- dma_addr_t dmaphysdest1 = 0;
! o! w7 ?. D9 w, u- F) z - dma_addr_t dmaphysdest2 = 0;/ G9 I g4 j# K
- $ J& J) v; n2 s5 r
- char *dmabufsrc1 = NULL;% H& I3 T+ A0 }% O/ a
- char *dmabufsrc2 = NULL;' G4 M1 u2 s$ }7 i% S
- char *dmabufdest1 = NULL;, T7 E6 C3 l$ K( J# W
- char *dmabufdest2 = NULL;
7 x; b5 v5 r b
. T' U9 k. J# ?; H: w- static int acnt = 512;" T# g4 g4 o# J! p' ^
- static int bcnt = 8;1 ^$ m9 A4 T$ d; _% l# s
- static int ccnt = 8;
) J4 n7 g) m+ u! j+ F( ^7 {; a - 5 B; R, J$ u b2 P, r# W
- module_param(acnt, int, S_IRUGO);$ r: W! r$ u3 K1 |/ R9 ~
- module_param(bcnt, int, S_IRUGO);3 |3 c1 i/ U( a
- module_param(ccnt, int, S_IRUGO);
复制代码 ' c* q; O `/ p/ x3 t0 g
$ C$ q/ ~4 h7 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# Y+ ?7 P/ J- e; U; O' C Y# Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, O* S0 J5 O& c# j3 b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% U' X$ b: C9 [$ n+ |1 f/ x' P" [
" ]: ^4 u% k- Y6 n |
|