|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( }: k4 ?* J+ s3 p/ h B' I! \- [code]EDMA sample test application5 e' d$ b. _! n( X: L) T
- /*$ m; t3 j0 f( L
- * edma_test.c8 N9 n% K8 ^4 N" J' {
- *
$ u2 w$ v/ C6 C4 e8 i- b& F - * brief EDMA3 Test Application) J$ X M: h3 E6 S' D
- *2 m. I' C7 f5 _- |
- * This file contains EDMA3 Test code.
0 x3 y2 { l( | - *
) P8 L- m5 U0 f/ p5 P! p6 e) }6 C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# h; J: U5 b5 d3 D& m4 @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# l& Y6 a6 o, @5 ]- s5 s: _ - * TO CHANGE.
% r; ?3 c- l" ~! r: [ - *! c7 H+ W+ f8 m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) W4 }, o/ A, }' L8 n, F: L5 Z4 a
- *! S0 o9 Q8 K. G5 f
- * This program is free software; you can redistribute it and/or& e( o% k& _. P" R) u) v/ U
- * modify it under the terms of the GNU General Public License as( M# A3 a3 {% I C- _9 K* w
- * published by the Free Software Foundation version 2.
9 O* T$ a2 D" d G$ ^5 E - *
3 {" |4 {; J2 A" N& S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ L+ L& x/ d9 \" G5 o
- * kind, whether express or implied; without even the implied warranty5 h% E& P6 d3 x! V. r7 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ V# Z% q0 k1 \ - * GNU General Public License for more details.
/ _7 i/ q6 l4 f( V# b - */
9 D4 N) G: x) k8 j4 O0 t% k( U/ A - 6 J4 O1 E2 @! B1 R& j! ~
- #include <linux/module.h>
; K) `; c# y, r3 U/ n+ i% d - #include <linux/init.h>6 o+ M' S: z. z6 N5 m$ C
- #include <linux/errno.h>8 ?/ d* g$ a( R8 ~/ `+ v& y
- #include <linux/types.h>
5 a3 q# \! b7 z - #include <linux/interrupt.h>: x1 W5 t* a& R
- #include <asm/io.h>4 H* t) _2 u+ O2 s% t& h# v% U9 r
- #include <linux/moduleparam.h>
. u+ P6 T- v& L7 {0 y5 J" k% m, L - #include <linux/sysctl.h>
3 n- T+ [4 ?( c- l d! |% E - #include <linux/mm.h>7 e2 x0 N- x( s. `4 [* B
- #include <linux/dma-mapping.h>
0 q0 \1 u. N5 [% V - - @: R7 _9 B0 \; i- X' m
- #include <mach/memory.h>/ j$ @; q& ]/ C% ~: d6 Z
- #include <mach/hardware.h>
7 ]' t/ F6 u4 R8 l( g) \ - #include <mach/irqs.h>- ? V1 y4 \& P' D3 d4 ~
- #include <asm/hardware/edma.h>
7 ]" _3 C- b2 Q
( F# C0 n; U; Y/ |1 D% T- #undef EDMA3_DEBUG
( q! p8 _# C; t6 a! \- s - /*#define EDMA3_DEBUG*/
3 C( D( \1 R3 A" V' K! X! {; M
( W# \5 a' i, A9 L$ C" S- #ifdef EDMA3_DEBUG' R6 q" e6 g ~+ j1 n' n# s Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! Q7 c' m6 Q7 Q; u! t: ]( t0 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 `3 o% ~6 K1 Z3 j4 s" H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 o6 G' b3 s, X1 C; A/ U7 r - #else$ u8 Y4 w' u. a4 A6 e4 m1 S$ N
- #define DMA_PRINTK( x... )+ S+ |# v j. j8 P0 ~
- #define DMA_FN_IN0 A3 S; E9 [ K& M# C0 j: l
- #define DMA_FN_OUT
; _8 Z; N: H: |4 Y+ H: Y - #endif
, Y2 r0 Y! i" v3 F$ _( L - ( a6 O3 R6 w" H r$ G# j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# Q; F" I) ?6 u) Q - #define STATIC_SHIFT 3+ z3 o0 k2 k" l; j5 z+ ?
- #define TCINTEN_SHIFT 20
+ v3 ?6 H, k! u3 t% w2 l2 g/ h - #define ITCINTEN_SHIFT 211 |! L2 z+ O/ z3 O# }! ~3 a
- #define TCCHEN_SHIFT 22
- v u, K7 [1 Y, m - #define ITCCHEN_SHIFT 23
$ q* b0 l& ^: e( b9 w# g$ y
: D: D* F, `' m! n- static volatile int irqraised1 = 0;0 q+ ? B/ c6 m' {2 L% L( m- v
- static volatile int irqraised2 = 0;, f$ s* y1 m0 O% V+ r- I
- , T2 ^- }* ^) E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# \! Z5 I, [, L4 D& {: n% z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 g6 Q3 b* o( \) M; \. ~) v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M# S" ]8 d: Q& ~
7 y0 c7 H" f( s/ a2 v- dma_addr_t dmaphyssrc1 = 0;- m: P3 T0 f: d* l
- dma_addr_t dmaphyssrc2 = 0;
) u9 Q" K+ ^! }* m - dma_addr_t dmaphysdest1 = 0;5 w" p. b: L/ l
- dma_addr_t dmaphysdest2 = 0;
; s' X# {4 H/ W - % b' d" c- k, M+ W1 G
- char *dmabufsrc1 = NULL;
' D/ P" N1 c# }2 |& a6 X - char *dmabufsrc2 = NULL;
0 B( O8 D. g5 W8 H) O2 s. T' B" k - char *dmabufdest1 = NULL;/ E$ C, E1 A1 V1 c0 T ?7 U
- char *dmabufdest2 = NULL;" `% e$ M8 e3 X6 D( ]
- 1 c6 t' _- {/ k; b8 ~+ G
- static int acnt = 512;7 ^0 d6 h' a9 [6 @1 p
- static int bcnt = 8;! _# j& z7 n/ l9 A# J
- static int ccnt = 8;: L/ L& A0 Q6 y% m5 S* D& U
- o( P1 `' H: o7 }, Z- module_param(acnt, int, S_IRUGO);: e. y0 m, W" e; J" B7 ?* @1 r
- module_param(bcnt, int, S_IRUGO);
) s/ P e: S: Q1 K+ A h1 f - module_param(ccnt, int, S_IRUGO);
复制代码 , q7 Q6 t; y4 m' M1 l: n, l
: j4 _ R1 w9 d7 x6 O r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( Y1 J" h6 [0 n" a4 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ Z: ]8 {3 c! |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* B9 }3 e+ }" ^! `8 Z8 @! w8 L L) `1 [9 g/ ~9 f" K2 |
+ S/ m3 z( m! H ] |
|