|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & [$ z8 U& u3 v6 z
- [code]EDMA sample test application
1 _# e, c2 M" F2 p9 @ - /*
. W1 g5 a2 X' k0 } S - * edma_test.c
3 R8 ~; v+ D, K; I - *3 b- R+ I3 J1 m
- * brief EDMA3 Test Application3 w& }$ B; s- T' o% D
- */ [# Y- S5 ~4 x/ X
- * This file contains EDMA3 Test code.
, T( Z7 y) X& ~# D, T% {0 w' M. i( r - ** e) u6 X0 P2 w6 K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& F0 b& G2 a( [# ~+ o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ Q$ v, p$ N. ]" N - * TO CHANGE.% x$ x2 ]9 N2 _( `4 w2 \# P! {
- *
7 o2 w# M$ ^) K: F8 [* p7 X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 f2 l0 M+ i" ^0 Q6 u0 [* e
- *( [6 N. V. U" F+ I- E. {+ a
- * This program is free software; you can redistribute it and/or2 `5 x5 U1 O# i2 Q9 w
- * modify it under the terms of the GNU General Public License as
# @! ]. g6 V, Y8 b) ^5 J$ k - * published by the Free Software Foundation version 2.0 j& n. \/ ^* ~* x, ]+ T% b# O" a5 @0 H
- *) D5 E' V# X/ G+ w; i5 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& W. W& X: P6 i6 H) n9 Z2 w - * kind, whether express or implied; without even the implied warranty) t. l: |+ Z, Z a/ b2 y- V) C0 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ s. I) P3 A. @- f6 P \1 P2 L
- * GNU General Public License for more details.2 C5 x! Y& [& L2 H& b- H' ^
- */: ^! C/ O4 s2 `6 {' Y! S1 a' m% N7 _
$ M h: }5 r9 Q1 }' r9 Y0 Q' F2 g- #include <linux/module.h>
K6 y: Z2 w% h2 A; A2 ]/ b$ e - #include <linux/init.h>
% M/ o! B! @: N5 E - #include <linux/errno.h>
2 _3 ~5 N; e [ - #include <linux/types.h>0 a. s3 Z% I/ g- {
- #include <linux/interrupt.h>
2 B( E* H, u6 D( f5 x - #include <asm/io.h>: b4 @9 R: f/ Z0 E
- #include <linux/moduleparam.h>
* F$ _' [3 n) I6 a/ e3 h4 n - #include <linux/sysctl.h>
: J9 F2 W$ e; u) o( O+ V t - #include <linux/mm.h>2 h3 s+ M5 H7 u! p* w3 H/ d m
- #include <linux/dma-mapping.h>5 d0 B$ l: S9 @
- ; L) V, `3 q F& u
- #include <mach/memory.h>: |1 Z9 i8 D6 ~/ s$ T
- #include <mach/hardware.h>
. r; p! x8 x4 \; c - #include <mach/irqs.h>
& Y( E* {0 s) H5 n1 [4 C - #include <asm/hardware/edma.h> ?, c5 K2 @/ E
- 7 v' _9 ~4 s: C* N/ o6 W1 z5 A
- #undef EDMA3_DEBUG# G3 W b; e( F$ c, t; |
- /*#define EDMA3_DEBUG*/
# N- H3 k1 Y" \; k3 }& c0 G
) S2 a8 P8 _) p' T- #ifdef EDMA3_DEBUG. D+ @: t! D6 Y* I+ h' ]; y& W; X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 [7 J) r: l$ d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 C+ B5 z9 b% u- ~4 J) T* F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); N4 ]* P }% x8 S t. }+ D
- #else' F( V6 M$ y y
- #define DMA_PRINTK( x... )
" h$ q2 A( q, r T4 ? - #define DMA_FN_IN
1 Z/ |* v/ w8 l8 a w% k - #define DMA_FN_OUT
- R( x9 F2 X( B4 F - #endif; Q5 s1 p Q' h& ]* A
- * G4 @) n/ z1 g7 ?# H% x' {# M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# {. x: m4 x# p/ D* J - #define STATIC_SHIFT 34 W8 L! x" @& U1 p4 |, g/ i, H8 @" d
- #define TCINTEN_SHIFT 20% G F+ T! W& M4 |" c5 F
- #define ITCINTEN_SHIFT 21
+ @* v. `4 ~+ \# o - #define TCCHEN_SHIFT 22; ?6 @- N6 n8 m- e! i% l8 r7 P' g
- #define ITCCHEN_SHIFT 23/ d' s; D: A. \5 H6 n& d
- : g- N0 k, d7 s; {% O1 l
- static volatile int irqraised1 = 0;8 g& z! H4 k# y2 x
- static volatile int irqraised2 = 0;
/ v4 @- f" w* p2 T! C
# }$ t% l) y E. v; n; v0 R" j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; \- @" J# M0 \5 q5 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 e1 A \' X/ r0 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. [2 e6 h* L( O$ t: D3 s. K9 X - 9 ?5 q3 Q+ I. t# t
- dma_addr_t dmaphyssrc1 = 0;* o" A% }3 ]7 G4 \
- dma_addr_t dmaphyssrc2 = 0;' \! e! z; [3 _& y
- dma_addr_t dmaphysdest1 = 0;
+ h6 g2 i$ g3 a$ W# M; B4 V- F, k - dma_addr_t dmaphysdest2 = 0;
f. }6 J+ Q8 e/ f4 O/ n# ` - : O. c q" a. c) l8 V" l
- char *dmabufsrc1 = NULL;$ Z1 d8 r/ z7 e' q$ a
- char *dmabufsrc2 = NULL;, d( [7 {- h0 q/ I% Q3 V; U
- char *dmabufdest1 = NULL;. r% l# B* a2 q$ {5 n
- char *dmabufdest2 = NULL;& m, s U6 o' {" I8 l8 _* ?
2 z8 l- _* B' s( Z5 h" M4 v- static int acnt = 512;
# r) t9 [0 Z! k b ]( ` - static int bcnt = 8;7 v2 h9 ], A' G8 a( c
- static int ccnt = 8;
' C1 J: x( m. E9 m0 G - ' t2 I8 j- a5 |% j, |2 r7 v
- module_param(acnt, int, S_IRUGO);
& [8 _0 F( S, @" n8 B* D5 @ - module_param(bcnt, int, S_IRUGO);
, i. ]; I5 f4 o- Q6 o - module_param(ccnt, int, S_IRUGO);
复制代码 8 k# w! E& K" Z% H' e
( J. \6 g# a; E4 R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% P* x6 ]7 Y A( E1 _+ B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# W5 x; X4 b- W8 G d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 @" G) r- b5 q7 D8 f$ U( p
9 d6 h6 G1 C' V
& A( p0 i; j. Z
|
|