|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, R; z6 \3 O9 L* M1 O- [code]EDMA sample test application
6 l) n$ w1 _8 G; N2 L! B$ \ - /*. h, [& }7 z" R5 k: m
- * edma_test.c1 o* f# x! o2 j( ^ d3 ?
- *
% N- j" d1 q: ]- O - * brief EDMA3 Test Application6 T' \: Q/ J7 N6 W& F
- *& c6 Y( k2 s9 a4 J# S9 }; }. a
- * This file contains EDMA3 Test code.7 @/ D' U |4 h9 j6 ^( d, A
- *
* m9 y1 z% G3 t: t" b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ J( F6 y" C8 s/ ^, d) s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 G* |. f: ?) K( Z - * TO CHANGE.. q: d5 t3 N& p
- *
6 x6 N9 c4 t0 a% N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 q+ c7 `9 V, S8 B z b9 a6 Z0 p - *
: L9 H' r7 Y9 B- k: u - * This program is free software; you can redistribute it and/or3 }/ U( k1 B2 }, a$ }* E7 w* u% w
- * modify it under the terms of the GNU General Public License as
: ^7 ~6 M( W; C& j - * published by the Free Software Foundation version 2.
B |) a" R. L( b - *
5 ^. A; ?1 d* I: D& c' a( t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, Y5 V8 h0 _ \) `5 F! j! ` - * kind, whether express or implied; without even the implied warranty
; ^& C/ S8 J* g0 @+ L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" {4 J0 k" N9 m; X9 H - * GNU General Public License for more details.( m& t& Q; u# x, M
- */
# b/ r5 o3 m( @8 C/ a6 n2 K0 o, W
% s e$ f& G+ D$ q1 b$ q2 d- #include <linux/module.h>
" T* l. z: l9 B* q - #include <linux/init.h>
* @" d! F2 C& @; J: V& O6 f - #include <linux/errno.h>! N' \" u. D/ L8 \, ?
- #include <linux/types.h>
) }9 L+ \. x1 A+ K: Z - #include <linux/interrupt.h>) q9 P% j1 [7 ~0 Y" D+ s
- #include <asm/io.h>' K' i+ w! d: ~- Q# {- ?1 G
- #include <linux/moduleparam.h>
n* J! V3 @7 n4 N: Q - #include <linux/sysctl.h>
& C$ [! M! Q9 P" \7 N0 J - #include <linux/mm.h>. {5 }+ Q* ?' r; j
- #include <linux/dma-mapping.h>
- Y5 d! ~# x( U: o& V# h8 R& L
4 [+ _" y' ~. j) Z3 I- #include <mach/memory.h>
i: }8 U* Q- ^ - #include <mach/hardware.h>
7 X! @( K1 ^6 s9 h- N - #include <mach/irqs.h>3 N4 l: P, ?# U1 P. ?6 r# n
- #include <asm/hardware/edma.h>% z1 c6 T4 `5 }0 Q
- / Y3 H5 U. F4 b& M
- #undef EDMA3_DEBUG
; a$ q5 B$ o- u3 c+ u; Q - /*#define EDMA3_DEBUG*/; \8 W* M$ z5 ]* `% e: I' p' L
- - [7 u! h' K9 U y+ f
- #ifdef EDMA3_DEBUG
6 v4 o3 Z/ v' f) M3 t* O) g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- e+ [8 {: l* C; e ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 G# C, Y) F+ ]0 l# Q( w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 j' j ^, z* l$ m - #else
) @5 g# x1 Z2 R - #define DMA_PRINTK( x... )* V- E4 C7 L6 T5 W4 r
- #define DMA_FN_IN1 J$ x7 X/ z: L! C) p2 y2 m1 t- B
- #define DMA_FN_OUT: z) k8 q+ D, i) h( B# B
- #endif
3 H! n% p8 w# G6 u& a
: l& z& `3 v$ V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# {* R5 Z; \4 ?/ [3 v6 J0 Y7 c( V
- #define STATIC_SHIFT 3
! c' Q0 o! B4 j - #define TCINTEN_SHIFT 20
0 q( O. W8 M1 c - #define ITCINTEN_SHIFT 219 Q2 T# [% b3 F& x
- #define TCCHEN_SHIFT 22# z) L/ `. s2 o" H1 e# m3 v( Q
- #define ITCCHEN_SHIFT 23
4 Z7 ]: Q/ X% T/ B5 z$ p - : U1 V- B8 [" h6 T
- static volatile int irqraised1 = 0;
& |/ _* ^7 [4 ?% P6 m, n5 v - static volatile int irqraised2 = 0;' v% B* j# D1 V2 {/ w
Q1 y: K7 A/ e1 ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z7 t2 h% u' y |9 u6 j" b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! u& M$ u7 q! B/ u% k9 x) B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ i y: H9 |7 W
0 Q- B0 r1 t2 f5 {# K6 e) s- dma_addr_t dmaphyssrc1 = 0;, E, B7 B( H2 D7 q- O! L/ D
- dma_addr_t dmaphyssrc2 = 0;
6 T) m' s T1 ~5 m2 k" B# K8 C - dma_addr_t dmaphysdest1 = 0;
" P$ a3 a) s* P7 x, x - dma_addr_t dmaphysdest2 = 0;$ r& E) M$ _) F; i7 f0 ?, `, W
- 3 C: F) ?! J/ `! D) \1 y4 K, }
- char *dmabufsrc1 = NULL;4 S. L3 `8 V9 Q, o7 c4 K+ s/ n
- char *dmabufsrc2 = NULL;
% }2 K9 t; p: ]* D2 q - char *dmabufdest1 = NULL;
$ Q% K1 }) O6 e* G! j* W3 o - char *dmabufdest2 = NULL;
+ @7 t3 n9 V7 V# B
( H$ _ @3 D6 B# J- static int acnt = 512;
. s4 o M4 {7 E+ U - static int bcnt = 8;
4 z4 g; p6 Y8 S6 i$ ^ - static int ccnt = 8;
/ c; n7 R) o& O - , D4 x }( c3 ^
- module_param(acnt, int, S_IRUGO);
4 l1 ~* @" I: ~8 k5 Y3 p) z. u - module_param(bcnt, int, S_IRUGO);
4 |2 V: g) T' q7 {1 o; {& r0 I - module_param(ccnt, int, S_IRUGO);
复制代码
: {9 H& m9 G! ^% n/ [- R1 a$ p3 e: M# Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 i y* q# y# h; b" V; d* R& _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' N; |* v$ c- n0 m4 d2 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# m' O; {1 G$ _* z" d" w+ y
5 g/ O0 p7 Z2 f0 Q' L. T) O! ?& B
( E2 y2 u" H9 z2 t. v' m9 n! w$ } |
|