|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) I, i: W2 f* r& a2 o( @5 b6 R, a" [- [code]EDMA sample test application
1 }& M* W/ [* Y- C' b! [6 N4 x - /*
2 U+ k3 F. Z6 O9 w0 G7 A - * edma_test.c
1 P* L+ U+ m' i9 t* s; f) \4 w: A; ~ - *
! v, f2 j8 U9 T* \6 k& C& \ - * brief EDMA3 Test Application
; r/ V# H( X0 z' ?" h - *2 m5 B u, B5 B Y/ P
- * This file contains EDMA3 Test code." T; N4 \, F" J3 \6 z
- *
' y. T# q" D/ _8 q M- `2 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' x3 r6 \, T% [- _9 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 f, g% p+ `) Q# U& A, v# U# I. y
- * TO CHANGE.) K4 t$ v; _6 \9 Z1 b8 n
- *
- H: P' Q+ {! R1 e" |/ M1 |: @" Y8 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. z+ [" q7 t5 ^ - *
8 Q6 p9 s- K0 N - * This program is free software; you can redistribute it and/or
5 m8 P4 j* f& C# O- e, A5 w. G - * modify it under the terms of the GNU General Public License as
* a7 f8 M) N8 U/ ?0 \: d - * published by the Free Software Foundation version 2.
, b- f7 r$ f( z- g+ `: q - *. l4 v" U0 |# S( m+ i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 ~$ Y8 g' K4 l6 |3 r" \$ F4 }
- * kind, whether express or implied; without even the implied warranty
- L- {! \: o, w: ?, `! } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 v$ l, @8 p6 h0 ^2 ` - * GNU General Public License for more details.
* U- P/ D) S+ e$ z- l6 e - */
2 Y( l4 P. ?* C4 w# U( F( _ - . j& j' q- G ~! y
- #include <linux/module.h>
3 t, N/ D9 g- I# K1 g6 E - #include <linux/init.h>
1 {8 u3 P6 A0 U" F - #include <linux/errno.h>. K6 ]2 b* O" ~0 w: ~2 H
- #include <linux/types.h>7 j5 {" u: r) S/ N$ u$ f
- #include <linux/interrupt.h>
1 Z2 z- |+ n; e6 C4 Q0 H$ p - #include <asm/io.h>9 T* P) o9 P' g/ [) U
- #include <linux/moduleparam.h>& G6 f3 L/ v# K; D% Q
- #include <linux/sysctl.h>
1 @% X& T$ ]- U% J, m% q - #include <linux/mm.h>
6 M) R# `% B5 n# Q9 |2 w9 l8 X' w m - #include <linux/dma-mapping.h>8 G2 E$ _% c6 p6 o6 W
0 |2 a& k0 ~% G( }, j' w- #include <mach/memory.h>$ F# o' V8 k0 @3 m% y
- #include <mach/hardware.h>9 ?3 O# d3 C) u% U% l: W' h# q7 [
- #include <mach/irqs.h>5 I/ r$ _# I8 O* W- i
- #include <asm/hardware/edma.h>
: g N) @8 a; u, [5 f9 _2 @6 @; g5 O
& A, O$ b- D ] f8 K. s# E- #undef EDMA3_DEBUG3 R+ H4 e* g0 m. s% p
- /*#define EDMA3_DEBUG*/
; Y7 q8 S+ M+ x% J
! h) s* E* [; l9 h6 H- #ifdef EDMA3_DEBUG/ {0 {% X3 r+ o- [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 X4 n+ y: Q0 a4 G$ s. E: I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: Q8 e# `: G+ g6 H& V2 ?5 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ j9 {( q+ `' E0 ?8 E) y0 Y/ ~' Z+ v; u" [ - #else
. ]/ B* {9 F y( X2 \$ A8 L - #define DMA_PRINTK( x... )
( h1 E; l8 h# s - #define DMA_FN_IN: l3 e# E* p, ]/ C5 X
- #define DMA_FN_OUT+ E4 r' A/ W9 c
- #endif
, ~2 [( v8 V, w! }! q; J; Y& W - 6 f8 r/ s$ o7 |, i) x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ C6 P" f- c/ \/ d1 `3 {% s
- #define STATIC_SHIFT 3+ z ?$ m4 I- z9 ~* C Q% ]2 n* E
- #define TCINTEN_SHIFT 20
- l1 N: L+ l7 e5 C# ]" F Y - #define ITCINTEN_SHIFT 21
5 E1 d) ]" z4 Q: K - #define TCCHEN_SHIFT 22! i4 g+ L3 s% K) w
- #define ITCCHEN_SHIFT 233 w3 _# A8 q6 |) O
- 2 f4 T( y! f' k( v$ }+ f
- static volatile int irqraised1 = 0;
9 t, U2 \" d( G, I+ M2 ?5 P - static volatile int irqraised2 = 0;) E* ~. z% {0 n
- 3 j! H& D' j$ ]; C$ w) d! Q0 j5 x) Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: r' n6 B* O6 q/ w0 p I) A( S: i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 F N8 ^# B, O- G0 T( a+ B& o8 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 F# C1 H5 P, G: F
- 6 _0 I' p( K0 u4 ?# T
- dma_addr_t dmaphyssrc1 = 0;
2 A6 o9 l N/ w4 L- d. p - dma_addr_t dmaphyssrc2 = 0;
7 }; f: H% T. c: w {7 ]* a& d8 p* Y - dma_addr_t dmaphysdest1 = 0;! B& P2 z1 _$ `* g' L1 K. ?
- dma_addr_t dmaphysdest2 = 0;/ }' W6 |) X$ H. x
. I( s+ V# O3 }# J- char *dmabufsrc1 = NULL;3 m* o! V1 f0 F& t* l8 t
- char *dmabufsrc2 = NULL;
* x* y' f0 {1 e# Q$ u - char *dmabufdest1 = NULL;8 j! I! a8 X9 ?0 x6 z9 y0 s7 l
- char *dmabufdest2 = NULL;$ h% J+ }& d8 _" E6 N- E
- * r* S$ I, ~1 B1 h) ]
- static int acnt = 512;9 v9 j `9 P( ^, y& r/ C7 P! \( n
- static int bcnt = 8;$ O& L' U" ^3 a' l$ V
- static int ccnt = 8;
4 U3 E! R8 k& m! o m4 J5 G
|: P7 }4 j! ^* ?0 V& N- module_param(acnt, int, S_IRUGO);) n! q) _' A! i7 x3 l
- module_param(bcnt, int, S_IRUGO);+ u O" u ^2 c0 z- K/ z
- module_param(ccnt, int, S_IRUGO);
复制代码
, ~/ h. u9 B9 J1 y1 ]2 o3 }* j- @) r4 ]! I5 O! }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) G' S: V. V: m- Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# H+ b) @& o# c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ Q3 G+ I) |" K% i. ?7 s
) Y1 K |+ X- [9 p l' |5 _5 n- `- m! N7 b' o7 E
|
|