|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % P) k0 [0 L# a- I
- [code]EDMA sample test application- U1 @" X, ]0 t) e- Y3 E2 E
- /*+ z5 T9 m5 ?# R0 b( O6 m
- * edma_test.c
5 ^9 v' D- \5 R2 H* ] - ** v: I! M0 J4 p3 l$ i0 R8 X! V
- * brief EDMA3 Test Application
- V) v6 N& a! { - *
$ H4 G* J( {; s+ Q7 s1 k1 W: Z - * This file contains EDMA3 Test code.4 j, G0 ~/ K3 ]2 h- h9 S
- *
. R. [! f' e* g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# q |3 {& M1 w7 r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 E& |) z8 _! y0 W3 A( R5 A - * TO CHANGE.6 I d2 A' n) ?
- *% I0 d+ d# h H7 z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* x+ F# _; }& Y+ r! Y - *
' ]9 n) @8 I& M' F* w; x3 P: l - * This program is free software; you can redistribute it and/or8 o* v( Y2 b2 D' H
- * modify it under the terms of the GNU General Public License as
. N" a7 c$ c0 [$ m E - * published by the Free Software Foundation version 2.
. R9 C, @$ Y& ?8 h - *
8 x: h, I/ u! \& V. a' ` R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% {8 ^* M* q+ n0 y- v
- * kind, whether express or implied; without even the implied warranty
& U' j8 \: p* b$ o/ x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" ~! Q: L$ t2 q- w! W7 q
- * GNU General Public License for more details. Y7 J* \' h# g6 L0 _5 J
- */
8 y$ U* m( E0 l
- {4 T; ^7 |0 j) r. F7 p- #include <linux/module.h>9 b. V0 u1 o5 s" g* @3 S! j" `
- #include <linux/init.h>
7 k# u3 D, m0 f' Y. w4 p - #include <linux/errno.h>
( V/ g. v$ N% y: q$ T* i - #include <linux/types.h>' x. X' I. w( G# g6 x" `
- #include <linux/interrupt.h>* r2 a5 a& W; H3 J1 H% ^5 K
- #include <asm/io.h>. i. D8 v2 [/ J- p7 M
- #include <linux/moduleparam.h>& V" k# b9 E4 s+ {
- #include <linux/sysctl.h>) i- F3 \2 A9 o/ d
- #include <linux/mm.h>
6 M- K- c# | i. @" j! W - #include <linux/dma-mapping.h>
6 M( w* J2 {2 [+ J - # L5 `; z1 N2 w, T" B
- #include <mach/memory.h>
. Z1 n# l, K2 E6 e3 t% J - #include <mach/hardware.h>% {9 y! B8 x. j# n# e6 Q% k
- #include <mach/irqs.h>
3 k' i2 O4 N7 l% ?- w8 f. K% p - #include <asm/hardware/edma.h>
: Y M+ r# }* ~9 b) M2 @) R, G% u - 0 U* O6 W3 M. f# E
- #undef EDMA3_DEBUG9 u+ ]2 ?+ B& H" |/ o" }
- /*#define EDMA3_DEBUG*/
4 R1 r9 }( v) r, a3 [
$ t* t. d# H; }1 m& W9 `3 `- #ifdef EDMA3_DEBUG* L" ~0 c' _; A( E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* f. w! e) U0 T2 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* {) [! m A: l( G2 V# O& w1 C; ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& h% n* o2 z8 V, @% s6 `# ~
- #else
! d- [, I+ |5 ^% a: o c - #define DMA_PRINTK( x... )
" G$ N. u% T- d - #define DMA_FN_IN
1 s7 Z/ a, Z: P8 x8 g - #define DMA_FN_OUT
! R4 i( Q4 ]" Z; l4 F6 t0 h - #endif
" f4 l; o; U8 ?% C - * s ~# N2 b! b# P9 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; ?" m k% l! s9 `9 H+ f& ^; E - #define STATIC_SHIFT 3
1 U/ ?- b+ n8 |7 w& @, ` - #define TCINTEN_SHIFT 20$ l, X& ~3 V9 c7 g6 v
- #define ITCINTEN_SHIFT 21- O, j; l. e8 u2 f( D
- #define TCCHEN_SHIFT 22% e7 e" w) k8 w4 A' p' O4 U
- #define ITCCHEN_SHIFT 23
9 a- r) M) A3 J3 W1 R
. p9 H7 m$ Z, s" A- static volatile int irqraised1 = 0;
: Q5 u1 c1 X; z - static volatile int irqraised2 = 0;
. s) o, u. u0 Y - 1 K, }7 S% \( S2 H. C. Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ h$ t) \1 @. g4 h0 }& o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ I( G7 c' k# q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' V! ?+ x8 e+ ~8 {# p/ v6 x
d+ _, F* Y8 |6 ]- dma_addr_t dmaphyssrc1 = 0;
+ s. d" A# F5 x4 \9 w - dma_addr_t dmaphyssrc2 = 0;
7 m' K1 s+ b6 L, Q6 U - dma_addr_t dmaphysdest1 = 0;
: W0 v" \; s8 t% `6 K - dma_addr_t dmaphysdest2 = 0; E- E3 Z' P9 I1 l" X
- ?) y, n# P' F `5 J. P. z( T' c- char *dmabufsrc1 = NULL;) |. k! K. m9 a' z& b, }
- char *dmabufsrc2 = NULL;8 |5 x3 d+ u: G! x4 ?
- char *dmabufdest1 = NULL; S1 S3 L. L9 h1 @
- char *dmabufdest2 = NULL;4 V1 }: C* ?7 W7 ~8 e
- & |# @% L5 c, t5 }& a9 w) O
- static int acnt = 512;' m! K9 c$ b; g G0 t& H1 c
- static int bcnt = 8;* G) J1 F5 t5 \5 a/ E# ^3 k2 Z
- static int ccnt = 8;
* c+ G/ \. m# x7 J - / k8 o1 U6 g7 [# ~* E
- module_param(acnt, int, S_IRUGO);
; B9 d5 |# A# e' c - module_param(bcnt, int, S_IRUGO);6 f: \4 O( O! W, j
- module_param(ccnt, int, S_IRUGO);
复制代码
5 R* C- `5 a8 @7 j1 H
% R% B0 o% ~6 C# J$ v x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ]: W o9 f- l* Y, k* \) i, Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ W% l, P2 R4 d, }* g! o6 i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% Y- B/ x; C$ G# N1 |7 |
. x+ z: F' {2 U ?. M( O$ ]3 |$ a& |
|
|