|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ g- K ^: s- ?+ r" F- [code]EDMA sample test application
+ _, n- v$ U( [/ l, h - /*
8 |- S: c& X9 S6 k2 N6 [) i - * edma_test.c4 }- L! Q' X' Q
- *. c. i0 k$ ~* a d4 K
- * brief EDMA3 Test Application
; B: C% K* P* m - *
+ m3 }4 k, a- P' i) I0 P - * This file contains EDMA3 Test code.
, w9 I' x' u" ~3 C) b - *
! _ [6 Q" o0 H2 I" t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 j7 N, \5 y3 U' e7 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' R0 w0 T( @/ |& z$ h$ r- ? - * TO CHANGE.
+ ^: O( g9 @$ t9 [: Y6 V - *
2 e& z, B% [% a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 b5 ]8 D. O v! D! J# ?
- *
4 @! t& S) {- J+ c" A$ q - * This program is free software; you can redistribute it and/or
: r, s2 J7 {# r - * modify it under the terms of the GNU General Public License as
4 T3 T7 m q1 [& P# A' x0 J& ^8 c - * published by the Free Software Foundation version 2.
, j% L+ w- F7 K5 n1 Y7 U' S - *
" `4 H6 W2 W) G4 Q7 g& M/ g: m9 Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 f" i L: h) n% Q) W7 _: {- C" L
- * kind, whether express or implied; without even the implied warranty# |( r4 l/ |( h8 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 {: j. W5 m. p3 L0 \2 b; q - * GNU General Public License for more details.
- Q* F/ ]& U, g8 I w3 B4 L- X - */
l+ E9 f" Y6 e7 ^3 B' R - 6 D( w+ Y# P O& p" q
- #include <linux/module.h>0 y+ w( X2 o" w, }5 w7 Y
- #include <linux/init.h>
4 D0 x( @- f r6 }' o' C# n - #include <linux/errno.h>
( z, S& ]* L* T' X. s - #include <linux/types.h>" p' N1 \$ N P3 m3 J8 I
- #include <linux/interrupt.h>
0 M2 Z1 X! u1 t! n: C - #include <asm/io.h>
; \9 D9 ]! K. @$ b - #include <linux/moduleparam.h>: K6 [1 Y9 Y9 n9 q8 ~1 Q9 [. ]( i1 e
- #include <linux/sysctl.h>& {& x* w" {3 E) Z( f& L
- #include <linux/mm.h> i" s. \" M. m, H7 n8 N6 A
- #include <linux/dma-mapping.h>
_! M3 F( }! u1 z/ i1 n; P0 w - 6 R2 u1 ~% y( r: L( Q& k) ^
- #include <mach/memory.h>4 N" A {& ]8 O+ `6 j. ?- p
- #include <mach/hardware.h>
! }2 I/ v# M5 c( z8 o( G - #include <mach/irqs.h># y+ D9 C( _: u7 `
- #include <asm/hardware/edma.h>
& {& w: M; w5 N0 R( B4 e1 ]3 {% Z
9 l( ]- P' q% T! ^- #undef EDMA3_DEBUG/ m: y; Q+ S1 J% l4 L
- /*#define EDMA3_DEBUG*/
' A7 |& g0 M% R4 [ - L. `3 k+ r w, r/ @/ F& K( O9 J
- #ifdef EDMA3_DEBUG* i: J4 q' P; N1 A( V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. L) g& {: l! p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* T! X4 u1 n' G. L" e4 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 V" |" f) P6 f' ?! I0 v$ a
- #else
) y7 Q3 z, t% e: W, ? - #define DMA_PRINTK( x... )
0 M4 C, D. r0 V3 }. m, b C - #define DMA_FN_IN5 p9 n# X8 W" N$ s! ?. F
- #define DMA_FN_OUT3 E) b1 \/ O. \
- #endif1 D2 \7 Z' Y# ?& Y6 j
8 t, y, T4 F: x% X, ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- d6 r0 r3 j% Q; F$ d3 `
- #define STATIC_SHIFT 3
. S8 ?8 b/ ~! B$ e - #define TCINTEN_SHIFT 20 ^( [6 k' s9 W
- #define ITCINTEN_SHIFT 21' \1 P3 j E( q
- #define TCCHEN_SHIFT 221 A- Z8 }, u$ a1 y9 q& ^7 |; V
- #define ITCCHEN_SHIFT 232 e) A# z! h) B& F
5 M/ s6 I6 W" I, }. `9 h- static volatile int irqraised1 = 0;$ E. H: q4 H3 {4 G% g
- static volatile int irqraised2 = 0;
, p+ E' B* L( @: _+ a% U$ L
2 E/ V4 i% Y- |! [$ T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 y- X9 l5 i, b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 v& g t2 B7 E/ |5 B- o5 Y8 H& a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 z# M! n3 }9 G' R
* X) {% ~* o7 q+ v/ H5 \- L- dma_addr_t dmaphyssrc1 = 0;7 N7 H$ R) p3 m( p- F" [4 i
- dma_addr_t dmaphyssrc2 = 0;
0 F- A/ P @/ E! O - dma_addr_t dmaphysdest1 = 0;+ D; x+ N0 t* O( s! t, c! M' c' h3 \
- dma_addr_t dmaphysdest2 = 0;
c9 n5 O; S. e$ W+ O) m
Q" G, Y3 P. @( S' d& R" s- char *dmabufsrc1 = NULL;4 G5 L+ n4 Q2 h! p
- char *dmabufsrc2 = NULL;
. H7 O7 z% G. ^" H! x' y6 x( \ - char *dmabufdest1 = NULL;: Q) a' ^6 H* R7 @, m f6 b
- char *dmabufdest2 = NULL;. q* m2 y) }# j: u; g. {- W |
- k9 k4 ~$ @1 _. V7 U
- static int acnt = 512;
! N* L' K2 b- u$ v; p2 R - static int bcnt = 8;
: ]; l. D+ ~9 T( \ - static int ccnt = 8;/ t: C3 s5 W1 s( o7 ~$ l) F
. x( \! I3 Y+ T/ L% y! k- module_param(acnt, int, S_IRUGO);
8 S" n# C# @0 C! ` - module_param(bcnt, int, S_IRUGO);+ G, r7 k" [! e: Z, H: h
- module_param(ccnt, int, S_IRUGO);
复制代码
% }+ N+ e6 b0 i4 @- W& U+ s5 r
0 X7 ]( s' w% p! J' W; M! h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 M8 w" g0 @, ], y Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* Q; i' @ q( _, h1 f0 b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 q9 D' V+ Q6 j0 \) p# k! A6 Z5 }5 f3 P- r
. Z! [ J" h" f; G9 [* r |
|