|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % o/ l2 W8 C) [4 K/ V
- [code]EDMA sample test application
/ v9 f& N- L! H; x" H/ r! b; O - /*# Q0 q% o9 Q0 f& [9 _
- * edma_test.c% S1 n0 Q, `$ L: c8 v" }/ C
- *9 Z, c- }/ l, h$ h% K8 d4 O
- * brief EDMA3 Test Application
8 ?9 [/ q! k) c- D( L( M - *% O- j M C+ B& e0 z5 M+ C
- * This file contains EDMA3 Test code.
& P Y* M% R1 X5 q* k' H - *
) D+ d+ ~" }0 R' O4 @. k9 e' D8 D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( q0 C' S1 }( O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ U: C# j2 S/ E( [0 i - * TO CHANGE./ g1 u/ o: W1 q. B2 g
- *
2 ]0 P, u- K2 Y d( o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 N% X! [4 E; k }& ?
- *" q Q- \6 T4 m" B4 G4 G
- * This program is free software; you can redistribute it and/or9 V% W- i, }0 T: ^
- * modify it under the terms of the GNU General Public License as
+ j8 G" e7 I7 z# K - * published by the Free Software Foundation version 2.
0 k9 s6 v" t7 L/ f8 ]& a! @ - *
0 Y0 u7 k1 x$ z7 M" ^9 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 `( V( \& B4 U, s7 U. ~5 L
- * kind, whether express or implied; without even the implied warranty
" s. E7 R7 U0 h7 u" s! d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# J, z) L- y' s
- * GNU General Public License for more details.
. R; `5 D; `" I5 U2 s7 [+ @: A& W+ D - */' w. t* U/ X5 D* n4 H( |. u
- ; T" O( L n8 P% ?+ S* g
- #include <linux/module.h>) a- t @" e2 U% Y& y) T% P
- #include <linux/init.h>. z8 t- n% j! f4 r0 O/ D) H9 e* B
- #include <linux/errno.h>) A' @. {0 ?+ M
- #include <linux/types.h>
; l! K& l7 u/ z3 w - #include <linux/interrupt.h>
y$ [) L6 b t F/ f! X# { - #include <asm/io.h>$ r6 V5 r( k1 W' T
- #include <linux/moduleparam.h>) B* n$ i5 @( ~% v% v) ~$ j
- #include <linux/sysctl.h>
" L0 P d# I4 d3 o+ U3 o ^ - #include <linux/mm.h>/ k! n5 F3 ^7 c6 E. F
- #include <linux/dma-mapping.h> f& g+ E1 y4 R0 C
, v2 c" b/ A# n6 O5 n' S- #include <mach/memory.h>! L4 s& m) f7 g" _2 f! O" p) Q9 _% B
- #include <mach/hardware.h>
! q8 B2 }* m9 |0 b* W) r5 J5 R - #include <mach/irqs.h># O$ B O% U5 l$ g- U; G
- #include <asm/hardware/edma.h>( E- R F; c$ q
c1 }2 A; @! G6 b3 f0 ^ [- #undef EDMA3_DEBUG2 b- ?9 i' h H6 u, q6 L
- /*#define EDMA3_DEBUG*/" x X S% d( Z; o" Q
- & o3 Z' F! r7 J2 h5 {9 D* H
- #ifdef EDMA3_DEBUG" t% x' {; y9 u! T/ p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, a" g0 X1 A) {/ ]9 a8 }+ j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( Z5 H$ A4 J$ I9 h' m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" g( j# X( ]6 d; q; H9 o
- #else
1 y2 W: x0 S& g: f8 Y9 X - #define DMA_PRINTK( x... )) y- p, _+ I' q+ }
- #define DMA_FN_IN+ z* H0 _$ I" n1 ]6 t+ L
- #define DMA_FN_OUT
! r/ B) R) c# L - #endif2 E& r1 g; ~# m2 W' V; g' }" S
- 4 w+ g, s2 G) \" w$ X2 R3 A, @$ b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). c6 K5 e( R W
- #define STATIC_SHIFT 33 R& B3 b5 w* Y- l- x y0 N$ s# h
- #define TCINTEN_SHIFT 20
6 T8 r: N3 P! r a; L0 o" R - #define ITCINTEN_SHIFT 21
; q; K7 J" I4 C: Y3 ^ - #define TCCHEN_SHIFT 22
# P# L! q9 V" H) O - #define ITCCHEN_SHIFT 23
: o, x7 M3 P: b1 I( w
$ I/ u; c$ ]8 c- static volatile int irqraised1 = 0;$ n. q; A2 L/ Y6 l4 ~" i, l4 y
- static volatile int irqraised2 = 0;1 \. M3 j2 C9 e5 p0 i9 V
) ^' ^+ k+ z% l: f/ k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) D# y5 _0 w, |2 `4 T4 C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# q9 y7 d+ d3 l: k) C+ c" \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! c8 O3 r# x) s) c. A8 g - 0 ~; N3 q8 R0 X4 B/ N/ ^
- dma_addr_t dmaphyssrc1 = 0;
" a' Z7 g" d3 `/ V' d. b - dma_addr_t dmaphyssrc2 = 0;# a. T: C9 V- k1 _8 S0 R
- dma_addr_t dmaphysdest1 = 0;3 H! W. m/ z; F5 ]3 l
- dma_addr_t dmaphysdest2 = 0;
' @4 y/ C1 J# Z( y
5 _, Q' }; l# C3 Y& x- char *dmabufsrc1 = NULL;
: a( C4 c& j8 a! E2 z- t - char *dmabufsrc2 = NULL;9 B/ y/ u: ^% @8 M# h' b1 L
- char *dmabufdest1 = NULL;
+ ]# l9 g7 J, R+ T - char *dmabufdest2 = NULL;
- Z, |' l( T- B' H% F8 e - . H2 ]6 [: V& Y. J" o1 T3 N
- static int acnt = 512;
) ^' f! n2 [- f$ u& g - static int bcnt = 8;
. N0 I6 N4 ~( x$ S- r$ [ - static int ccnt = 8;
* T* |" h" P a# }; m$ ^
! y( u$ {+ e* y V1 _/ a( o- module_param(acnt, int, S_IRUGO);
, B' u6 W/ Q' j7 m7 `# H - module_param(bcnt, int, S_IRUGO);
4 ~7 ]5 b4 Y1 \ ` - module_param(ccnt, int, S_IRUGO);
复制代码
5 W s( }# T z# V3 P) U- Q" o" t. D; z- ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- Q1 U2 a8 z( u( L {% Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) i! y% v9 Z0 r. ]% r0 E6 F" A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 v- l: c8 G3 f. H2 |) f( W9 ~; @. |- W, N, o5 `) a
2 {$ ?% I7 y& f. C. k4 ? |
|