|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* N7 S0 A$ I% g/ F/ j1 N- [code]EDMA sample test application/ A- G! s; p8 Q( _
- /*3 \* C8 Q z4 H6 s
- * edma_test.c: e9 T; |% O& c) `
- *
( Q) O" F/ |: ], D/ q - * brief EDMA3 Test Application0 I" T, f% ]3 @2 r7 g# n5 I
- *
6 A S) h' P3 Z: n - * This file contains EDMA3 Test code.
) G( _: m1 i! T1 `( z# O - *! I- u0 i& f8 q$ V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; F# `* A0 W1 N/ |; H Y/ Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' u. b2 J/ M S2 U' @9 x - * TO CHANGE.# `; l4 ^; t# _& _
- *
; ]0 c; o% T7 [6 B; C" K2 w1 {( L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 [; F2 j7 B' b) {7 [# Q% r
- *; f5 u' ^8 C ^! s
- * This program is free software; you can redistribute it and/or2 Z2 N$ I& O4 i) K% J
- * modify it under the terms of the GNU General Public License as
$ T. Q+ X6 O1 d9 Y8 r3 ~8 S - * published by the Free Software Foundation version 2.
1 G% x0 q+ w' U1 {0 { - *
/ E; T! M' U- G% u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 _7 @, u! ^5 \1 n, W" B
- * kind, whether express or implied; without even the implied warranty5 p9 P6 L" u, x9 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( g' K5 p, ^8 \' v$ v - * GNU General Public License for more details.
& H! R. v# a+ z - */
/ i% p4 O+ L2 z7 ?' p9 V - 9 k' e+ o5 B& z* d
- #include <linux/module.h>
4 {9 `9 s" E7 W( d0 m - #include <linux/init.h>2 M& V3 A* j2 z* }7 J: o
- #include <linux/errno.h>
/ K8 ?" k% b: U - #include <linux/types.h>9 z" s9 H( k z$ M
- #include <linux/interrupt.h>6 ?8 Q; R: n6 K- z
- #include <asm/io.h>
7 k) A4 t8 P$ C Q* @0 s) q- {1 g6 S - #include <linux/moduleparam.h>
# A7 U; i; `# { - #include <linux/sysctl.h>
+ t8 q$ C. j+ G - #include <linux/mm.h>
3 {7 ^* ~' D) J& t - #include <linux/dma-mapping.h>
; D( L0 o- @4 v
) W$ g+ J+ A( H, T- #include <mach/memory.h>
q. _& q4 j* ^' f' I6 n0 u+ T - #include <mach/hardware.h>1 H. k( E7 @/ l& q( L, s" H# B
- #include <mach/irqs.h>- y3 y# @. [* h/ V- n
- #include <asm/hardware/edma.h>
3 i. d' F& W. E8 A6 ~ - , o: T; c' d7 d6 U
- #undef EDMA3_DEBUG
; L8 ]. ?3 S& \6 J8 O! @2 u - /*#define EDMA3_DEBUG*/( d# Q' C8 ]$ Q
0 P7 E: ~6 U4 y# h" R( C- #ifdef EDMA3_DEBUG
' T' F; S# j L* H. A) j/ W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), Z6 o, [( {- s3 p: l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 H) O+ Q: u/ B) `7 e4 H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! b$ l+ e7 O5 K( G: Y- { - #else$ n0 A: D$ q4 e- m
- #define DMA_PRINTK( x... )
i7 v! q+ w2 l b: l - #define DMA_FN_IN! k5 [& Q4 m j) T$ U3 B& \# Z7 K
- #define DMA_FN_OUT
* v, ]* p/ x) o/ t& S - #endif
- b, M0 d- _2 d; E) m/ Y9 H4 t
$ D5 A! k$ R: z5 k1 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768); N" ]5 l* V5 M. ?" O+ J; F0 F" q1 K
- #define STATIC_SHIFT 3
, J- Z6 h& x5 r4 h - #define TCINTEN_SHIFT 20
$ Z" S2 D( M9 T6 X/ N1 d - #define ITCINTEN_SHIFT 21
% W! b% x/ o2 _$ J5 U - #define TCCHEN_SHIFT 22! ^7 Z, Y) c* X9 k% [" ^' a, L8 R5 k( N
- #define ITCCHEN_SHIFT 23" f! [2 H- V x& K" k- a
- ! T( Q: w: q! i3 I+ L. q) j
- static volatile int irqraised1 = 0;
9 W9 ^( f, r$ F+ Y, m$ B Y - static volatile int irqraised2 = 0;/ G# a6 T- Y+ Q1 N
" \+ F, q% S5 N; C4 Q3 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" j% l1 }. g7 O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- @3 I. m& a1 u+ J. O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- `+ ^0 _& p, f - - S% k6 h) U- X- @% k5 G
- dma_addr_t dmaphyssrc1 = 0;+ t( x" A! G& F1 c5 V6 w/ ?
- dma_addr_t dmaphyssrc2 = 0;
) ~2 h3 W: L1 Y0 n" J! P, ` - dma_addr_t dmaphysdest1 = 0;
5 |3 y0 f8 ~- x9 w - dma_addr_t dmaphysdest2 = 0;+ c. [" _) Y, I& V5 O( o# Y3 J4 W
- - j- `, }( q( z6 |
- char *dmabufsrc1 = NULL;
* G, z/ Y! Y- Q- Z0 c p - char *dmabufsrc2 = NULL;
6 F4 a* i: {6 u) c) k - char *dmabufdest1 = NULL;
- K" ]& m1 j/ }" }" I/ B( A' @ - char *dmabufdest2 = NULL;1 D4 V) k E! k
; @; A9 X9 ], B0 g- C- static int acnt = 512;
+ O7 z# @+ C5 j0 M' |6 d% L - static int bcnt = 8;6 j2 z' _2 } w# E- X
- static int ccnt = 8;
2 W" k+ C4 _; n' |7 I8 ], B
% i) K3 X* j, a( R4 F, s4 z- module_param(acnt, int, S_IRUGO); P( |- R& c; s$ Q7 |# _9 r6 W& P
- module_param(bcnt, int, S_IRUGO);1 E$ V. {8 m% [9 S- j
- module_param(ccnt, int, S_IRUGO);
复制代码 + e. V0 W" l ]4 e5 A8 E
8 \1 \+ b/ Q3 x7 T: d& Y3 `9 X7 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 F' t/ h4 B" B4 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( z4 s" V7 `# @! f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 |1 m0 Y$ t1 w L) r- X6 M0 a, a4 A% P) i( M [) H! T
6 m- s7 Y* ^, x2 k1 I) _/ g
|
|