|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & k, l2 G# A0 ^, U5 `4 j
- [code]EDMA sample test application4 x. @% _ @1 x5 U; i) O1 P6 k( s: \8 I
- /*- S2 T- t2 Q" L w2 i
- * edma_test.c; W% R7 {- x! B3 K: v J6 s
- *! @& q& I% i% N8 v, O2 M
- * brief EDMA3 Test Application
8 F+ G' X% u1 ]0 R - *' @0 ^ Q% `! F( k
- * This file contains EDMA3 Test code.( V. j. m; C" H" `+ H( D1 p
- *. t% ? ?* y6 N- i8 L; c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 N( h: e& [, |1 x6 \* [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% }$ U) ]( a4 E) }) _, }, ]% V2 x - * TO CHANGE.$ O+ c- ]- [9 c6 x( s
- *( a. d3 x) W, d3 U1 u: Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- P& ], }2 Q1 ]3 ]7 V( Q
- *
4 Z6 U+ ]+ }8 M+ I! W - * This program is free software; you can redistribute it and/or2 N* z, U2 a# Z
- * modify it under the terms of the GNU General Public License as
- U4 f3 `1 q- d. b9 h/ t - * published by the Free Software Foundation version 2.( @% t( R( }3 P j4 ~' r1 S
- *
" l- c# I7 V- @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) [6 f& K0 h0 b* e - * kind, whether express or implied; without even the implied warranty
) G9 T& M& B% I* a- |6 R* f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 @: O$ m! M+ y. D7 z - * GNU General Public License for more details.
- V! K( w( I; R$ b+ g# V - */' H" ~ X3 A( }; `. ]; x/ W$ u0 a
4 O3 B! X+ E. N( g3 T! I- #include <linux/module.h>2 z* f5 \. C5 ]! D! y/ M
- #include <linux/init.h>
. P6 a! }9 B6 K6 ` J& [ - #include <linux/errno.h>- W% I2 s8 f% J. W4 `2 H7 C
- #include <linux/types.h>
- X$ l: k' P' j- o) ]5 ]0 q - #include <linux/interrupt.h>* M! \2 Z M. k2 ? a" F
- #include <asm/io.h>
( c0 Q9 c" W* [! S6 j' a - #include <linux/moduleparam.h>0 ]* _) [2 g0 c Q
- #include <linux/sysctl.h>
: k f0 r+ V- M! a, I k2 |. P - #include <linux/mm.h>, r8 y# g. J$ o% c: u9 y/ t f* I
- #include <linux/dma-mapping.h>
5 o' ]; _/ z" L2 W' X; \
) @( [1 ]6 s+ d# w- #include <mach/memory.h>
; B3 ], Z& _/ @ - #include <mach/hardware.h>2 C. b7 H _$ ~3 O, f" a7 [
- #include <mach/irqs.h>- y% W9 u" j* D- }! A; ]* @
- #include <asm/hardware/edma.h>
8 L- b& O. j$ W4 D
, r" |, _4 B6 E: o$ U- #undef EDMA3_DEBUG
, d7 N. ?1 b( I4 p% _& G4 x - /*#define EDMA3_DEBUG*/9 N6 P! y! L8 e/ ^4 w
- % a9 V9 _# R$ {' e
- #ifdef EDMA3_DEBUG$ U0 x$ j9 r3 t" j9 p+ a2 V+ t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 s1 g, B% V G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% Y6 E Y1 C2 e/ Y" l9 ^2 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! b. a* q* D& q4 h9 ~( B: W: P - #else8 P( S1 l/ c; X. Q5 \* y) |" U2 {/ c
- #define DMA_PRINTK( x... )* N5 _9 Z) `3 b1 A P
- #define DMA_FN_IN
7 f" @' @6 ]7 C3 `) V - #define DMA_FN_OUT
, I; X6 ^! E* ^# q4 _+ P5 k - #endif6 n( f. l& K+ q- B
' @- [0 k8 R8 J$ Z) E0 P+ B- #define MAX_DMA_TRANSFER_IN_BYTES (32768), t, G# a H! I) G, n9 B6 S" i
- #define STATIC_SHIFT 38 W: p) Q9 m3 i `5 u7 c
- #define TCINTEN_SHIFT 20; O2 T( ^8 M# y6 b5 ?' S
- #define ITCINTEN_SHIFT 218 ^# y n0 S7 M! e7 w& @5 L
- #define TCCHEN_SHIFT 22
, N. P! Z/ @; K! T7 ^, M; \ - #define ITCCHEN_SHIFT 23
& L* _4 k- i1 j9 Z. _$ C
" Q" R8 I3 x; R- y+ g8 T, n+ g: k! H- static volatile int irqraised1 = 0;+ e2 ^8 m! }8 ?1 h3 T- ^# s
- static volatile int irqraised2 = 0;
% A2 @2 S. Y9 Y' n2 D, X" x
/ s" s3 d# ?" b* [ w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- u2 P+ r. W5 R$ j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, O- v) d. P/ q4 k1 _5 c. M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& l# p Y! K4 l: `8 [2 k" ]
- 8 N0 p2 a8 }, J" V- V
- dma_addr_t dmaphyssrc1 = 0;7 q& r6 u, C) _. {
- dma_addr_t dmaphyssrc2 = 0;
0 k' {. F0 f% N, L- w, Q' H - dma_addr_t dmaphysdest1 = 0;. a1 \: W( p: r, x
- dma_addr_t dmaphysdest2 = 0;& s; e# S v" T0 f" u; B
- ( w+ U0 U4 Y. ?" Y
- char *dmabufsrc1 = NULL;3 t% z5 F/ S4 v: X# a; F( D" X
- char *dmabufsrc2 = NULL;
6 H) r) @8 ?: B* \3 C# A9 f - char *dmabufdest1 = NULL; [7 {$ C+ e: J8 b' Q" s i
- char *dmabufdest2 = NULL;1 s: x. h5 J. D3 G" K+ T
( U- I& B( W" M- static int acnt = 512;3 M: Z I7 n1 ^ f
- static int bcnt = 8;# s3 l: V$ Z9 B- U5 W
- static int ccnt = 8;
: e1 B k- M* B6 N, x
- w6 W0 l$ o" `+ a- module_param(acnt, int, S_IRUGO);% n# D0 T% U- T' E( }8 z( N; c
- module_param(bcnt, int, S_IRUGO);% _. a% v, d" M( j+ i
- module_param(ccnt, int, S_IRUGO);
复制代码 ) y/ A- X- V9 @" n
" j- t0 f6 J% T! i% R/ N2 A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 @, ?9 S5 u) [$ Q z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- W2 B `+ C8 G( ~. y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. w, V2 o+ {& y8 H g/ g! X( @; t6 `
+ H% w/ G& O% T6 O
|
|