|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 D: I% |" M( N9 u- [code]EDMA sample test application4 h7 T$ ?( g9 ]. _$ ~
- /*+ [0 V7 s" Z( y
- * edma_test.c
- ?, F" p. x. b - *
* @% j1 o+ b( y4 q7 C; a' m - * brief EDMA3 Test Application# U, f7 j$ h+ {% w
- *
% L8 z3 r' M: A: u2 i - * This file contains EDMA3 Test code.
2 e4 m; V1 j7 \9 C9 s1 A - *
3 v+ b0 ?* Y0 i5 T+ J/ Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 N, n5 H, R% L5 f2 ?* Z) [! A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% p' g4 a/ j: d' t/ F5 t - * TO CHANGE.
/ m; w# {9 \- y& W* g - *% n6 S, I( I7 M: O* J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 V. c/ J \- m - */ x2 o$ \+ R! W2 C
- * This program is free software; you can redistribute it and/or
/ G2 a8 ]5 l1 ~# W/ C - * modify it under the terms of the GNU General Public License as: `3 h3 ~& m" c( Z3 v# c; a; d
- * published by the Free Software Foundation version 2.- x) C6 f7 T7 s
- *7 k' P5 A1 G, h! y( ?$ p1 _6 z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) q* ]1 c- V v( j
- * kind, whether express or implied; without even the implied warranty% |+ {, ] l5 o$ I, _/ m0 I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* d, f) ]; c1 X% ?0 |1 L' Q - * GNU General Public License for more details.
- L+ A; E# G8 j6 `* O; t - */
0 I) w5 g$ `7 ?8 U( S - - F3 d6 O& f3 a+ ~2 w
- #include <linux/module.h>
0 Z' z" A5 z4 j( ` - #include <linux/init.h>" S* _+ N9 ~8 d, G( \
- #include <linux/errno.h>& k6 w% c8 y: n6 U, b* z, M
- #include <linux/types.h>- o, a, D$ [9 p7 Q \
- #include <linux/interrupt.h>
8 E( O- o `$ V- D0 A - #include <asm/io.h>
# }) _6 w3 U% \5 b - #include <linux/moduleparam.h>2 P7 G0 q! V' b
- #include <linux/sysctl.h>
/ v7 `8 k( h% S: C0 i3 v - #include <linux/mm.h>' Q7 T+ j0 e, L5 I5 u4 t2 g$ N, H- u4 c
- #include <linux/dma-mapping.h>$ s5 z- t+ E% z3 i! v9 K
- n" e: N5 G; z$ O! Z6 k0 w
- #include <mach/memory.h>! k. {+ M, a9 @$ |1 H9 O/ g
- #include <mach/hardware.h>
! z* d- T0 t: W- Y1 L: \7 @ - #include <mach/irqs.h>6 F2 c% E! ^& B6 B) C6 y9 e
- #include <asm/hardware/edma.h>
! h6 ?2 j6 d: k: h- O
" I2 K- T( S6 a4 V9 D- #undef EDMA3_DEBUG
! @$ z7 d& e7 C; s+ v" T - /*#define EDMA3_DEBUG*/
& D* v# r S! j% R7 m# l* ^
% b( N; g, F. X1 e* H. G2 d7 ?/ B- #ifdef EDMA3_DEBUG
/ D: T; p$ C* I7 l3 m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; J& _ m2 U" j" q2 G m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: ?* q2 [- U4 k ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 ?! y2 m6 S1 v+ Y - #else# ~( g' X& U/ T/ F
- #define DMA_PRINTK( x... )& C t* ^; t7 l$ D6 l. g
- #define DMA_FN_IN
7 j: k. N6 u$ D - #define DMA_FN_OUT
- x" }3 Y1 j$ J9 h, Y - #endif
- N- B- G5 _: O, ? - 5 t9 X6 v9 N! t) F- s3 N& I; C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ |2 Z0 y- P* H$ }
- #define STATIC_SHIFT 3
+ w1 W8 l) \; L0 ?! k. ]4 O - #define TCINTEN_SHIFT 204 F' Q5 T4 W7 {& U" c5 A( @5 U8 `
- #define ITCINTEN_SHIFT 21/ k" ^1 Q: U! S
- #define TCCHEN_SHIFT 22
. B- b o) p, n, }8 H; q# }( I- F6 | - #define ITCCHEN_SHIFT 23
) u: y& J* p% f! O4 @& J6 R - # n# c8 N C( ^8 }" \4 s9 v" L2 X
- static volatile int irqraised1 = 0;6 Q2 j3 k7 l5 J- h+ S7 v
- static volatile int irqraised2 = 0;' g2 W- i. b( {
' w8 w( t# h5 c# _) T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, O6 Q$ D5 B& c, e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N. Q! B! N' m- [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, I- p% |; x! G+ G* s$ h
1 ~; g$ |" W* N- dma_addr_t dmaphyssrc1 = 0;
N2 K: N& U |3 \ - dma_addr_t dmaphyssrc2 = 0;' b& H/ u% T2 k/ C
- dma_addr_t dmaphysdest1 = 0;6 [/ z5 _7 |- |/ F& |" U
- dma_addr_t dmaphysdest2 = 0;) }5 }: z6 ~$ a6 j3 i2 v
M8 P% a+ L# e n4 G- char *dmabufsrc1 = NULL;
) j! R# m$ l+ D5 a8 G3 T2 r - char *dmabufsrc2 = NULL;
' e1 J5 @. }! F- b7 ]- i2 d - char *dmabufdest1 = NULL;6 Q ?$ |7 ]; b: l- A
- char *dmabufdest2 = NULL;
' d( n0 H% J* C7 `1 d% U - 1 n& H# c. h9 [) E% i# {0 H# v! x
- static int acnt = 512;
o5 \- S% w0 ^) E - static int bcnt = 8;7 E& |( [6 \* S0 a
- static int ccnt = 8;/ z! C- p- w, `- f( B/ M
( h& L* q% H- Z; I X7 v3 z9 |- module_param(acnt, int, S_IRUGO);
: y3 V/ L" G+ b - module_param(bcnt, int, S_IRUGO);; t+ y, e7 [+ E" f
- module_param(ccnt, int, S_IRUGO);
复制代码
; A. W x9 Y" x% | ~
- k. e) H4 v# B% n/ F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! Z# ]& z+ C$ W9 J9 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. X7 S' X/ p' x5 u# ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 T9 Z0 g5 c6 |& J- Z/ |4 q9 V; c t2 ?/ I9 L. U2 C$ J! j
) u5 G: G+ T* S$ i1 E& X4 M3 F |
|