|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 `" m3 [ d- R1 e
- [code]EDMA sample test application" j6 P% y- F* z0 S; p+ r
- /** a+ t; h" R8 ]) k' j' }
- * edma_test.c/ X( o- G' D6 h5 V: T. Z/ ]. c
- *
9 g/ y5 P0 E. g4 z: Y - * brief EDMA3 Test Application
$ z* ^1 _$ p$ s - *. O+ W; w# ]# h8 g. x# G, u
- * This file contains EDMA3 Test code.
* C& d& l4 i: w( m. L - *$ w3 t2 r, Q3 e3 Z; t9 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, g. ^2 g$ _/ _; G3 T \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ t1 T& {4 e1 [, F - * TO CHANGE.
* N% i/ `+ K( ^* }6 C; f - *' I9 @4 i X: y/ F/ T4 z5 R) D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% j+ K$ e/ p- @) L; L - *- P8 G. H; Q* W! s
- * This program is free software; you can redistribute it and/or
* f# Q" m; K1 b: B0 M7 q - * modify it under the terms of the GNU General Public License as$ p+ X8 t: Y1 J) s
- * published by the Free Software Foundation version 2.
m8 H! a/ A* Z5 R. n - *
2 \: t8 P) {* ^% Y" v! D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% a4 X; e- D0 c
- * kind, whether express or implied; without even the implied warranty
Y' G( G R5 R% w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 l C3 n4 O; y0 z D) h - * GNU General Public License for more details.+ B6 b1 p% }' W! u2 T) l
- */
P Y; I! H3 h+ _/ h - 5 k+ c/ ?3 \# T" K8 H3 D
- #include <linux/module.h>3 G: f5 M1 C3 ~, i3 w; Y
- #include <linux/init.h>$ A+ P# M& U1 G3 u+ k
- #include <linux/errno.h>
/ `% A) L% p ]! X& I' I - #include <linux/types.h>0 m9 |8 D5 J, q- t- Q
- #include <linux/interrupt.h>
) K/ R. }. J- K( A1 w - #include <asm/io.h>
# M/ w! A n5 c; \$ x3 ~! e6 p8 J - #include <linux/moduleparam.h>: [# f3 u5 E* L
- #include <linux/sysctl.h>0 z+ k8 q- A' h' K/ B1 _
- #include <linux/mm.h>! N- g3 w* w, t
- #include <linux/dma-mapping.h>
; ~3 n- ?( V' Y' Q) O - 9 d2 d+ Z8 M7 b x9 ^/ U1 ?
- #include <mach/memory.h>
$ X' H7 o# H7 a9 j - #include <mach/hardware.h>% H# d4 s1 u- H& h& @1 a
- #include <mach/irqs.h>
7 B e6 h% E( B4 R+ Y, B$ z - #include <asm/hardware/edma.h>
3 X3 T" M9 H+ a! e - 0 `. u% ^" K. {
- #undef EDMA3_DEBUG* I; Z& d4 p3 X8 g/ O5 Z5 A
- /*#define EDMA3_DEBUG*/
, O2 ]; B" @4 J! r6 p9 ] - 0 u& M O: P. ^! d( Q3 r
- #ifdef EDMA3_DEBUG
9 X/ |! Y8 L! ~8 E# n3 {0 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 _) B4 I5 E# a0 `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 G8 c. L2 p$ n) t9 R9 R$ r% ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 H; D3 A4 C2 w, y5 R - #else+ N6 K; T- f7 t+ _8 P u& V
- #define DMA_PRINTK( x... )
& d9 p# l6 j- ?, ` _ m$ N0 H2 y - #define DMA_FN_IN
. E4 {, v" l+ V - #define DMA_FN_OUT
+ ^7 W9 [( ?5 R5 S- a( ~ - #endif5 x7 ?; k0 g' _
- T+ Z# ~1 e5 l8 j5 _: e7 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! k: s* T1 Y0 A+ V8 v% K1 ^/ l
- #define STATIC_SHIFT 3 f( _+ S l3 s- ^
- #define TCINTEN_SHIFT 20
9 N( T# K# ?/ w- f - #define ITCINTEN_SHIFT 21
- j |* I: C. V, [5 d - #define TCCHEN_SHIFT 22
: f7 B# h( c3 F' [( Z - #define ITCCHEN_SHIFT 23( J5 c' i: A7 P g7 `
# G& G8 x& [7 |- static volatile int irqraised1 = 0;
( k9 T0 K9 m; Q - static volatile int irqraised2 = 0;2 D# O0 h& I* Y; _
9 [/ N! y% O' ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, u( k; R$ D7 y' ^1 \: L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b8 S, c! o% p0 G+ M# e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: F2 F0 g, Y4 Z) n6 @+ b- \
( h9 I6 W9 E3 }5 I- dma_addr_t dmaphyssrc1 = 0;
' l3 I- p9 f W" s }5 a$ S8 V - dma_addr_t dmaphyssrc2 = 0;! H$ @0 m& O: G$ I2 ~
- dma_addr_t dmaphysdest1 = 0;
& p$ W& `1 _# l: p# [! K/ X! ~ - dma_addr_t dmaphysdest2 = 0;% y# |* |0 ~3 l! k3 @2 B0 p$ B
a8 b" e' x$ N, S* X6 W. ^- char *dmabufsrc1 = NULL;9 P* m: }8 ]9 u" M" Z* x5 x0 z5 G
- char *dmabufsrc2 = NULL;5 V& @. K" l4 D+ J* I9 b
- char *dmabufdest1 = NULL;
5 ~. K- h; M J - char *dmabufdest2 = NULL;1 @/ t c) r" X
- 5 o( T) @- O+ c# h1 ?7 n. G% n
- static int acnt = 512;
: H$ F( v$ _7 p' K$ H6 K3 s7 t - static int bcnt = 8;- W6 k- j8 J: y% W7 y
- static int ccnt = 8;/ m- T9 _, _0 R+ X) I/ I
- * R. t' R7 t2 j; L% y4 e$ _
- module_param(acnt, int, S_IRUGO);2 c1 y6 X2 |& o% t; \8 c$ t
- module_param(bcnt, int, S_IRUGO);2 l& b3 }4 B6 n) E( Z- w4 e3 a
- module_param(ccnt, int, S_IRUGO);
复制代码
5 }" b0 s1 e) ]! P: I7 O7 ^' _. I
# U% r3 g# D1 o* y4 ?# @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" d( P8 m. b0 |1 [( n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- ~/ r: a) z7 v1 q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 b9 i. {, z5 j
# V$ B1 A+ M: s) u) J) g% [: m% O
$ F0 P8 B, N/ o U4 E! K) u |
|