|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ }# C0 n% J4 Z& @# o8 e- [code]EDMA sample test application
2 F" N2 c- E6 P( f5 y$ c - /** W- P t6 O2 n( w
- * edma_test.c$ t* Z6 ^: d- ~' \6 Y3 E7 O
- *
3 m' y+ M. x# K2 X* U - * brief EDMA3 Test Application$ ^7 ~) g/ T. H) K0 l
- *
( r/ a' w- Z( v5 P$ G - * This file contains EDMA3 Test code.
9 \7 Y9 O, j: |" U - *
, e2 K2 W5 K8 F/ ~( G: Q+ ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 j, ^4 @: Y, x; P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" v, K E; z8 _( v - * TO CHANGE.* {/ e( W( a3 a% \
- *
# ? y% w6 }3 E( @; H$ v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 }2 k( T! s0 M8 l; U
- *
2 n. o8 P& a9 @7 V2 k- p$ H0 f - * This program is free software; you can redistribute it and/or
; n$ B* S: W; j5 s6 F6 P* o+ ] - * modify it under the terms of the GNU General Public License as
% R5 F# }& H3 I, t2 b8 Q - * published by the Free Software Foundation version 2.
' Z' W! ^8 j9 i4 a8 J) G7 x: p - ** ]7 ]- h0 H7 k) _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% A' D+ Z$ o/ @, ^7 f8 L4 X - * kind, whether express or implied; without even the implied warranty
* W2 f" t$ S e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* W' P8 R1 ~3 l' q/ M, Z
- * GNU General Public License for more details./ S$ W6 ]6 ?, T% k
- */% W( @. o( I: f5 E. T" T; u) n
' e( M# Y( c! a- #include <linux/module.h>
3 ?. \/ h: \9 e - #include <linux/init.h>8 P6 Z$ Z; _2 {. |) m$ s
- #include <linux/errno.h>
$ H6 M6 M( X: b/ [ - #include <linux/types.h>9 \/ l E. ~8 Z0 Y+ ?8 Y
- #include <linux/interrupt.h>1 K4 v1 ^- t) |% h, `! [$ R2 [7 V
- #include <asm/io.h>
$ k) x/ F8 [& ^. ^5 i/ a4 M- V+ W - #include <linux/moduleparam.h>- e9 |, J: f9 |) N
- #include <linux/sysctl.h>9 U; Y! e0 A! E) l/ `2 @) X
- #include <linux/mm.h>
4 @6 o5 d* c& l. U+ Q3 k4 G5 Q' | - #include <linux/dma-mapping.h>
: l" f; m$ y# ?
; E+ r1 x# r5 c9 ?0 \- #include <mach/memory.h>
1 B7 a! s6 p$ u2 J7 W4 Y - #include <mach/hardware.h>
/ X8 S0 [5 t Z5 k7 @/ I" P - #include <mach/irqs.h>
8 }/ `8 z. k* G) |: p - #include <asm/hardware/edma.h>
" w4 K2 [% a0 L, `8 t1 g( X7 U - ! [$ l0 e. U2 M) m8 t
- #undef EDMA3_DEBUG
" d3 q9 W, |* w- w; i - /*#define EDMA3_DEBUG*// S5 ^! q4 x( U2 w7 f- E6 ]6 @, [5 z
- B' R0 x/ z6 d' m
- #ifdef EDMA3_DEBUG
8 Q' i9 s3 _6 o. ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): C& v. H$ O' |" N0 f, s* B: I6 `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 f, u6 P8 d9 a1 C0 x7 [; b4 y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 U! ^2 n% q" \9 \) y* n# N - #else
1 @- p& A( V( v2 ~) J7 Z - #define DMA_PRINTK( x... )
, B4 l& D* q- p4 M+ F8 G8 Z) T - #define DMA_FN_IN! H6 ]8 w# e6 J7 `" M. I# m
- #define DMA_FN_OUT8 E3 X+ M4 D, Y. r" j# C& Q5 L
- #endif* d% h9 c% |. J( ~! ~6 S
, ~# u) a- _5 ]' T3 p/ Y9 A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& [ s/ S: P9 j. f$ h }$ ~% F! ]
- #define STATIC_SHIFT 3
0 _* w% y/ c% o" f - #define TCINTEN_SHIFT 20, D8 g! l) ?6 U# l$ K% F
- #define ITCINTEN_SHIFT 21
( A+ e# _/ C; Z% y5 q8 c& W - #define TCCHEN_SHIFT 22
* b8 D1 ]) Y/ J - #define ITCCHEN_SHIFT 239 _; b4 |: ~* V/ u. {
' b& }. y" j* m: S% S) J- static volatile int irqraised1 = 0;
# `/ j' G! R$ f2 ]) F$ n: \+ f - static volatile int irqraised2 = 0;/ A: Z) W8 x: {* s0 F7 M' m
, ~7 h/ D9 }% y3 F \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 p4 i; h1 y$ D7 u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 k' x! |# y2 v( k; _' p& i; G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ ?! G7 L/ l0 D; p4 n% K" k: l* ]8 Q
5 R' u) |7 o& M. O, G- dma_addr_t dmaphyssrc1 = 0;! d9 P$ f& D6 A2 O* O2 w* m6 f
- dma_addr_t dmaphyssrc2 = 0;
; @) Q) v+ m: ~! M5 K - dma_addr_t dmaphysdest1 = 0;
* U2 E# t E7 q4 L/ ?9 C - dma_addr_t dmaphysdest2 = 0;4 s+ x& d t" N
8 u* d2 Y0 S! D3 e- char *dmabufsrc1 = NULL;- z8 n3 W4 g6 F8 e& X
- char *dmabufsrc2 = NULL;
) g0 \1 b" F9 S% N o/ J( n" g3 D - char *dmabufdest1 = NULL;
5 Y2 o' }) o1 b+ T; s% w - char *dmabufdest2 = NULL;
' D$ ^. D4 L& N8 g" |! ]- j
9 _$ ^+ w F1 i2 x- static int acnt = 512;; e0 r8 I* \6 M* G# A1 W6 C2 }
- static int bcnt = 8;2 `9 H& C; l+ o
- static int ccnt = 8;
) I" D2 e" D' J! D2 @
- _9 v0 E7 g+ _- module_param(acnt, int, S_IRUGO);* e- n$ l8 @) \+ x& x
- module_param(bcnt, int, S_IRUGO);
: S. ?: x: Y, j6 m" M. U - module_param(ccnt, int, S_IRUGO);
复制代码
; P; a/ |3 t; S/ Y$ ?0 x
9 ^8 b) Z. @2 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ v& P2 A. ^ V, j2 v1 D+ U0 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; z+ M. _3 [ f7 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 H9 y9 q3 e7 ~: [! e
" Y) P7 ^& I" x2 y* `) K, u. H4 g# [& X0 `
|
|