|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ R2 c5 W% K% D6 ], R- [code]EDMA sample test application
& G) {/ C+ i r6 o ^ - /* A9 T" s" T) Y, Z% @" `% d
- * edma_test.c
. Z! @) \$ J7 f" {8 z! K! R1 j - *6 s/ K; k- b: F8 \" c
- * brief EDMA3 Test Application# B' x1 E8 n& o( v& B# p
- *
2 a* B( F2 F8 u# N7 N- C+ T; t - * This file contains EDMA3 Test code.' ` ^% s* {( \! P7 V$ m) F
- *
+ J3 W1 N$ {! g7 X$ ?' b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! G! m% ^# S- c# ]" Q+ Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% z# P4 P. w `# H9 E$ D% ~( w
- * TO CHANGE.
. G4 O# p: u, e6 y/ u X' {8 v - */ W; E$ c& n! x. O. B6 E+ D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 \3 t8 p( h' O5 Z
- *
3 ?, u( y& V: {' {5 H: o. f - * This program is free software; you can redistribute it and/or$ B. Y0 \+ [. h' v1 |7 V; _( b
- * modify it under the terms of the GNU General Public License as. C+ B* E3 C: k4 P" m
- * published by the Free Software Foundation version 2.
* {) q( t$ }, L; `$ l j+ ? - *+ U" [0 g0 g$ |# l& ~! K& J; j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' ^8 U- w- L* n: K9 b* s" j; n - * kind, whether express or implied; without even the implied warranty
7 @) r7 g& V! R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 m2 E2 C* | H
- * GNU General Public License for more details.
; i0 `* U9 V0 v+ F6 K - */
\" O2 x+ S# G$ s8 ~ - . Q, Z m: t; [/ {2 L
- #include <linux/module.h>
4 \7 ^. r0 A) y: U - #include <linux/init.h>
" T! m( s$ m7 u( L1 B% O - #include <linux/errno.h>6 |7 \5 s7 F/ I( O8 S& o8 _; h5 v
- #include <linux/types.h>1 K' V1 \! V1 m$ i" ?
- #include <linux/interrupt.h>
/ {2 [: G3 u2 g" O/ ] - #include <asm/io.h>
1 x, E A1 E' ]7 r! G) ^+ W - #include <linux/moduleparam.h>8 ]6 }4 h7 a' |. |( `* } r
- #include <linux/sysctl.h>
0 _. \# [0 N7 l. |% I4 f - #include <linux/mm.h>
1 L: w6 i0 Q' Z. @) C1 O. k - #include <linux/dma-mapping.h>
% G9 U+ O0 m5 G* ^ - : g: R. v) u/ K0 c1 u1 G/ S
- #include <mach/memory.h>' j; G9 ?* n) V9 h" ^5 g9 [9 ^" k
- #include <mach/hardware.h>! c8 g1 x. k; L8 j& c' j
- #include <mach/irqs.h>
6 I% _ `4 G0 x/ E: _% |, `4 ` - #include <asm/hardware/edma.h>3 }% p9 v% E" U3 l7 @3 n% S: X$ _
, N' N! a1 e2 {9 [6 E, d" O6 h. Z$ q- #undef EDMA3_DEBUG) h) H8 J. }0 o! X- s3 [# j4 h
- /*#define EDMA3_DEBUG*/
3 `1 e1 r, ?! I( C% K, V1 A) ` - $ j$ S6 y4 w2 v4 O+ E1 u
- #ifdef EDMA3_DEBUG8 K$ ^/ d* B+ x% h( A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% G2 C# }* o: C9 Y' K' Q2 _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 o' [; A6 a; c& H1 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- k- F" ~2 h1 B - #else2 k+ P, f: I9 A8 G% A
- #define DMA_PRINTK( x... )+ }$ y8 ?( M, I
- #define DMA_FN_IN) D( G6 ]. S/ p7 Q' F3 y
- #define DMA_FN_OUT
; Q" l3 H5 {: {% R- \& g - #endif
8 a5 S; C$ k5 N - 8 }1 }1 G3 g, v5 u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): D' Y; K4 [, b6 g8 Q& R: F7 T
- #define STATIC_SHIFT 3
1 J3 _& [( Q! }3 Y- i- O - #define TCINTEN_SHIFT 20, f) }: S5 x2 V. W8 [* ~
- #define ITCINTEN_SHIFT 216 i2 U- \. q1 ]) Z
- #define TCCHEN_SHIFT 22
0 n3 c4 b, C- }5 E - #define ITCCHEN_SHIFT 23
3 U& j8 D; M) t! _, a - 9 P% I- j: {9 j+ u
- static volatile int irqraised1 = 0;" \0 a2 U5 M$ r! ]
- static volatile int irqraised2 = 0;- x7 F- T9 X, o6 x/ V
- ! Z. v1 r: ~1 Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ v2 E1 E9 ?$ O' y1 Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 d: K1 ^$ o9 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 q- Z! X# k# |0 X& Q9 X+ q' X8 ?/ O) y - + g" {6 }9 V' n9 B/ k/ ~+ c
- dma_addr_t dmaphyssrc1 = 0;# o1 A+ _- B7 U
- dma_addr_t dmaphyssrc2 = 0;
2 {/ o' X: Z7 K, c+ t' B! o' o - dma_addr_t dmaphysdest1 = 0;' C! t+ t- ^% I, F+ i: p
- dma_addr_t dmaphysdest2 = 0;
% B' b: L) p) S5 C# y2 Q - 6 H( k( z) N* y. C/ z& Z3 K: L
- char *dmabufsrc1 = NULL;& a, @6 z3 |. F
- char *dmabufsrc2 = NULL;
& B9 b* A" w# a - char *dmabufdest1 = NULL;$ Q) s1 F& H2 ^% l$ L7 ]9 z$ ~% |
- char *dmabufdest2 = NULL;
" q N6 X- j2 Z2 u - : n2 n0 t: h4 @' ~% K% s5 }9 A
- static int acnt = 512;
5 F1 x' m6 F6 C5 }6 ]+ w5 l% i# p - static int bcnt = 8;
# w; v, P, ?2 S8 w2 v) T$ T - static int ccnt = 8;
+ J+ a1 H. X2 a: g - + C4 \. j+ J1 j* T+ B+ Q
- module_param(acnt, int, S_IRUGO);7 N# I; p7 f$ A V
- module_param(bcnt, int, S_IRUGO);
+ Q. V# z! g9 W6 v' j0 d - module_param(ccnt, int, S_IRUGO);
复制代码 7 e1 @9 D" {1 p0 x
* h0 R+ j+ Y" i ]- G" W1 I, v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; F" b+ j$ b- c! [" farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 w4 S' B d k8 m, i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' |" |& b- O; w/ o
. ]( q7 J2 N4 D( E, P2 C: A2 ^' @
3 K1 W9 E" t7 V) `' L" v1 H! X |
|