|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! j; ?# N5 p0 D( A" i; y- H$ c- [code]EDMA sample test application1 z8 J7 _7 Q& Q5 p% y
- /*
q1 e8 N: i- B8 f5 K% n - * edma_test.c
* a2 h9 Y2 a+ Y5 X0 F5 [ - *
I5 m6 G$ M5 M- Y - * brief EDMA3 Test Application
: O/ d( j, B3 ~+ C' l. Q - *! ]; F6 \ D7 K) f4 `
- * This file contains EDMA3 Test code.
5 k! }5 `4 k/ F6 _5 R" ? e# z; _ - *
! X H" P) I; v8 B% x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 i; H' f/ B2 _& i' V& i4 e/ p8 C# T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) |6 i0 u& A: c9 ~. I
- * TO CHANGE.
s8 p& H+ U$ X$ t - *6 u9 B' T- p8 | ~9 ~' j! I0 _. l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. @/ B8 S6 d/ J - *& o7 d7 `; z& Z$ D
- * This program is free software; you can redistribute it and/or
3 q' \! M3 Q3 `& [ - * modify it under the terms of the GNU General Public License as$ g1 R5 [: \% l% t& e p+ G* y: R
- * published by the Free Software Foundation version 2.
+ Z5 f+ \# F3 G# J- ?, \* c - *' ~, @' ]! ^& O3 A: n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ M' m2 N2 M7 p% K5 A1 F# P! ?& l% k - * kind, whether express or implied; without even the implied warranty( ~+ x/ E3 B; N5 O0 f' n! L8 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ Y) L) ?: [6 Q$ i" s
- * GNU General Public License for more details.- @! J# E g/ q5 t+ k
- */. B0 ?7 c" C9 J4 Z" F$ s3 I
O1 Q6 O. O) A9 l- #include <linux/module.h> M: n, V7 s( e7 }- s4 }
- #include <linux/init.h>9 V. X* F( `4 h7 g" I) k
- #include <linux/errno.h>
, v- s' {3 B0 D! A8 T - #include <linux/types.h>
$ O2 e/ }1 n- ?$ l& m' z - #include <linux/interrupt.h> X8 q* l/ G# i5 c, i* o9 L
- #include <asm/io.h>% T( T4 G& x5 p0 w- I. R" N: i% R
- #include <linux/moduleparam.h>
& f) x. G) u" ?* D" A# Z - #include <linux/sysctl.h>0 W. x% C3 Q ~2 M
- #include <linux/mm.h>
- E% Z$ q, [0 M( O* _/ n - #include <linux/dma-mapping.h>6 }8 I) Y! v2 ^, L
# i+ b _7 O! B0 O; G- S9 J( `: E- #include <mach/memory.h>5 X2 G' O. X2 ^' e6 Q8 z
- #include <mach/hardware.h>1 q% q* F, Q4 D( @2 w1 V
- #include <mach/irqs.h>
. B9 w% g- I4 }/ G7 V& s - #include <asm/hardware/edma.h>
+ ~, W/ ^8 t2 g8 T% _ - : T8 V* c/ v" N9 a s# E) q
- #undef EDMA3_DEBUG; N% w% K1 g2 A9 P) a+ e
- /*#define EDMA3_DEBUG*/- y, w3 k& C& f+ I1 F- c# Q' ]0 H
& ~/ |( s' q; a( o% E/ d( `- #ifdef EDMA3_DEBUG
4 C1 U o! ?2 |# f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* [, l/ `% v$ @ n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 v: o& S% A% y. K, p' ]7 l! }: [. s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& i9 d! F# J: G8 N, j9 v
- #else3 H4 @3 j1 i, G* G+ A
- #define DMA_PRINTK( x... )* V0 q. y% \3 Q% t8 ]9 w7 d. d
- #define DMA_FN_IN
% L, Q% z, j7 _+ j9 ]& J& C& g - #define DMA_FN_OUT8 @& o2 D. l0 r" Z
- #endif
) m! _1 l4 e: S+ I3 p
/ \$ R- B, Q- c1 B' ~$ P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) z! i8 v3 K# F4 P6 ^; C - #define STATIC_SHIFT 3
' [2 h* B; E+ z' z. P- r+ U7 \ - #define TCINTEN_SHIFT 20* E$ V: l# R# `
- #define ITCINTEN_SHIFT 216 {! j1 ?1 x- W& E7 s6 [0 J
- #define TCCHEN_SHIFT 22' k- t4 c! |: t
- #define ITCCHEN_SHIFT 23 P2 n9 |) M! _. R# L$ I
" A8 {7 P1 v4 O# l& S5 J, y- static volatile int irqraised1 = 0;9 ?$ J# O. Z* R/ f0 h, Z @
- static volatile int irqraised2 = 0;
8 H/ ~6 M' c* }, L& _( y3 P7 D9 a( {
, f$ t3 y# ~$ a2 J/ n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. L. _/ Y2 l3 T( S8 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; b+ q, T- k% `& Y, f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 K' ~# n4 ]! \- P' |3 h/ f - 1 J5 l% u& W& m/ V# D2 w9 o
- dma_addr_t dmaphyssrc1 = 0;
2 Y: ?0 t$ k. m: U9 F - dma_addr_t dmaphyssrc2 = 0;
: S/ w+ ~3 T" l4 ? - dma_addr_t dmaphysdest1 = 0;' \+ v& A# ? k; ?8 z: e& L
- dma_addr_t dmaphysdest2 = 0;0 S8 ]/ L3 L6 s* n3 c
- & N" B) m0 G6 r9 K! U; A& W
- char *dmabufsrc1 = NULL;
2 }* s1 s5 ^" J' s* a - char *dmabufsrc2 = NULL;* d! C6 G# C% q8 i% E
- char *dmabufdest1 = NULL;
% ^8 D; {1 B# k7 F3 Y8 {9 X* \/ D9 t - char *dmabufdest2 = NULL;
" ]8 l9 ^0 @6 X# G" p8 t" Z3 @
8 @+ R- X8 M( P; w" x2 i& o, G# A1 |- static int acnt = 512;
: L% h1 G! [$ U5 O; j2 |9 e - static int bcnt = 8;/ j1 W% h! H5 U
- static int ccnt = 8;
2 r3 `' S4 o. F
% r3 q* g; p3 [8 `4 h- module_param(acnt, int, S_IRUGO);5 b- L: r" @2 k+ i6 L
- module_param(bcnt, int, S_IRUGO);9 S9 m1 M* O7 f7 f+ N. x5 s
- module_param(ccnt, int, S_IRUGO);
复制代码
/ _, \8 d- Z9 k" b! m* Q T$ f" q0 \9 [. k' y: j/ L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* W! ?0 f4 C; W3 V/ r* Q: Z$ Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; T, S3 `, t' Q7 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 e' J5 H1 V6 V5 {! |1 o+ U+ M! ]/ S9 t) `( l3 F! l$ ^# S* S$ g
) }9 `0 k7 a1 H+ n: z5 I |
|