|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 X7 a; k; _" }2 o% f' w
- [code]EDMA sample test application
0 A E( a" I( E - /*1 w3 }% @9 L! a" d
- * edma_test.c
& }* h, @; _! p2 V( n: F& c - *! h$ T6 L R5 f: U- B& ^7 D/ v
- * brief EDMA3 Test Application* ]/ p. E; V6 l1 R- U
- ** }( ^; o3 T6 W3 R9 s
- * This file contains EDMA3 Test code.
! H' k9 z9 ~+ l- Y! j2 j* } - *
7 R( g- ` D9 d% A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" y2 J2 u+ I: f! c8 e& W; U6 e- R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 c- r- @" _* O$ ?8 s" J
- * TO CHANGE.
, o/ O) B* C9 Y - *8 g/ R& b0 Q+ R! Q8 Z9 s0 }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* f" Q$ x6 B( B6 X! G$ H: o# \5 v
- *
# g0 ~! k# x9 m; a1 G - * This program is free software; you can redistribute it and/or$ d+ X& C7 r2 y: x- I% n
- * modify it under the terms of the GNU General Public License as& @" p& z" B) `. z+ K/ w5 i9 b& n
- * published by the Free Software Foundation version 2.
6 f$ y# m& c4 e( u - *# e7 {/ A# c7 _8 e* Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: r0 s! A( T' m
- * kind, whether express or implied; without even the implied warranty
* L- I- ^) a9 p* o; y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 z2 x* F3 t8 p0 u - * GNU General Public License for more details.
; A. J! k6 s! Y( [- z% w - */: ^; k& r* O7 q* K D$ g
- , d3 w" X: S5 W% l* P
- #include <linux/module.h>7 \: \" ?& r7 O9 `$ t M$ W
- #include <linux/init.h>. _% m! [! u+ O
- #include <linux/errno.h>, q2 N8 w% j8 l
- #include <linux/types.h>0 V$ S2 q' x, f f: v
- #include <linux/interrupt.h>- M( Z2 w& Q L- | X* n. h
- #include <asm/io.h>
3 U' j$ S& z" ?7 t/ T/ ^ - #include <linux/moduleparam.h>
0 c c1 ^/ O1 U; A. {) U - #include <linux/sysctl.h>
/ i& e- B/ D1 F( N - #include <linux/mm.h>
( j) [6 o5 z5 A' h1 {# ?6 `. I - #include <linux/dma-mapping.h>
5 V- B9 j6 |" x9 L' i7 r& ] - . V9 C4 m5 N$ q. z6 t: ]; r# |
- #include <mach/memory.h>5 o& e6 z( s% j* o" I3 n
- #include <mach/hardware.h>
# U Y7 I5 g0 j( L1 Z' r0 u% @1 C: V - #include <mach/irqs.h>
' S! H( I b3 \! n. d2 _1 y3 V - #include <asm/hardware/edma.h>
Y$ ?8 N/ @! ^- ^) G; s
' j2 S8 W3 _+ |% x( K3 L. @- #undef EDMA3_DEBUG+ @/ R) I6 ?$ H
- /*#define EDMA3_DEBUG*/
2 b2 X# ?5 B5 m7 j( m
) x' r& o$ s( t' R6 T$ l" w# _- #ifdef EDMA3_DEBUG5 ~5 L) ] r4 a# J8 m3 U4 K( C J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# @/ f" m; Q* Y. ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" k1 v: N G. K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ @1 s$ |( \* s, h - #else
% e4 M+ L: l' ]; m' o4 Y - #define DMA_PRINTK( x... )
8 m' a" I" d/ I) v2 d8 l3 k8 z - #define DMA_FN_IN
1 N/ F1 f$ H/ T - #define DMA_FN_OUT
, j( }0 H5 x2 U5 ^0 D0 n# s" Q- { - #endif
- ] O5 h' B2 _* }, r - # t' p) T/ }, W9 M) ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): f7 m( | t2 o- D7 f; g3 L
- #define STATIC_SHIFT 3
- o [- I3 U n9 | - #define TCINTEN_SHIFT 203 [9 n3 F) I) t- v
- #define ITCINTEN_SHIFT 216 a* ]* A2 o0 [9 U# [, _+ h
- #define TCCHEN_SHIFT 22
; F4 I: O! z* l5 S& B; s - #define ITCCHEN_SHIFT 23( Z- O4 s4 ^: W4 {& d+ {
- ; x; W4 D% f; E8 Q0 L
- static volatile int irqraised1 = 0;" W% b* d* ?' g4 B6 F7 Y2 Z
- static volatile int irqraised2 = 0;2 Z; P1 I" h6 }% E
$ `5 n' k O- ^0 n' ]* ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( G+ W' G ?3 \( S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' E+ t. \2 n0 W+ T" D' L6 G) f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 g( Q" u: C% `- K0 Z! j* Q
- 9 g# s0 Y" d9 d5 l. `5 G
- dma_addr_t dmaphyssrc1 = 0;. d# V3 E" E i/ R) {% D
- dma_addr_t dmaphyssrc2 = 0;/ A/ Q6 j0 w% V$ [! ]
- dma_addr_t dmaphysdest1 = 0;/ }- G7 f4 s) z/ |$ n
- dma_addr_t dmaphysdest2 = 0;
' p' w# k% U1 j3 u" [" `, W - % ?; V- D1 Z# N3 N
- char *dmabufsrc1 = NULL;
, S+ @+ o8 | L( N( ~7 k6 m9 z - char *dmabufsrc2 = NULL;
& [+ G; q$ t0 m: t, r - char *dmabufdest1 = NULL; R$ ^' D# \8 F% S$ F
- char *dmabufdest2 = NULL;8 ^% e- L& ]- f: E# J f
- 3 m, f* _! g( Q1 P: y3 |' r8 q
- static int acnt = 512;- i6 }3 R2 s/ G6 h
- static int bcnt = 8;
8 w6 q! m: G5 B6 N6 k" F - static int ccnt = 8;
- I0 L% Z1 ]2 } - 4 b! V( I2 {6 {3 |
- module_param(acnt, int, S_IRUGO);/ b: i3 A2 ^1 o9 Y2 n
- module_param(bcnt, int, S_IRUGO);6 P/ k+ s7 V; I2 m8 b3 [0 r: {
- module_param(ccnt, int, S_IRUGO);
复制代码
! H6 N7 w! a# F0 t& U1 T/ `1 b; M6 G7 K0 C$ z" K8 B4 Q$ K9 n3 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
g3 l; c: V8 B. jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; q6 R9 n+ m" |$ J1 l5 R R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ @. T8 b% p3 Z3 X* W6 }7 N2 V) j2 ^! u
/ P9 _4 I' @3 c' \ |
|