|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) w$ A9 j. U9 ?; R$ S) u+ N1 A- [code]EDMA sample test application$ ^9 t; M w8 f
- /*6 I& t& `$ ^9 `* m7 W( q2 _
- * edma_test.c. J* s+ H& \0 w/ \! r! ]* j5 q
- *
' L _- G' R% t9 o - * brief EDMA3 Test Application0 I$ E) ^/ k, W" R9 q2 B8 [
- *7 ?: [( w$ `0 ]8 r8 m+ j. w
- * This file contains EDMA3 Test code.
8 a% ]7 q6 ~3 m! C/ K" }: R - * h; ~) K9 W/ y+ q) B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 J. \, j$ h, ?/ C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 I7 ]$ s; K. V - * TO CHANGE.
1 u2 S6 o7 J* p* N0 W - *( e$ J8 O$ h, j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* \: a1 `% X. [2 I# x - *4 ?; Z; f3 d$ D* d) ]& W
- * This program is free software; you can redistribute it and/or
7 d; g$ G0 l1 m* e- Q - * modify it under the terms of the GNU General Public License as6 O+ n7 K! P, J# |
- * published by the Free Software Foundation version 2." Z% M' m8 g! O2 A4 o8 f6 s
- *
6 {+ P5 T! ?$ ^6 k- |$ Q1 O+ u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( x2 v* n9 a: k& _/ g- E$ [
- * kind, whether express or implied; without even the implied warranty
9 a9 w& J+ U4 U X2 E! l1 T8 b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 U& Y5 J3 g4 L- R8 X/ J% x
- * GNU General Public License for more details.: V n7 Z+ I6 `
- */
" {4 @* x. E4 g9 N - + A5 x0 ^$ Y% q+ l
- #include <linux/module.h>
) C: [4 W: m& @& F3 M! e - #include <linux/init.h>) T+ e9 Y: z; J( J- _/ n& Y' V
- #include <linux/errno.h>
- ?" b. G; C2 v" [! K V - #include <linux/types.h>1 Z- M' g& b. V* s, z
- #include <linux/interrupt.h>
8 F. f5 Q) I6 E; }# q - #include <asm/io.h>
# Z1 P `6 d! [! T) ?$ c7 M# p - #include <linux/moduleparam.h>
w; [# v+ m0 ~% U9 v4 Z* C. e - #include <linux/sysctl.h>' ~- o* G( w1 V: R6 A: L$ `
- #include <linux/mm.h>
% ?' X% u, L& G6 S - #include <linux/dma-mapping.h>
$ m! W3 c# g0 n( v
, f0 R% O! M. ?7 L% n- W; f4 V" u- #include <mach/memory.h>
6 B! I& B$ ?+ ]' m3 L% Z - #include <mach/hardware.h>5 X2 @* N* O# f! V, T
- #include <mach/irqs.h>( X1 L K' Y) L
- #include <asm/hardware/edma.h>) F- W( K" ?" G
8 D+ J* }- `. \6 D7 o6 V; C- #undef EDMA3_DEBUG2 ]: G. o5 h; A: x1 p8 f
- /*#define EDMA3_DEBUG*/% |; Y+ z% v. ?7 K, ~9 k9 Z
- 2 n% u3 Q2 o2 M
- #ifdef EDMA3_DEBUG
) l! j: a8 B ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), T6 h4 E0 P2 q. I% N! {5 K1 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& u& A5 ~( ?6 D' _5 \6 ~1 i, u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% X5 D0 M! l7 T) R/ k% u7 |
- #else
, v" V, W' w7 X$ h) i2 _' I - #define DMA_PRINTK( x... )
4 J5 n6 z' y3 V+ F4 H3 o$ C' }7 n - #define DMA_FN_IN
! A+ N3 b, Q0 o - #define DMA_FN_OUT
L2 u" ~0 l. L) K$ M: c* U# J5 b% Q% L - #endif
?9 w i; _. z M; d( o0 v E - ' z& Y6 ~, L' f) b. I' Z( O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% p0 J: U$ `1 y4 B- M; P
- #define STATIC_SHIFT 3 S* A6 B9 v7 W/ R- ^4 K# T
- #define TCINTEN_SHIFT 20/ v' p) A2 W! O; G9 B
- #define ITCINTEN_SHIFT 21/ r+ N: P- u/ z9 p, l
- #define TCCHEN_SHIFT 22
, i8 X0 g+ f8 ?* |4 p8 y - #define ITCCHEN_SHIFT 23& ^: O3 N) V' L+ a
+ f+ |' z# V- E, A- static volatile int irqraised1 = 0;0 ~$ e% j! ]3 \, C1 w3 B
- static volatile int irqraised2 = 0;
w+ Q% M! p2 ^! m& i; X' X) p$ o
7 ~& R6 X f l/ m. E. d- b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# k7 n' v: \9 f: l+ m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' {7 K! L5 z; W; @9 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. J$ C$ ` r6 m. e+ {8 N3 g - . e5 i0 r1 K2 N8 L3 r) U
- dma_addr_t dmaphyssrc1 = 0;
' U z+ t2 E" _, d - dma_addr_t dmaphyssrc2 = 0;- m l' m- J( b0 v! t+ U
- dma_addr_t dmaphysdest1 = 0;
" q! F$ @! x4 `! U( w - dma_addr_t dmaphysdest2 = 0;% ]9 F' E! Z' O- X/ L
' V+ q; u. P5 U* x* }3 d- char *dmabufsrc1 = NULL;
! C5 g+ K% e! Z+ B" P - char *dmabufsrc2 = NULL;
. p) n6 J. Z1 j; x! ^ - char *dmabufdest1 = NULL;
- B4 E( Z8 F+ W) ~# v) e7 Q p - char *dmabufdest2 = NULL;4 {/ K0 D% y6 n2 T6 ]6 ~0 N+ s+ E
/ A# u' K3 L) E- static int acnt = 512;
5 l# b! w$ ?& R+ S& u6 f - static int bcnt = 8;$ p" m! y' {" c0 u+ K
- static int ccnt = 8;
7 w/ K5 o' ~ @: D4 _
# u& d5 U8 h/ N7 D1 T- g. v- module_param(acnt, int, S_IRUGO);
/ |) a% R3 X& Q7 T0 g - module_param(bcnt, int, S_IRUGO);
u- F1 t `4 l, m+ B O - module_param(ccnt, int, S_IRUGO);
复制代码 - ~4 v4 F" L, ], u/ v( n) c+ ~; O
# Y7 x9 W8 G, E9 _( ~" \) S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* d. k% D( O' Z6 T+ S% A4 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) n5 c2 v4 ~3 R, ~% V' t' ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ M% d0 W! _7 q! r/ D- `0 o4 c. y" v) {5 H1 _ k- ?0 p* j
) o u5 d" u4 Z3 T$ J, c |
|