|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / H6 H( ]5 W( Q3 g [
- [code]EDMA sample test application
6 W# W+ U s& T% l- G" V - /*! B+ x' L6 T# r4 ?" m9 D
- * edma_test.c; L: l: ~/ V& [3 K& A+ w
- *
) i+ G! f1 ]+ h - * brief EDMA3 Test Application( k8 X) k3 b1 F+ e' H; @. L
- *
+ o# v5 M O+ I8 Z% o( I5 g - * This file contains EDMA3 Test code.
6 F) I9 @9 s& @7 l0 G. ?6 B - *' L2 k! r5 B* L7 n- ^6 h( ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 G9 D! g2 T' W1 W. b8 S# K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ O, y& L" J, P! O" {
- * TO CHANGE.8 Z U" T Z Z/ f& T' F2 r
- *! ~5 S! ]) H, g2 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- k2 B& D4 t' J- H9 ^
- *- l+ U: S+ z$ T& w
- * This program is free software; you can redistribute it and/or
1 k% [/ c; O+ u* V! H, l! { - * modify it under the terms of the GNU General Public License as
- b% n+ u. g9 p! N7 T3 c - * published by the Free Software Foundation version 2.
K; j2 ~* I, |. V - *
6 A1 ?7 I6 s. N' r- C4 P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 N* v( t& ^ N6 A1 ] - * kind, whether express or implied; without even the implied warranty6 {5 P7 K9 j3 z) W6 G. [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! ]( k2 v1 T2 C0 p/ J
- * GNU General Public License for more details.% c' C& e& ?- k! f
- */8 h2 A# W7 t' I" e2 [, d( F2 F
. @+ D! D3 j( Z n l- #include <linux/module.h>& F6 S" @4 h; ?- O6 Y, ]2 B
- #include <linux/init.h>
( p+ z( n X& ]3 l8 D3 g0 e - #include <linux/errno.h>: f! T( y9 O* w# ~
- #include <linux/types.h>
3 }: r. I [9 C4 O4 z - #include <linux/interrupt.h>
/ y/ S& g/ B& m# A' A - #include <asm/io.h>
, P, u/ U: k- k - #include <linux/moduleparam.h>
, ~$ @5 P. l7 W- i9 y - #include <linux/sysctl.h>' o5 O, R2 Q. @7 ^; N8 W# F+ s( n
- #include <linux/mm.h>
1 y4 e, B& E& d& N! O: F6 Z( D9 l - #include <linux/dma-mapping.h>: V `* G! _, P7 r
" S. q5 M% f) L$ ?- #include <mach/memory.h>
R" M0 v) Z8 X. P3 p( k - #include <mach/hardware.h>
$ R5 F; @6 z( V0 O) K - #include <mach/irqs.h>$ i3 Z- [( \# n1 ?4 J I
- #include <asm/hardware/edma.h>$ D3 F: l3 K4 C% r, A! @& l7 K/ M
+ e& D# z2 t8 i: [- #undef EDMA3_DEBUG$ ~. K5 t% G6 ~7 w1 C- Y
- /*#define EDMA3_DEBUG*/
# p _, v; O+ \/ e: f( W0 ` - ' Y) ?, E3 x* a
- #ifdef EDMA3_DEBUG9 Z9 h5 l9 }9 ^$ n$ w- `4 h) a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) A( f+ I; F* W+ u9 K( }6 `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% d; c9 ~2 M0 O @! s# N- i9 x$ S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ^% N' g3 b( w2 @' _2 P/ B
- #else/ C1 ~2 Q% k# ^! E
- #define DMA_PRINTK( x... )
5 W3 [+ D9 b% p- v$ w$ S - #define DMA_FN_IN4 n: U7 A4 J# [7 @
- #define DMA_FN_OUT
& n3 E* }. N+ G' g2 @9 l6 F' ? - #endif
0 e" @/ j* U! B - 8 K' u" a, D; p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ i9 `8 X5 c7 Q2 H. d$ H3 V$ Y, i9 d - #define STATIC_SHIFT 3# ^1 j9 S x: x( t6 l
- #define TCINTEN_SHIFT 20% s' P% C9 J, U& ?, o
- #define ITCINTEN_SHIFT 21/ A: X0 o$ [3 U& e
- #define TCCHEN_SHIFT 224 A* s: k- U" [! X
- #define ITCCHEN_SHIFT 239 h$ O2 P6 l1 n: Z/ S/ a
- 3 {% s* t/ n/ Y/ W% o
- static volatile int irqraised1 = 0;
1 `5 q+ _ l0 b5 m' R ~ - static volatile int irqraised2 = 0;
7 @: i6 r! k, W( f, m& K( ? - 5 y% [3 k) U, {6 N4 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ~' L+ S m4 h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ a$ G0 N k8 x3 T; p/ q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 `' N0 x- f7 Q5 n% l3 S# n
) _; x( d r( z" p- dma_addr_t dmaphyssrc1 = 0;
5 m) N! C) T+ Z8 `3 B# G - dma_addr_t dmaphyssrc2 = 0;8 ~3 `6 }) \8 V! g* U# B# @
- dma_addr_t dmaphysdest1 = 0;: \0 G: f: v, _0 w7 A$ }
- dma_addr_t dmaphysdest2 = 0;) R3 `% j! v6 ^$ `$ f
- 1 K, j- ?' A& y- W
- char *dmabufsrc1 = NULL;+ A5 Y Z0 I% a8 F) {8 r1 N
- char *dmabufsrc2 = NULL;) o( ~& D4 |0 f
- char *dmabufdest1 = NULL;- e$ l4 ]4 r( G3 \- g
- char *dmabufdest2 = NULL;6 `% H2 u* c' I2 X
- - U- r. Q7 p4 A0 P0 t, {; @% l6 D
- static int acnt = 512;
. Q# @/ s6 j! Z" @% G u1 J - static int bcnt = 8;
) i. J I. L+ ~" S% z - static int ccnt = 8;, Q4 p" S7 s2 v# B; t3 S$ Y( u: Y2 r
- * R, u1 o, m& l. R4 Q0 g
- module_param(acnt, int, S_IRUGO);# v, {# L# ~9 ?
- module_param(bcnt, int, S_IRUGO);4 l4 ?% O/ \* F, z$ X: m! |
- module_param(ccnt, int, S_IRUGO);
复制代码 , `0 e0 v. X; \/ E$ |! ^3 a+ ]5 m
: Z1 X3 G$ s* e: G1 ~; Q9 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ L! o* }1 a9 E# H9 r+ Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 p8 m) q5 d% {* L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* z/ D) w, @) }, n# v* L x
5 [, f3 G; J' b) S4 g, L
1 v; W, |' d$ c! N
|
|