|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 n0 q& a6 y5 \! @8 B' B- [code]EDMA sample test application- w1 \; o' e$ r8 g9 }1 j/ h& R
- /*! Y" e! [+ b% ~7 s+ y8 v
- * edma_test.c! ?( R7 a% E& e- M7 T
- *+ G! H7 J: M. e% Z9 {
- * brief EDMA3 Test Application
1 r8 U2 e5 D8 E/ c7 b# \ - *0 r) ~$ E. h |% S5 o6 |1 e* A
- * This file contains EDMA3 Test code.
K( p% D+ q+ y V - *
! S* q( w8 P0 L- b1 n m. ]. x( {9 b( ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ b! b r" Z0 g) J8 r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' k1 n4 a) }1 g, g' J9 j2 S - * TO CHANGE.( C; V! z# l/ R# @7 v' {3 I3 y, n& S
- *
$ I, R+ Y4 x' P7 p$ l; r9 h) w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 z' E; W. U- t6 f* {
- *
3 O! ~ G" K# E4 o0 ~2 K8 P - * This program is free software; you can redistribute it and/or
], I4 Y, S6 _+ s. S) Q6 @! Q- O - * modify it under the terms of the GNU General Public License as5 ]- ~, I( p3 K6 i
- * published by the Free Software Foundation version 2.
w j6 { g4 I1 y8 x - *' Q+ g# w1 z8 D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; m* H: M, S+ E% X# K7 f3 z2 J - * kind, whether express or implied; without even the implied warranty
( S5 F9 C. R! o. W$ M' n2 K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 k3 p* R2 y3 R$ ^5 s$ Y - * GNU General Public License for more details.
4 b& O6 w* `+ @" S( ~ - */
# _9 F( l" T }1 |( D
2 n: M/ G( d K+ o4 P2 F- d; j- #include <linux/module.h>3 L; B$ v5 f# Z, M# z
- #include <linux/init.h>0 e! }" D% c% `( E! y
- #include <linux/errno.h>
5 b* W) p5 R! X - #include <linux/types.h>% n- ]* L4 F/ T
- #include <linux/interrupt.h># e4 g' W! Y% k6 A; h! ~
- #include <asm/io.h>7 ?0 Y6 i6 C. A
- #include <linux/moduleparam.h>
* ~: {4 Z: S" j- w5 I. V - #include <linux/sysctl.h>( O4 o: X& s* }$ Z) d$ a) j2 \
- #include <linux/mm.h>
: u- R5 h( j8 A/ Y - #include <linux/dma-mapping.h>
$ o% b- W8 G4 c. ?7 q
& B* y$ \& |7 u" [) B% n8 X3 N! y- #include <mach/memory.h>+ |$ L* Q$ T1 h( \" W9 U
- #include <mach/hardware.h>9 A/ N, q, B# W; R2 M3 n
- #include <mach/irqs.h>3 T1 E! I! J' @4 s
- #include <asm/hardware/edma.h>
j1 L* q" X2 u6 j - [& D J1 V/ V) z# X, e+ a
- #undef EDMA3_DEBUG
: J [( ]5 J! u# Y) p3 c4 T3 ^ - /*#define EDMA3_DEBUG*/
5 J# @' T0 ^2 {4 W8 ^9 u
2 U9 D& @+ o+ F" O- P- #ifdef EDMA3_DEBUG9 L' y( w' [9 N4 Q" W1 ~2 I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- \; J i1 a0 i$ u7 n6 W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 p& C. Z' E* @5 \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ ?7 A( g0 P; y& I2 f0 v! Z5 I! }. e - #else
: V6 p- M$ o7 j0 J. y3 o - #define DMA_PRINTK( x... )
7 _/ ~/ b. S/ M/ ^ - #define DMA_FN_IN
' m4 W% [( D- {8 J2 W9 U \ - #define DMA_FN_OUT
& P! y1 J$ r. Y& Y6 W# g - #endif+ s' q6 A% j4 f# E6 a! E1 ?
9 C% P2 l8 `$ s; B: G- #define MAX_DMA_TRANSFER_IN_BYTES (32768): n: @6 ^# Y: |
- #define STATIC_SHIFT 39 q) l" | n# X
- #define TCINTEN_SHIFT 20
" S! |' Y5 O# T% m; |; h - #define ITCINTEN_SHIFT 21
8 {# e( B# ~' @; @; V, [: n; ^% e) [# Q - #define TCCHEN_SHIFT 22$ M; Y" k2 e1 W
- #define ITCCHEN_SHIFT 230 P* U6 E* p6 G
: `" |8 Y# ]5 k- static volatile int irqraised1 = 0;
. R3 F3 ^6 z" y: i - static volatile int irqraised2 = 0;. H; I# U% G% _+ u
- " L+ H9 j$ u2 v# w: a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 k3 {3 O! T* {" ~7 x. G5 z+ \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 L, r( o+ p8 s" R* C [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% {. |4 j& k# k2 I8 E - 8 R; {# N2 `9 A5 _, q# q' M& R
- dma_addr_t dmaphyssrc1 = 0;: L: n h( T3 R( l2 x8 J5 _" K
- dma_addr_t dmaphyssrc2 = 0;
6 Q- u, ~, |3 o1 f - dma_addr_t dmaphysdest1 = 0;6 k# Z+ S- @. W( }
- dma_addr_t dmaphysdest2 = 0;" ?& }2 G# e3 z7 B3 Y+ T
6 U0 r) v/ q# b. y7 C* p- char *dmabufsrc1 = NULL;
( H: J" ?8 i& t/ \, W - char *dmabufsrc2 = NULL;" Y; U/ X0 a1 _7 }( j
- char *dmabufdest1 = NULL;5 N) ~7 H0 B! f1 P! ?) e6 H& ?
- char *dmabufdest2 = NULL;9 ? V: i" K! [+ }# x8 ^
+ U7 q/ a/ x2 N, D _$ |- static int acnt = 512;, X5 |$ y! v h2 ~
- static int bcnt = 8;
3 C% E( I9 P% h" i - static int ccnt = 8;
( B3 D% @: v& k4 f' b7 j, R, c
% k0 s9 ? ?6 i* s( d* Z/ ]; F- module_param(acnt, int, S_IRUGO);# X- V1 A D: G) |; P
- module_param(bcnt, int, S_IRUGO);5 n! W2 N0 X2 ^9 R
- module_param(ccnt, int, S_IRUGO);
复制代码 8 l& x; x5 @3 a$ x: e
0 y- M; `1 i) |% r7 f/ _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
_. m' R$ p3 H, S) E- Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 G; T8 @! ~% Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, p- z9 f% S5 o9 ]
3 o7 N- X; O$ b9 v$ Q2 e* e* o. _9 y
Y9 a) q" l# y3 K, c" N5 I8 Q# a |
|