|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; B- h0 p9 f/ s& I4 w% Z1 U# T( Q- [code]EDMA sample test application
% x9 a% L: U( t4 v# @9 G7 g6 k - /*$ t% {" Q f% G G2 P
- * edma_test.c% p( r+ P2 C, p# T
- *" O& t$ x% ?* R( Q& a5 |' |8 u
- * brief EDMA3 Test Application
& W" I6 G, G" i9 i* r9 C2 P. @ - *2 R( \' n. a; y+ w9 Q2 j
- * This file contains EDMA3 Test code.5 R+ i: [: V6 h N0 p/ \; C
- *9 Y5 h5 g# \6 c) i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) h0 L) G$ d) R* e# \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' i# |" { `' b$ T
- * TO CHANGE.; W: C0 h P0 r" I& F$ h
- *4 ~1 n7 d1 O3 i* m2 M5 z; i( z$ [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: H. c+ ]1 B1 M/ t: B - *
2 n3 M, Y5 v! `! H# F6 e - * This program is free software; you can redistribute it and/or0 O5 E; E- j- m$ w5 {: Y
- * modify it under the terms of the GNU General Public License as
( ^3 w% [- p3 R2 Q! A - * published by the Free Software Foundation version 2. L7 F; M; B$ b" K, ^: {* ]$ J
- *
8 h+ c4 T- v, `& {5 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. t( M! v2 O b7 t9 e7 h
- * kind, whether express or implied; without even the implied warranty
+ G& X2 K) [& a x0 l* C, a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' n; C# |+ l8 a. o - * GNU General Public License for more details.) A* D$ N3 d( a; b8 j
- */ K7 \( g+ D( C7 p! r4 A
- Z* m# e# ^" k# |- #include <linux/module.h>
$ P0 G+ a( g0 D3 q4 K9 H% j - #include <linux/init.h>& O6 x. q3 I( F! {! O$ i+ X4 q
- #include <linux/errno.h>5 g" c8 W, ?# d0 z9 N0 O0 P; g+ h
- #include <linux/types.h>
6 J' @, q ^% ~, L9 d - #include <linux/interrupt.h>' t8 H- n5 g w) J# O
- #include <asm/io.h>
0 U. z: D' s' \7 |; C4 o - #include <linux/moduleparam.h>
6 r9 t/ M+ s, t; g5 f1 C" S3 D - #include <linux/sysctl.h>
. O* j7 E' C0 y. |$ B - #include <linux/mm.h>
5 V) \" N0 p- q% I - #include <linux/dma-mapping.h>6 V- S8 M( H1 I& `8 _/ m* }
- : Y) U6 H+ T/ ], ~8 H7 J
- #include <mach/memory.h>
3 |9 @0 R0 G# O" t$ t5 @ y - #include <mach/hardware.h>
8 h$ ^9 K3 F1 B% T: {3 q0 m6 Q$ S1 _ - #include <mach/irqs.h>6 e4 O& b& U- k6 W7 K/ e6 W+ j0 h
- #include <asm/hardware/edma.h>" ?8 s2 `( s+ k8 s) |
. n7 E' C2 l" H5 o- #undef EDMA3_DEBUG
; U5 d4 u, F) ~+ U, E8 J1 B5 J - /*#define EDMA3_DEBUG*/* u3 Z$ n$ [' S0 [
$ p8 n" ^+ l8 ^9 |- #ifdef EDMA3_DEBUG
9 X+ V2 { |. e/ A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' c! [% |4 Y% E/ K2 |; o. | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 _# U" M, y, E; A: N {" C" |4 g/ N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ \7 i8 ~/ E6 l1 ]' \ T* r+ M - #else
/ M7 c/ B- L ^: Q! }3 o4 L" \ - #define DMA_PRINTK( x... )7 A$ m4 U% y9 I
- #define DMA_FN_IN8 e- d+ Q g7 y# W
- #define DMA_FN_OUT$ m) e5 O- H; D: k
- #endif
. i: P, K# h f8 O; j* y0 ]
" l n7 m; G. t4 |# ?, v2 `0 ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- Z( m+ X. [6 n& J; O. a
- #define STATIC_SHIFT 3
5 ^$ b/ n) z- ]0 ^; m - #define TCINTEN_SHIFT 203 ~4 ^$ d6 O; |$ u2 S
- #define ITCINTEN_SHIFT 21& j( j1 ?3 S0 |- M2 H" h
- #define TCCHEN_SHIFT 22( y6 M' V @4 O* O9 T
- #define ITCCHEN_SHIFT 23
" s6 W6 v( M3 l2 N! C) h - $ \+ ~# `) B0 D i; ]" b( `0 k9 J
- static volatile int irqraised1 = 0;
$ ?9 k$ K. i8 S2 D - static volatile int irqraised2 = 0;! h1 S" o; D$ @/ o+ B l, o
7 M6 g6 I5 q, R) W5 E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" o" o/ C& L2 d' z1 k( t( n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; |# t$ Y4 Z/ o. ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 Z. m( O' f# g7 m3 N G
2 ~7 Z( K8 V* s: V, `. f3 _- dma_addr_t dmaphyssrc1 = 0;; d8 y; A3 {7 j; }
- dma_addr_t dmaphyssrc2 = 0;
. I6 P3 m! P! ^ - dma_addr_t dmaphysdest1 = 0;
2 S5 X/ ~- o- B# a - dma_addr_t dmaphysdest2 = 0;+ c+ g1 U c/ w0 e. z
1 W3 m4 v# e+ U2 R7 D8 W1 V- char *dmabufsrc1 = NULL;, u9 W. U: D+ p# I' L$ m6 n# s
- char *dmabufsrc2 = NULL; O. y5 _* p+ X
- char *dmabufdest1 = NULL;7 B* w; m3 x% ^7 ?/ F% }
- char *dmabufdest2 = NULL;
, M; G- p% L+ |; M! t! C( B
* A6 b2 a$ B, ^7 b8 y, J- static int acnt = 512;+ j/ |/ `7 o8 {5 J9 F2 E
- static int bcnt = 8;7 `+ }; X# ~" `! ^4 ^/ z/ F6 m0 w
- static int ccnt = 8;
" d$ s( t, Q( M9 I# x1 ?6 z
6 m3 c2 r4 A* @. h6 b- module_param(acnt, int, S_IRUGO);
4 z5 h6 ^3 Z5 _ - module_param(bcnt, int, S_IRUGO);
" [5 F4 R* B& @. b - module_param(ccnt, int, S_IRUGO);
复制代码 ; u# ?$ r" y4 P$ N7 C9 y+ q$ Q
) B% i3 k+ M) x8 ~' h! N; R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 O! V. H4 l2 X0 j3 W3 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 n5 g! L+ r! a5 ^2 {1 V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 U5 l: B3 _ c& X8 V2 P" ]
8 D2 L6 V0 N( C8 b- K2 x& ?* U" C" j& Z3 d( l0 o1 K* z
|
|