|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " B* `" p4 N/ l& P6 y
- [code]EDMA sample test application }( G6 ]2 ?: F
- /*! R; i$ T+ f& ?. F
- * edma_test.c* A; r# ? m( Z
- *
+ k' W0 A2 s6 A5 n) q# S6 V - * brief EDMA3 Test Application6 \. j9 d- Q) [/ f; K+ y9 G; O
- *6 b" p& g! U' Q
- * This file contains EDMA3 Test code.
4 D' Q. F% s0 [) z) d! r! D - *0 |+ h, y8 r! Z! A+ P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# k$ `& S3 w0 e9 Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( t8 e4 X Z! ^4 U/ ? - * TO CHANGE.
1 W; Q+ l/ Y* i* v - *
# ?1 W9 e4 {# \- p# [3 n2 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 f$ _' a& j+ U' |. a* r - *
# A+ _: t9 W+ `# X7 _* W - * This program is free software; you can redistribute it and/or6 k4 E, w& I+ H
- * modify it under the terms of the GNU General Public License as: m7 B7 l% p7 c) O( `% [
- * published by the Free Software Foundation version 2.
7 Q5 w8 t# P3 q. Y7 _" N - *3 n$ e* U8 S( J5 n' C$ W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& p" J9 v" M/ [$ ^' c* Y0 [4 _! F- R9 | - * kind, whether express or implied; without even the implied warranty) I& ^ b9 [ i- O; E7 j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; K( m) v; n' U$ y& s# o
- * GNU General Public License for more details.- f) c3 W5 `( V7 y
- */
0 E( ]/ T0 Z7 } X" B - 1 g. U: x' H- \
- #include <linux/module.h>+ X6 v+ [( ]/ l3 `8 z8 w
- #include <linux/init.h>* n C7 Z5 y! ?; t, |3 ?( i. ~
- #include <linux/errno.h>% H3 Y# r+ }, o1 U$ _) ?% M( f
- #include <linux/types.h>
4 B# R$ V8 S: b' _& X$ P - #include <linux/interrupt.h>. M: e6 G o m: r+ I4 F
- #include <asm/io.h>
" l [) a6 P z/ K0 l3 m3 D3 U O - #include <linux/moduleparam.h>* S' }$ K% F! h, @) T7 X* j
- #include <linux/sysctl.h>
7 S/ @2 Z( C+ v/ ~2 B - #include <linux/mm.h>
+ d' E1 E, F% M" a9 ` - #include <linux/dma-mapping.h>
# h: T3 v+ R B q4 G - 4 |; G Z# j6 {
- #include <mach/memory.h>
" P# I* t! M+ h* |) L0 s* { - #include <mach/hardware.h>
) y' K, n8 {8 ~ ]( Q - #include <mach/irqs.h>; _' h. M! g& H7 M1 \% Q! F2 m
- #include <asm/hardware/edma.h>6 [6 q& z1 m* y3 `( I$ I" W
- ( \/ N! B+ n5 ?7 m; F% H
- #undef EDMA3_DEBUG! T9 y) L) E/ f* J2 ?( x
- /*#define EDMA3_DEBUG*/5 @" `+ ~3 Q; A
- & N' W) W/ C/ g$ T
- #ifdef EDMA3_DEBUG+ c& O! r5 \) T, u9 p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- M4 o: F' Z" C0 t0 l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' Q; K( o7 q; \. x5 W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" I9 [* m% w3 d, d Y/ E& b - #else$ {1 D$ N! e* F [6 t1 h2 g5 W$ V
- #define DMA_PRINTK( x... )
1 J6 H8 A+ n4 c4 d - #define DMA_FN_IN8 e* }" ?- R" [# \6 ^3 d, v
- #define DMA_FN_OUT6 ~9 p2 ^2 w* c% G
- #endif: A* E* x7 }$ N
: O; s' `8 n0 e, _2 k9 P5 N- T- Z; s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% W% i& ]2 a! Z+ I' R - #define STATIC_SHIFT 3$ l, w; O' ]% m' R2 e2 u
- #define TCINTEN_SHIFT 20
; _. s6 n) p- u+ C, O3 j* x - #define ITCINTEN_SHIFT 21- d' m4 h( F/ \& H3 r2 _$ M
- #define TCCHEN_SHIFT 22
; l9 a: {8 q. |0 k. \+ f; ]2 L - #define ITCCHEN_SHIFT 23
) E" S" ?; g# |
% O) u7 e$ C, [$ ?3 f9 @$ Q- static volatile int irqraised1 = 0;, r- @9 P" X! Q" q
- static volatile int irqraised2 = 0;
' c c a: l( r7 A! P# t: {
' C8 R3 w/ _& G6 r2 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- s' v! o' \' F8 F0 i) l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 h, d A5 u% r( h( k o& J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 u+ h0 W8 K2 T5 n' c2 H1 d. j. `
) M N: {+ }! k. q' @4 F- dma_addr_t dmaphyssrc1 = 0;
2 O* A( s' ?+ p2 y2 p! F - dma_addr_t dmaphyssrc2 = 0;* i: W& H, v! T
- dma_addr_t dmaphysdest1 = 0;; n) }4 t3 l9 j4 S9 t
- dma_addr_t dmaphysdest2 = 0;6 p( \7 x+ @- k8 g! G
- % R1 @% n6 \0 Q/ E' f
- char *dmabufsrc1 = NULL;
$ P6 L# T v5 F' d - char *dmabufsrc2 = NULL;
) n9 d! h; t' c3 T - char *dmabufdest1 = NULL;
. L4 P0 O! \- W! x0 f - char *dmabufdest2 = NULL;, n/ L* c4 N/ V
! i9 u3 D* [, `7 ^- static int acnt = 512;; ^- D3 g) x2 ~' Y5 y
- static int bcnt = 8;+ J! ~3 q3 B3 Y, y$ s. [
- static int ccnt = 8;
! D/ F7 i) u0 _ - ( s5 q# w/ X+ b3 S: U
- module_param(acnt, int, S_IRUGO);- c3 M7 V" I9 F0 @! j; T+ m
- module_param(bcnt, int, S_IRUGO); n/ e9 Z9 t% l& E5 i
- module_param(ccnt, int, S_IRUGO);
复制代码 ! I& D6 q/ Z% \
9 Y# F0 E( X% U j0 V' N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' T& X- h! e# e/ j8 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 W% S# O& L f7 }3 j0 o% M0 l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ~$ Q1 d" M0 I* ~
" q7 A. @- @+ Z' t( x
4 B/ n L- K, w+ S/ w |
|