|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 E0 q+ O8 s+ h* j" w- [code]EDMA sample test application
# `7 z1 w$ g/ B7 P6 L7 \6 k# g - /*4 ~9 p7 l' w+ n7 J# v0 i
- * edma_test.c2 c' U! O9 p; H( C: C# A
- *+ ]4 @' t2 o: d0 {5 ~0 n
- * brief EDMA3 Test Application1 d1 J$ t. X0 w' J
- *
# C+ Z" @' u: ~3 c; h - * This file contains EDMA3 Test code.
6 z( r6 U. b- ?* | - *( D! ?; @% m9 w! W" I: y0 ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ Y9 w8 C8 i1 b/ }3 q) ^2 c6 N) L8 L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 u+ q& x; ^: R2 E; R+ M+ a
- * TO CHANGE.' m( O) h% x( I) A
- *$ i* W+ i; U e0 a+ [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. ?+ |8 B j" k& ] - *4 b3 Z- n- @, M# M A
- * This program is free software; you can redistribute it and/or, O$ n; N2 I. M/ S7 b
- * modify it under the terms of the GNU General Public License as
% u+ v- x( D* s# O: S) r# R7 ?+ I - * published by the Free Software Foundation version 2.4 W8 W. Y7 }- p. W- f% w
- *
5 f: i( G7 E+ F! ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% W2 n. X, |, n3 _ - * kind, whether express or implied; without even the implied warranty
; u' L P9 U7 l" K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 ?8 G9 L- r3 N( n$ ? K# d. ~# M; N- S - * GNU General Public License for more details.
3 b0 L- h: ~' p$ D& l4 V - */
|% `7 ^) P* c0 p - ?( Q$ h' @2 _, P1 u
- #include <linux/module.h>
% c$ C/ E: S7 A/ v. ~ - #include <linux/init.h>8 A4 s: T: A$ G7 ]% L
- #include <linux/errno.h>6 x6 v# O1 a. C' A+ j# R
- #include <linux/types.h>
" X. j1 _# r8 e - #include <linux/interrupt.h>
( i! T" Z1 N; R2 M5 W - #include <asm/io.h>
6 R! q/ z' C' k: v8 y' E - #include <linux/moduleparam.h> q/ e* E6 \& t& U k7 X& ]2 y. J6 b& L
- #include <linux/sysctl.h>, J( x! D* Z* `% _# {
- #include <linux/mm.h>
: ?5 o3 _# s7 f# O' [ - #include <linux/dma-mapping.h>* E( T0 f9 [" c
$ G5 [ l/ V- J% Y( Y' V- #include <mach/memory.h>
/ }6 q# v, ?" e6 [( z; W" ?/ k - #include <mach/hardware.h>8 u1 u$ d; z, ^- }( o
- #include <mach/irqs.h>
9 L( s. L# r; _+ J) Z2 A+ L% ]# P" L - #include <asm/hardware/edma.h>1 u" N1 `3 ^7 D' n
- 6 @" I J; y% m- b% m7 X" k/ c
- #undef EDMA3_DEBUG: n& ?1 e; H7 x. V i" Q
- /*#define EDMA3_DEBUG*/ ~8 V, f( o" a7 J% U
) Y- f: H( t1 F: h9 C( j! H: X8 d- #ifdef EDMA3_DEBUG
8 m' N! C+ u8 u6 o4 ^2 U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% p# Z7 h" D- T: k6 s) { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 F3 ~( `8 G& }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& x9 g; G7 M W! Q# x2 X( D2 Z
- #else) j4 p0 C% m; d* V
- #define DMA_PRINTK( x... )7 k; K" X5 E: \& o5 \/ a# G
- #define DMA_FN_IN1 n$ A: ^9 B/ Q* G, ^0 B
- #define DMA_FN_OUT h) C+ V: o+ [
- #endif6 Z+ F7 B3 i+ l9 U& T
* {4 q& E* m5 X; A# S; F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ G# u3 P1 r5 ^8 o4 _
- #define STATIC_SHIFT 3( Q# |4 z5 N8 j
- #define TCINTEN_SHIFT 20
6 p( |6 Q" M4 H0 G) U5 C* I. l3 u, a - #define ITCINTEN_SHIFT 21
2 O S1 V" @+ w - #define TCCHEN_SHIFT 22
6 @ W0 F4 U+ f" V* b4 C3 C( j - #define ITCCHEN_SHIFT 23
. O ? x# w- Z0 \% P6 C
$ u" n: j( |) u& w+ }1 L- static volatile int irqraised1 = 0;, e9 B; \% T2 U! P% n9 ~$ R! n
- static volatile int irqraised2 = 0;- \$ I8 R3 T' k! a3 ^2 T
& A; M- g! m X4 ` @6 ?3 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* h6 ?' z3 O9 ^1 m- B* Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 S# O/ c5 @' f+ l( _$ W2 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) O8 p. B; U U5 A/ i3 `7 ], V - 4 W) v/ O% e( R9 e4 n \5 l
- dma_addr_t dmaphyssrc1 = 0;( y( }$ t2 _$ {1 f; n
- dma_addr_t dmaphyssrc2 = 0;
4 C* i2 c9 R# ? V - dma_addr_t dmaphysdest1 = 0;
. _$ x. B" X0 F% Y. y% H1 g. ` - dma_addr_t dmaphysdest2 = 0;
5 `8 U/ |1 |" C0 ]$ Z/ x% P - $ D2 n- |. j, D6 J6 b) t0 F3 T
- char *dmabufsrc1 = NULL;; p1 c# v) I3 C, j; z* J
- char *dmabufsrc2 = NULL;
" b' W2 f" |) I - char *dmabufdest1 = NULL;
$ E2 v& ~( r" {' W - char *dmabufdest2 = NULL;* Y. |% s: D- I
- Q+ h( S; l/ }( u
- static int acnt = 512;% E6 |0 @: n& y: q
- static int bcnt = 8;
; }5 \8 k* L0 y4 h$ k - static int ccnt = 8;
9 k0 \1 W- d: @5 k
8 _- B# n# U0 L) g8 U% H. z- module_param(acnt, int, S_IRUGO);3 P% C3 D* f: {* M; ^) ^2 l
- module_param(bcnt, int, S_IRUGO);
! p1 D4 A3 c- c' h% Q p+ U% T& S. Q - module_param(ccnt, int, S_IRUGO);
复制代码
8 d* K. O: |+ n5 {# ^( z
1 x" P8 f& \( _! J$ h t' U# v& P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! N" g. ~6 K1 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ g7 t* W/ Q0 O2 q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& G/ g' o I: n9 Z: t3 B
y3 }. _) r4 k; i2 F. U0 m7 M) i$ L( G$ N* A: c
|
|