|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + w" d/ M4 b0 H& _
- [code]EDMA sample test application
2 L4 Q, L: V2 K# l - /*$ K% O( p" \/ P; X1 _$ Q+ o
- * edma_test.c' h( x, L+ H G
- *) j$ O! M5 E$ E* P$ j
- * brief EDMA3 Test Application
+ _7 X" t3 l% ^ - *: x% p3 s% ~. ]$ \1 o- h+ G6 ]
- * This file contains EDMA3 Test code.9 U& |7 u( g2 T! P! |! r
- *
( l/ l' \' E s8 w( @% K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* z8 N. U7 A0 v8 V/ ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 `; V1 T) C1 v - * TO CHANGE.
0 p6 l, K" E7 Y - *
& c T+ w% l# f9 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 Q# T9 N) h9 N2 L; W! R
- *
, o) m s. D! T* l - * This program is free software; you can redistribute it and/or. _+ I8 S* m5 ~9 s& R5 H% s! @
- * modify it under the terms of the GNU General Public License as! S2 V5 y: K* ~' T. T7 E
- * published by the Free Software Foundation version 2.
$ c& j) d8 |! a0 Z, L6 i5 b - *2 d5 S2 z" t$ g4 M2 `( H7 z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! Z+ N6 H* ^) \$ P* W
- * kind, whether express or implied; without even the implied warranty( J7 z8 r. b& i6 N3 F$ p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 q j, \7 Q+ v1 x x2 E4 W& ?
- * GNU General Public License for more details.
) G4 |7 w; K( [4 i4 r( f$ R - */
7 ]( N" ~$ y" o4 g2 Y" a }
+ |0 g; @. ~. ~) A: n" g6 Y5 K- #include <linux/module.h>
& {' o" o, p# m$ Q5 O* C8 G - #include <linux/init.h>
- }; v i7 J# c3 ]; y2 t - #include <linux/errno.h>
: R$ B: U" L( m: r - #include <linux/types.h>3 P# b/ b9 O, b% L
- #include <linux/interrupt.h>' Q- }' x, J0 v4 B
- #include <asm/io.h>
8 C& `- o2 V9 Y# m - #include <linux/moduleparam.h>3 h4 Z8 R5 F) C7 I5 [
- #include <linux/sysctl.h>' {8 W; m x4 M4 ^; ^- f- W, f
- #include <linux/mm.h>
; ?* ~/ O" ]6 {0 a9 z - #include <linux/dma-mapping.h>
$ f2 {, N7 E3 ~ @$ @/ C" Q% e
5 |: ^) K" `0 ^! @! x8 `- #include <mach/memory.h>3 [0 G3 S7 N. K& ^7 H! i1 j I
- #include <mach/hardware.h>* t5 I6 T0 Y, Z' S
- #include <mach/irqs.h>3 U& E& {0 g; s. H1 H1 K. C G) @& {
- #include <asm/hardware/edma.h>6 }$ f7 l- @! G- P/ X' v$ i' c
- / e" O: z: C, p$ t
- #undef EDMA3_DEBUG3 E% F6 D+ [4 Z A' I$ L$ L
- /*#define EDMA3_DEBUG*/* `- N& L* j4 J
7 w4 b0 g; z+ d1 @7 X1 p+ F9 W7 f% y- #ifdef EDMA3_DEBUG, Q' z! w* y- S9 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 [4 T. W; }3 C7 p+ \5 F2 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* o2 V# i, j3 T* u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 e1 X4 g8 q! d, @) A1 n - #else5 }, M' @+ j9 x3 A; j
- #define DMA_PRINTK( x... )# {7 w9 d4 ~% Y! V' ~$ a& c- C8 z# ~
- #define DMA_FN_IN# z. n1 J# ]3 ^
- #define DMA_FN_OUT
' D, e0 z+ y3 |" a& z1 A. A9 H# v - #endif
& W$ h) u$ `( k2 G/ M - ' @: y# R# j6 n: Y/ M+ u0 `, W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' B8 q; A# H [* M
- #define STATIC_SHIFT 31 K( I. i; \7 c! C% @/ F# _3 R. z
- #define TCINTEN_SHIFT 20; |9 G6 M' U. Z/ \3 T$ F+ V
- #define ITCINTEN_SHIFT 216 G) v, \6 B9 |6 ]
- #define TCCHEN_SHIFT 22; b s5 K! o/ b% b8 t
- #define ITCCHEN_SHIFT 23
* j) {& Y9 I( w
* N5 I7 m9 h' E7 ^) G, o4 o- static volatile int irqraised1 = 0;
/ B8 b1 J& \9 l L' B& i' Z - static volatile int irqraised2 = 0;; I+ @; E) o% L9 l
- + P1 F" z1 }, w N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; V! b+ B# l1 b! t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& M" a1 M9 u0 ~8 g9 v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- G" e* @( {3 _7 m: ^9 v- c- a
, g3 S$ H' t: e/ t- dma_addr_t dmaphyssrc1 = 0;
- P' v6 E( U/ I o! M( i. b$ O - dma_addr_t dmaphyssrc2 = 0;
: d7 J) S8 y3 Q" u. e9 L - dma_addr_t dmaphysdest1 = 0;
9 U$ Z4 q8 }1 v( z* q - dma_addr_t dmaphysdest2 = 0;$ u# z5 G3 Y" G/ w+ u; i3 u5 L
9 v$ W. V1 h% y' m4 R) [6 `' R- char *dmabufsrc1 = NULL;3 u, P( ]0 F: Z( T5 F, N& L( a
- char *dmabufsrc2 = NULL;
. u+ q* g: l: B6 K. R+ a; `1 [$ h - char *dmabufdest1 = NULL;
3 V) }* I: ]: q - char *dmabufdest2 = NULL;7 o2 F5 x) F+ n
- 8 z& l% H! Y4 J* c9 u; l2 f$ u
- static int acnt = 512;
5 [) y8 w6 _4 d - static int bcnt = 8;, x" N* D- o4 h% I3 B6 U* j
- static int ccnt = 8;
, c% v8 i6 n2 I
7 j8 b0 {/ y0 v0 ?- module_param(acnt, int, S_IRUGO);
; q* n: Y2 s8 { - module_param(bcnt, int, S_IRUGO);+ q5 J( P" ~+ T9 I2 {
- module_param(ccnt, int, S_IRUGO);
复制代码
2 m, k1 Z, {: v: l3 N# m9 i+ e; n* X+ u, V, i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 j2 E( `, Q* e4 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 B4 r4 Q8 Y! S/ Z3 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& E; m6 p. R- C8 F
5 Y/ y. K0 l3 P! {; y+ U. [
7 z& l( a8 W3 l2 c7 r" s: F1 y# ^' `9 t
|
|