|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 H+ n3 [6 y; z+ f, E% s7 `
- [code]EDMA sample test application) u" F) X2 R" x# w3 I
- /*
# q3 X& C B! d2 e - * edma_test.c0 y4 t# t0 f7 r3 o% Z' @
- *
6 G5 _5 o3 ^ {2 @1 ] - * brief EDMA3 Test Application
! l- {; {0 y7 u5 | - *
+ v% i+ W3 g$ n) M: A& O - * This file contains EDMA3 Test code.
; X4 B) V8 N e6 A. M - *
/ u( p) l- M& B4 ]. k7 N9 H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. K. N- ]! ]3 f! T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# W6 F i: S5 Q9 F
- * TO CHANGE.' [ {6 ^4 N% i' H! A/ [. n
- *3 Z s$ c7 l: j( W" S1 |. {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* _8 M% g, n8 |, p7 _ - *
. V/ T6 R, M5 `6 } - * This program is free software; you can redistribute it and/or+ |1 k3 }0 `+ |: p
- * modify it under the terms of the GNU General Public License as
1 \4 a+ n% C+ Y2 H, E- c - * published by the Free Software Foundation version 2./ _9 O) r* X+ o R$ |+ T# K
- *
+ f- f9 n! c% s, C0 b- e ?. f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 z" K5 `5 x2 u7 U4 g - * kind, whether express or implied; without even the implied warranty3 w) V' d; ]+ E8 v# `# ^4 m" n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 m* P# [: F, g4 g& _5 Y$ | - * GNU General Public License for more details.5 p# f c$ m ]! @8 C' J3 W$ y
- */
* M6 U! ~' \% h3 o8 J% S
1 T3 E5 d( M: M- #include <linux/module.h>
; I" I; i6 L) `4 s$ N1 B - #include <linux/init.h>/ ?& `# [) s5 W {5 ?
- #include <linux/errno.h>
% H) l5 W7 D. j - #include <linux/types.h>
# S' ?0 X/ d3 H) ?! z - #include <linux/interrupt.h>
' @, i |9 v9 ?+ u2 s - #include <asm/io.h>* R! k: E3 M. E) n4 T- f
- #include <linux/moduleparam.h>
& t- _2 H C9 J; | - #include <linux/sysctl.h>
1 P8 i/ B; v7 m$ k* C' i - #include <linux/mm.h>
- ]8 p/ u- [ X8 T& w - #include <linux/dma-mapping.h>
# r9 A4 J* A4 Q, O, @/ p$ j - 7 }0 w l: U0 |5 |4 Q7 M/ w: ]
- #include <mach/memory.h>! Q+ ^5 w# \8 O) H. n4 t9 O
- #include <mach/hardware.h>
W9 C% q: B/ a - #include <mach/irqs.h>
d2 w8 k% w+ a& E3 U' M. p( p - #include <asm/hardware/edma.h>
, q. V( h$ i$ L. h - ( A" ]3 F( x' Q% l
- #undef EDMA3_DEBUG7 E8 a2 [& g) ]
- /*#define EDMA3_DEBUG*/
! e8 n1 l0 O, k8 _# U5 y) A - " A" X$ v! r" m( P2 A. P" W
- #ifdef EDMA3_DEBUG
! q G7 {8 V* r' ~: X; V& v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); r4 Y% \) Q" @9 d. `8 H) T& S# R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* O6 [7 c: p% r& u2 }6 @6 d1 e2 n( t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! d8 y4 i# a! q! g( v8 d. }) Z) U
- #else
X& B9 h. j0 G N8 F5 d) _ - #define DMA_PRINTK( x... )
- i' @3 P, ]; A* \ - #define DMA_FN_IN
- ]% E) N7 W; ]! m - #define DMA_FN_OUT& I* \( Z% }; \ u J# O
- #endif. g" j4 l: {* J
- % |# Z* Z. f8 |5 K% c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% j8 T7 z: l& G: b' B' r - #define STATIC_SHIFT 3: \; B' ~1 n& {4 \: j4 B) h) `
- #define TCINTEN_SHIFT 20. S. B" n6 R# m& I* \5 T
- #define ITCINTEN_SHIFT 21
& Z$ \" x. ~) [- g/ U1 h - #define TCCHEN_SHIFT 22
& F4 \7 V2 \, ~ - #define ITCCHEN_SHIFT 23
* q# a8 T$ ^' k0 _- Y; s0 ] - 3 R! V) M9 {' h* m! C* G2 K* N
- static volatile int irqraised1 = 0;* G1 S* e' D9 n$ H+ J3 H
- static volatile int irqraised2 = 0;
4 I' E; v9 m. B - 5 {; A+ @, j, q& \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ F) E3 I' L! H: B6 S: B# ]3 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Y, B# B* [# x) a) G+ T. Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* |8 b$ T; Y$ \, _% E
9 c( `! R' Z% A8 Q2 b& _- dma_addr_t dmaphyssrc1 = 0;7 i2 ~3 e7 y( p4 K
- dma_addr_t dmaphyssrc2 = 0;, i# u% u% Z+ b! D6 [/ Z2 C
- dma_addr_t dmaphysdest1 = 0;0 N2 f* o. f) t, G+ G# t; D3 z6 l" z3 P
- dma_addr_t dmaphysdest2 = 0;
4 h% H. R1 n4 K. ?4 U- E5 m - - z9 @! J* z" D1 A; u7 m1 k
- char *dmabufsrc1 = NULL;/ _3 x0 H6 i4 w0 l5 {
- char *dmabufsrc2 = NULL;; O" X& p1 }7 @9 H- ^2 @" V
- char *dmabufdest1 = NULL;( s* q8 {0 _- m$ ]
- char *dmabufdest2 = NULL;
& Y0 U" W3 Y( o+ Z4 \; }0 a) v8 \ - : \/ e2 G5 O5 A0 K" ]' ]+ M
- static int acnt = 512;
- e( F: _2 @- j - static int bcnt = 8;
/ `6 g- v' h. _ - static int ccnt = 8;
5 Z* P1 t. B; J; `
( u' k3 {' x% m. O- module_param(acnt, int, S_IRUGO);
; p6 y( J6 h: `" G2 H3 r - module_param(bcnt, int, S_IRUGO);
6 D% K3 j" }0 X- ^; `( v' I9 J) k3 E - module_param(ccnt, int, S_IRUGO);
复制代码 7 ]$ D6 q& e: |
7 s5 @6 t+ u2 Q" y2 e, v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 N: R. [3 n; k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 r' U; m/ `# Q! H' r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 n% N4 k0 g; v$ T# n+ _
0 `) b" p! \. T Q! f8 w0 ?& v& k) l0 i% V2 ]2 ] L6 P
|
|