|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 _: l4 o! C1 D( x
- [code]EDMA sample test application
6 s- D( N' b( c: ]4 Q. ~+ K3 L - /*
$ c: N; {) V* e6 _& W7 B4 U/ K: e - * edma_test.c1 l4 ~: a5 b! A% H
- *$ Y; M% p! `2 o7 M
- * brief EDMA3 Test Application
9 M6 C O) |; t4 b$ n - *
7 J) y- t! C7 {3 J; F - * This file contains EDMA3 Test code." }9 \* p0 H8 b
- */ h0 v" D2 Q. r. L6 d: A/ t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 {: z0 E; j8 Z8 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; @8 F5 P4 f5 l& v, Y) n6 w - * TO CHANGE.& L ~1 z* x- S' ]
- *' H/ n0 j4 ~" l1 w/ ]& j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' |" Z( Z8 f3 T5 l1 R
- *
3 _; F7 H) b8 |4 ` - * This program is free software; you can redistribute it and/or+ G7 j+ j6 }3 x5 v
- * modify it under the terms of the GNU General Public License as x2 u G) g9 e2 o+ P, J
- * published by the Free Software Foundation version 2.
9 ^, e7 u. o3 n, j# {+ K - *
1 F+ c0 O0 e- O: |" n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ ~8 a4 L2 N3 c: D8 o9 z6 Y: \$ o - * kind, whether express or implied; without even the implied warranty, J. m7 D o; Q/ R( m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- V3 n9 r* D8 c4 q( d0 p
- * GNU General Public License for more details. E7 c: [* q# ~0 G& t5 ~
- */
N" ~2 U0 B; z5 d* |4 Y4 u! s
+ T* S+ L- O4 r8 I8 e ]- #include <linux/module.h>
! j& S9 ?7 K0 n' O) b1 [7 ]0 m2 w; r - #include <linux/init.h>4 u' N7 s; Z+ R" e1 _9 L/ Y
- #include <linux/errno.h>: ~6 p9 o U* i7 t
- #include <linux/types.h>, c( I _$ |0 L/ p
- #include <linux/interrupt.h>* Q' C8 b' s- |* t/ e: i, n! J& d
- #include <asm/io.h>$ j' G* ]) y5 `. I3 `
- #include <linux/moduleparam.h>
* B0 t v3 M1 y% R, H - #include <linux/sysctl.h>
. `' }- u- L6 a+ m1 V( Z' b: o - #include <linux/mm.h>- K' U9 R8 F: `6 q% p
- #include <linux/dma-mapping.h>
# i0 \4 M7 M5 i* v" R
$ n7 C1 A' d0 J9 M! z- #include <mach/memory.h>2 X2 Z8 }0 ~4 ?5 i5 X1 q. V# Q* { h
- #include <mach/hardware.h>( y$ n+ a- l5 S" ]! g6 `
- #include <mach/irqs.h>7 a& ?, Z- f( L# z* `5 j8 h" C$ T
- #include <asm/hardware/edma.h>, s7 p& v! B) W! V
; h+ Z( t, I* a; O9 Z0 K p H- #undef EDMA3_DEBUG8 s1 L$ X! e; w) x/ Z5 E) i9 M2 j
- /*#define EDMA3_DEBUG*/
u2 E* Y9 Z! T - ( c0 X2 E1 J6 r# X. c/ R) R; e
- #ifdef EDMA3_DEBUG4 `4 S4 W' e4 z4 `1 l% H g; X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ F/ [0 S0 S; i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 S5 O) k- S* V o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 M/ x0 r! ^! h5 {4 O- p& t' p3 _ - #else
' H% T9 W: z9 L0 J { - #define DMA_PRINTK( x... )
' C7 E6 a- p# E8 m) Y5 H - #define DMA_FN_IN) o5 G+ ]5 }* J/ Q% R" c
- #define DMA_FN_OUT
. G0 L7 @% g2 f+ r, {5 J b - #endif
4 ]8 w8 s; y/ d- f, j1 p
5 h* o- K! P8 g; H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ j3 w3 Y8 \6 t - #define STATIC_SHIFT 37 N5 |& G @0 o" f: R; S
- #define TCINTEN_SHIFT 20) k$ m. a& o: n% T% J; O
- #define ITCINTEN_SHIFT 21
4 ]! ` B v# [ - #define TCCHEN_SHIFT 22
5 @3 u. W) O2 V0 _+ } - #define ITCCHEN_SHIFT 23
4 j, @9 D5 @7 n9 E" M0 J( ]- V
$ L2 U/ `2 _) e& Z- static volatile int irqraised1 = 0;6 R9 O" u: u$ ?1 D. Y
- static volatile int irqraised2 = 0;
2 f& B6 f( s' ?( l3 H
& W' F; a8 G' E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! z3 R6 G. S/ E O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 G& r" u, Y& E; |2 `* z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& B, a9 u9 J, ? |
8 k4 B4 |3 Z3 ?9 x0 v1 I9 o# Z- dma_addr_t dmaphyssrc1 = 0;
7 g9 K' e, y4 V! C# } - dma_addr_t dmaphyssrc2 = 0;5 x* i; B! M& U
- dma_addr_t dmaphysdest1 = 0;
$ N/ {; j6 s' D H. ~0 { - dma_addr_t dmaphysdest2 = 0;
1 i* [7 |5 I$ s" N4 e5 T& E
6 `6 D% U5 `6 f$ e5 Y- char *dmabufsrc1 = NULL;$ C' ]2 w2 o4 u" t/ \6 s6 p2 a
- char *dmabufsrc2 = NULL;
' \6 v4 r4 R5 O% a S7 S( i7 p( F! @ - char *dmabufdest1 = NULL;! A0 V' }4 x' N: v$ K
- char *dmabufdest2 = NULL;% P D1 m# A* K3 q$ ^4 C$ m9 ^( N
- % k/ |8 C4 r/ ^* u! w/ H d4 Z
- static int acnt = 512;* ]9 P& J0 t C C- ^( B$ X: L
- static int bcnt = 8;0 m7 d3 n' f7 z2 w9 V4 \! g7 d" e5 _
- static int ccnt = 8;
- v& B4 `6 E0 k& ]3 q9 I
$ h; G' a; ^# A- module_param(acnt, int, S_IRUGO);2 y2 E b' a1 W5 m6 v
- module_param(bcnt, int, S_IRUGO);
4 ~2 ]. o( b- j7 r - module_param(ccnt, int, S_IRUGO);
复制代码 : p. O% L/ v' j, [( g/ h8 f
8 Z4 [9 Y' D6 z# `- } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* K2 ]/ X; s$ ]( \( r- Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) m, t$ }4 F, s4 Q6 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* }$ Y9 v' ^' [4 t1 ]7 j4 n. o' P& g( d$ |3 ?
5 T1 s! Y3 x- m' {$ S
|
|