|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # @5 J7 H$ W6 ^3 j# A
- [code]EDMA sample test application
6 G' c* Q) k" L9 F r0 W" U. z - /*
7 V. M. L* S" y8 I: K' `/ F - * edma_test.c2 x6 u) y6 a& F; n+ p4 Y5 v
- *: ?$ |) i- k' f
- * brief EDMA3 Test Application
8 p& w5 c, m' O8 Z - *
) Z8 r* h- q" q0 i - * This file contains EDMA3 Test code.
J5 `) a+ @1 }# Z1 [8 G# \8 C - *+ i8 q) f: ?8 |2 V+ i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, n/ j$ w( X$ [; V5 g% G: P! Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 |' u" c' a& X2 c - * TO CHANGE.3 W6 ?4 B! [( ?7 d
- *
/ O, G S# \$ b5 I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 z; M# {4 X; ^& ]/ | - *
" J( F6 V: w9 B: y1 k1 | - * This program is free software; you can redistribute it and/or
* p! b2 F9 G9 V& R) r* e: S# F - * modify it under the terms of the GNU General Public License as; Q( B1 u" @# ^: q8 t; V& O
- * published by the Free Software Foundation version 2.
0 m: y8 C; |6 S: W - *& t1 R+ ]7 c t7 b1 _' M% E7 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 H; ?+ s$ Z" L
- * kind, whether express or implied; without even the implied warranty8 E( T# _ m; h* P8 P i* ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 ~4 X3 D u) g - * GNU General Public License for more details.& } {7 S: w8 E; x# d7 Q1 G
- */4 t+ x+ l5 a2 [
- 0 }! y' k0 w3 \, i! l( ]$ `+ `# P
- #include <linux/module.h>
- F+ X# W& p. \; k0 K8 t, c! Y - #include <linux/init.h>
3 ?7 V5 ^2 S& q7 u& G - #include <linux/errno.h>
& d+ t/ G1 v Y - #include <linux/types.h>
+ P e2 u: c. E% q$ V; z - #include <linux/interrupt.h>: r! K9 }( O, N1 \; u" c& }: ?
- #include <asm/io.h>' f3 F! T5 S5 h& [3 u4 U6 V& H
- #include <linux/moduleparam.h>
9 C" X- d: T+ q! H - #include <linux/sysctl.h>0 a6 W, n1 w2 k$ x& `
- #include <linux/mm.h>
8 N4 M; M9 L& e1 S" |2 R5 h - #include <linux/dma-mapping.h>
- D! K7 M* P+ i' R: \ - ; ?( a$ \; x, l7 K
- #include <mach/memory.h>$ U3 g- g' k3 s4 d( ^
- #include <mach/hardware.h>
. ?' U) x$ ^2 F - #include <mach/irqs.h>" o: w* B" n$ _- x! D
- #include <asm/hardware/edma.h>
6 X5 q- c! R6 i: k - / t$ C% d4 P! C; J c) H3 |
- #undef EDMA3_DEBUG
+ e5 }" C( [) {9 q5 j. K - /*#define EDMA3_DEBUG*/
9 x& V$ P7 F2 ? - " P: G2 k6 d# R# K1 J" s* K9 `
- #ifdef EDMA3_DEBUG
' v6 n: b$ `( a" M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 I* _; o- b1 \0 Z0 ?+ x: i+ p; h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& T" Q, a" T Y/ A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) Y B) h2 u" Z, A
- #else
5 q$ T, h, k) C - #define DMA_PRINTK( x... )- I K4 [9 p. t
- #define DMA_FN_IN
( M7 b+ }' K; h! M9 {2 A - #define DMA_FN_OUT
- c6 t; `" [9 s, Z - #endif2 Z: e5 z' c& o& `& \! t
3 f9 v2 E1 \* _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 s& P0 m* t( ?0 `- d7 @+ g
- #define STATIC_SHIFT 3" n* _, E! w$ _0 O; E) w
- #define TCINTEN_SHIFT 20% R. \5 r) e0 o6 I
- #define ITCINTEN_SHIFT 21
) G y' T' `5 Y( @# C9 i - #define TCCHEN_SHIFT 22
; h- ~; v W4 k0 e) x6 ]' \ - #define ITCCHEN_SHIFT 23" T1 x" h5 N2 B8 l# \
# W1 p% h- X9 k; L% a9 r2 ?) [- static volatile int irqraised1 = 0;
' W) `; [5 L" o - static volatile int irqraised2 = 0;
$ u: O; O/ w H" ]$ g' v7 S1 X
1 v; c- b: a$ I4 F& c, ]0 O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) n2 y7 o- B% f, s* s7 A5 i$ ?* f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 j/ T5 q. _% q8 H' F# a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# J! r; i* x' r, B' u }
- 2 R: o9 _+ x, p
- dma_addr_t dmaphyssrc1 = 0;
: ~5 d0 }8 g8 W4 T - dma_addr_t dmaphyssrc2 = 0;
4 u8 Y: f; o" ^4 C& \" R9 G - dma_addr_t dmaphysdest1 = 0;
* m$ {8 n* i: B6 W# Q ] - dma_addr_t dmaphysdest2 = 0;
- A8 ]3 O" \# o5 [) h - 1 W% e$ ]! i/ e- ^- k- a$ [: R
- char *dmabufsrc1 = NULL;3 f" A6 m0 O; |6 A" u6 a
- char *dmabufsrc2 = NULL;
: C3 X2 C' J0 Y5 r+ @) p2 q - char *dmabufdest1 = NULL;
9 w. Q! `/ t) j5 j - char *dmabufdest2 = NULL;: `1 v0 V A3 D# d+ x
- ( F' T1 R, C, u- V9 t
- static int acnt = 512;4 {0 x; o8 ^3 h2 _* w
- static int bcnt = 8;' s9 b" V1 j$ Y9 h6 X2 W/ j, F
- static int ccnt = 8;) f1 E2 K, T+ z+ _- L8 M
2 p, @6 [% d: y% ^: S$ i9 n/ F- module_param(acnt, int, S_IRUGO);
, Q& M( q$ @" U( [2 f3 K7 _' t! f - module_param(bcnt, int, S_IRUGO);
. `% u" W1 E8 l! O) k/ U - module_param(ccnt, int, S_IRUGO);
复制代码
/ f3 ?5 t. D% u6 V% D( F3 L& G# @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. H5 K2 v4 t$ z3 O9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ z }- J! Y b4 \1 C, g7 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! h# p' o( E+ P7 ~
, P9 s7 a& k* C4 M' V4 d' P% ]) ^( x% z
|
|