|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 G8 X+ A6 s, O# n' t
- [code]EDMA sample test application) i' J* b2 V) u$ L
- /*0 l) {: a& T, D, [/ d
- * edma_test.c( p; Y+ i9 A$ z3 k8 k" f
- *
# b: Y( _1 p% z - * brief EDMA3 Test Application
3 O3 O" u" H: _ - *
( z `8 q/ r Z% R - * This file contains EDMA3 Test code.
! @! {0 _* V" V. k - *
N* r9 K( u( Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 `( [3 i% [2 x1 u2 Z L# c& ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 Z2 C ~) o3 e9 R& o
- * TO CHANGE.; p7 o/ r6 m" U3 s2 q
- *
V; `# Q2 D- A* ]4 s+ { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 x! l- m$ P; D( E& u
- *
% ]: J$ u1 _% D - * This program is free software; you can redistribute it and/or
. @& F. R; f o - * modify it under the terms of the GNU General Public License as
* ]2 P" g& ?( g- n. @# b - * published by the Free Software Foundation version 2.
: _8 q7 A: h; z( H) Z+ A6 H - *+ d- v) i2 l1 Y" }3 R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 U% N/ a/ M+ I3 @5 k7 d
- * kind, whether express or implied; without even the implied warranty
% R2 W3 y/ X/ Z* f/ ~' p I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. w n* `6 R/ f, e' a - * GNU General Public License for more details.6 g9 d0 e) Y0 H; J4 w% w% f( m
- */
2 T' J. ]% S8 }+ l+ G
* D# [4 M' T& v! W$ W5 [/ s- #include <linux/module.h>
& p' C9 `6 V* @% I W - #include <linux/init.h>
+ [8 O! i6 g" K( @ - #include <linux/errno.h>
. f1 |: ^3 O& N Q3 E- M - #include <linux/types.h>
% K! F9 h4 i2 U4 { - #include <linux/interrupt.h>
0 U4 W: L% R8 [8 M - #include <asm/io.h>
6 e7 R) |+ K# P+ R/ D! a) N9 w - #include <linux/moduleparam.h>
: P9 C5 V2 R( p - #include <linux/sysctl.h>; [6 X# U; S4 x- {" [7 ~
- #include <linux/mm.h>) E% b9 g/ D7 K' e: ], M
- #include <linux/dma-mapping.h>
1 R. u! V3 I. S
$ |6 i; f8 c( Z. L/ C5 b8 O- #include <mach/memory.h>
/ X- K3 z1 K0 w* m- a9 G+ z4 t - #include <mach/hardware.h>6 l2 c0 G3 e8 i8 T* B5 Z- x s+ d
- #include <mach/irqs.h>! y& Z" ?6 Q+ K$ u5 a' Z s1 `
- #include <asm/hardware/edma.h>
6 j- x' a) s s5 F) q( r/ }
! n5 Y( _1 Q1 x- #undef EDMA3_DEBUG
9 M, p& D" A8 F D - /*#define EDMA3_DEBUG*// w, d1 @$ H9 K
/ _5 }/ Z& z9 v$ r' a8 R' I- l- #ifdef EDMA3_DEBUG2 `' G, s: [4 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 P( q2 ?; D( S$ c3 k2 I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& Z' O$ g2 N0 z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), z7 T/ X3 \/ Z' ^
- #else& Y$ b ?- m% m# ^! a
- #define DMA_PRINTK( x... )! m& p7 c. R9 R7 b
- #define DMA_FN_IN& Y/ ~- \( ~$ E' X$ b" |
- #define DMA_FN_OUT' ]) I1 e# n2 L( G( {4 B+ h
- #endif4 I2 `* R3 Z- a! z, C. W
% ^& A- g: X# c2 G8 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 u2 i+ F" ?: _) F/ i - #define STATIC_SHIFT 3) X. x- v- H) e; C! h% v
- #define TCINTEN_SHIFT 202 a W. Z: O6 S8 M
- #define ITCINTEN_SHIFT 21
1 r2 z) l7 a0 Q: N5 m - #define TCCHEN_SHIFT 22
1 c* r) m5 T q% z7 w, L - #define ITCCHEN_SHIFT 23
4 @% S1 ]0 z m2 K1 Q( h9 s - 6 ~" U7 h" m) ?% ?6 W
- static volatile int irqraised1 = 0;
4 F2 z4 J/ G. h! X# |$ o - static volatile int irqraised2 = 0;
5 h& X3 Q- J( {8 y7 ] - 6 l( V7 [- |4 v, B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ P7 ` p _. W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ?# X& |' ~. \+ p0 d; A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 m& g& D, f) z+ c+ A
0 B! X: ~& D& U. f8 i: \6 Y6 Y. g- dma_addr_t dmaphyssrc1 = 0;
9 F- Z& I6 x' | - dma_addr_t dmaphyssrc2 = 0;; U- \) H' G: Z( n
- dma_addr_t dmaphysdest1 = 0;( Y- Q. G! b5 W( g& g
- dma_addr_t dmaphysdest2 = 0;3 Z" y0 M+ B9 |0 J4 R2 Q
- : x3 ?' u7 i }: O( Q$ J0 x; F7 `
- char *dmabufsrc1 = NULL;9 q9 O' J2 M: O
- char *dmabufsrc2 = NULL;
# z" |* _ v2 V: v! ~" `5 H - char *dmabufdest1 = NULL;
+ \# ^( W1 c7 q# R1 [, M - char *dmabufdest2 = NULL; H) a" N" e" M* Q
+ E. A: ]) R( ?- static int acnt = 512;$ v* p4 z' v8 i
- static int bcnt = 8;* z4 \. |3 y& m0 ^' v* \; i6 i& Z7 j0 S- D
- static int ccnt = 8;7 U( P# r5 {0 n: q
$ \, }( m) Z1 b" X$ a. K; X- module_param(acnt, int, S_IRUGO);% Y6 O8 v3 c$ R+ p# d, N4 V g+ q
- module_param(bcnt, int, S_IRUGO);
/ M) X4 r7 x& E* n$ }- @ - module_param(ccnt, int, S_IRUGO);
复制代码 - v! N: u7 z6 q; W1 g6 _5 V
6 r T1 p" _4 v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; P4 V9 E# K9 i; h- p/ a# K7 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" m6 A7 }/ I% V5 n, R6 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# X& ^& r& a1 D5 G, i
8 [9 n, B* x% P$ y# F" @8 b: l7 H: @9 H# Y9 H ]6 |
|
|