|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 {9 h g- _7 A" z8 R6 `+ c- [code]EDMA sample test application# ^3 U: C& O- m% F
- /*
0 r* x+ v' J+ @3 D- z - * edma_test.c
4 r) }4 z O! a- ] - *9 u* d1 J( n6 T7 C6 v' M. m- N
- * brief EDMA3 Test Application6 U8 d3 h( b' P) x2 x* N Q& M5 o W
- *0 x& S* F& R# W2 o7 |
- * This file contains EDMA3 Test code.
" l# I/ O7 T+ l* l# {8 L* M% V* G - *
! r* X6 s( y/ v) B7 Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ I( x2 A k- g) L( h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' X- @3 W& F( N& U4 p - * TO CHANGE.
4 q/ I4 y! U9 [% a0 f - *
+ K: F N! ?1 Z; A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 e9 Z: X" P' a! j2 t
- *
+ J1 J# q8 T; P - * This program is free software; you can redistribute it and/or
! y' `" _9 W3 O+ f" G - * modify it under the terms of the GNU General Public License as& \6 _. x5 F1 N* h3 Z
- * published by the Free Software Foundation version 2.
U5 j7 C# Q" @6 I) e) w& V - *
- _- L6 |4 }5 I$ q( K/ x* D& x$ I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' Q( @$ v: S6 X2 e9 Z$ s6 G1 d - * kind, whether express or implied; without even the implied warranty
# Z8 s) }$ F. W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 \( a$ ~7 w3 q8 E. O' T
- * GNU General Public License for more details.9 ^, ^# {4 x2 p* q2 p% W
- */
- E& r& @' K! t) A! M# k" i1 t/ l* I
) q' u+ O: Y3 r/ c7 }# f% b- #include <linux/module.h>, w+ x7 H3 U3 L: c$ } t& h( f
- #include <linux/init.h>
, D6 D9 v6 b) r- L$ ^ - #include <linux/errno.h>
" O k8 g% i" Z. x - #include <linux/types.h> X9 ^+ W \, g4 A! s
- #include <linux/interrupt.h>6 L/ h5 U* o4 b% P7 ~
- #include <asm/io.h>
8 d k) x0 J" k T - #include <linux/moduleparam.h>' a) }" P: E q, Q, _
- #include <linux/sysctl.h>
: X" }& e1 b! Z3 Y8 ? - #include <linux/mm.h>
2 Z$ y1 |+ H3 y4 v/ j6 w - #include <linux/dma-mapping.h>+ F/ `- S9 x! s2 j' C8 {+ ?
- : t# _/ k- G$ S; B8 `" B$ @
- #include <mach/memory.h>
0 x; a2 H( m8 @! _ z& r - #include <mach/hardware.h>
1 s1 N$ e/ v7 e' _% A - #include <mach/irqs.h>
3 ]" }$ Q: u. o( \, R1 h - #include <asm/hardware/edma.h>" i3 B, u' _, _) ?
- h5 h+ K L% {/ Z! I, v
- #undef EDMA3_DEBUG
0 j4 w( I2 @4 o. H& o - /*#define EDMA3_DEBUG*/6 j' I0 ]' J6 n6 u
- ( F: M" K6 x# Q) m6 j& B/ h' g
- #ifdef EDMA3_DEBUG: v! d% W$ [5 V2 o# z. d3 Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# I2 c- ] p( w8 C7 J* x! {2 i2 `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ Z. H% a/ j1 W2 \, Q1 F- c. c0 a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 j% ~4 \; L& J0 v. R0 b: P
- #else! R- ?! m5 T' J
- #define DMA_PRINTK( x... )& S5 V1 z+ T2 w7 [7 A4 Y9 M
- #define DMA_FN_IN
+ P% m$ |; M6 \# c* r- { - #define DMA_FN_OUT7 ]0 S6 p# `8 _
- #endif$ z' B) K, U. ]$ e
; T1 Z7 B6 O+ b+ r* c* u! \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 R5 r8 U+ B9 k4 v - #define STATIC_SHIFT 3
" \. I8 G- r7 l+ X8 N0 r - #define TCINTEN_SHIFT 20# }% m5 M a" \; P$ H; {0 |
- #define ITCINTEN_SHIFT 21
7 b; Z( j% n, }) O5 O5 z8 W - #define TCCHEN_SHIFT 22
2 ^7 R2 ]9 I& q1 W5 ~' @ - #define ITCCHEN_SHIFT 23$ x" F, S/ \+ }$ A5 u" d. q6 g
$ W/ R+ l' U& h: N+ P) F; `5 ?& q- static volatile int irqraised1 = 0;4 ]6 _( F8 P: D
- static volatile int irqraised2 = 0;
) L6 Q5 H- L6 _: N2 [: T
& l s! P: g4 o# V9 A9 K0 b" q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 `5 X; c; R7 G2 {3 j3 S& a8 V. n0 ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 G% j. Q! [ M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 G) i1 o$ ?' V
: z& O1 B9 F* x0 V! l- dma_addr_t dmaphyssrc1 = 0;- \# H8 M: {& F: y
- dma_addr_t dmaphyssrc2 = 0;
: n. X8 Q% B B! k - dma_addr_t dmaphysdest1 = 0;
5 e2 c6 z( I7 L4 L9 h - dma_addr_t dmaphysdest2 = 0;+ x! M' P- n( k6 K. x1 ], t
- ; R- e6 w, ]2 ?- u! L/ A
- char *dmabufsrc1 = NULL;
* y/ }2 @- U* j$ P* l# S9 { - char *dmabufsrc2 = NULL;4 z. S, n9 k% W v. z O3 \: A
- char *dmabufdest1 = NULL;, O7 @0 }$ S) f" ?, C
- char *dmabufdest2 = NULL;. I! x0 H+ g' n1 F9 p
/ Q0 s X' T8 K) b2 L) [5 [) D- static int acnt = 512;
7 M; _8 Z' d/ |5 g' j/ t. y! H5 e - static int bcnt = 8;
6 G% |/ s4 o+ e# O" W9 Z0 ?, f - static int ccnt = 8;
8 V5 c5 v v) e( {: [# v& } - ! h& Y/ @: g" U; m/ y! o; i4 I( f7 P7 j! ~
- module_param(acnt, int, S_IRUGO);
9 L" x7 t3 A7 _& ` - module_param(bcnt, int, S_IRUGO);
9 D$ p6 Y# m) m( I% `% S - module_param(ccnt, int, S_IRUGO);
复制代码 # t' O2 w6 ?" P
1 l+ h U; Y/ d1 Z5 E4 n" J2 F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( c7 A8 W3 f! K/ p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 V, C L. ?2 e5 L5 F1 E4 a9 b: l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' O7 y3 W( ~0 A% y. ` h; K
" @0 \5 c2 ~5 F- r4 i6 @2 P" [# t5 E7 s3 \+ b8 m
|
|