|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. r# X T! |- _+ [ K7 k) G- S- [code]EDMA sample test application% B0 n4 u! w3 d- j3 c
- /*
+ R# j0 C9 k' X. y |* C - * edma_test.c) x4 m- t8 a" D: [2 \) r
- *
' ^- T9 f! P; O) K7 [1 T0 x4 z7 U - * brief EDMA3 Test Application! j$ O6 g4 T" \; `: h
- *
d. c, |, C4 }% u% W0 ~* I - * This file contains EDMA3 Test code.
7 B0 x6 l3 G9 D* D - *
' s$ X. G" a1 y8 f* n, ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, m% o4 |6 m5 J2 B4 D$ O; K9 K, O2 E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 B# _8 m; L+ Z. Z" y0 w2 j
- * TO CHANGE.+ X) g' d- g" Y) p2 a
- *
6 l' A: [1 ~' f" ?$ w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( m" K' K: A0 U( n4 G0 J7 z9 J
- *
1 w5 `$ G! o" k - * This program is free software; you can redistribute it and/or
+ Q, Q$ z { [ - * modify it under the terms of the GNU General Public License as; j; B/ q" M* c, A8 {1 @4 E" J
- * published by the Free Software Foundation version 2.
' B! a9 b1 Z! }1 }' m5 P) i1 Z* l0 ? - *# I/ A6 {. g$ K. M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* Y+ U% G& w/ P$ v
- * kind, whether express or implied; without even the implied warranty2 v1 L, ~/ \2 J& P- G/ M7 {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; r# f7 Q& P' Z9 {. y - * GNU General Public License for more details.4 O% @0 c* y% ?2 w7 t- |
- */: I& ^7 M% {. ^6 C3 J
- 6 {$ N0 |" b- o
- #include <linux/module.h>
" M/ k, H# y/ m8 T7 _ - #include <linux/init.h>
( p: z% J7 P; `8 y+ ]8 C, E - #include <linux/errno.h>+ g+ ^5 G% A$ E7 p" J/ k
- #include <linux/types.h>
- f9 `3 d1 U6 n; L+ t% p; m - #include <linux/interrupt.h>
8 y/ L A7 u. V8 L0 y3 `1 \ - #include <asm/io.h>9 V2 o y7 P7 l% O. I/ H
- #include <linux/moduleparam.h>0 k0 I# A6 i, b) s2 k6 t
- #include <linux/sysctl.h>
4 @, v+ _$ f% s3 h; d+ B) S4 S7 T - #include <linux/mm.h>7 S$ H# a- M2 p3 c6 v+ O7 E
- #include <linux/dma-mapping.h>: ]* R K, ]9 D r
- % h: Q0 j6 N3 N; l g, J; i/ ]
- #include <mach/memory.h> O: ~6 h) j: R% K0 U, A
- #include <mach/hardware.h>+ P. G0 m' }4 ^4 c; |2 `
- #include <mach/irqs.h>; G% W- D3 S+ a0 _' F
- #include <asm/hardware/edma.h>( ^9 e; [& _6 Q3 E
9 g- S& c3 I5 f( h& u7 b5 R- #undef EDMA3_DEBUG
/ w) M9 B# V. j) [; g+ |# [) T - /*#define EDMA3_DEBUG*/) B: ], G5 ?# I- s7 C
! L+ `3 ^7 O# L" M1 [- m- #ifdef EDMA3_DEBUG
1 Z/ | A6 ?: u1 W1 G/ O0 R' u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% f& l9 b1 c4 O7 Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): h) ]# f: J. b" e$ {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( S$ \+ |- @& V6 R, L( T; y" |, ^
- #else
: g5 p i9 M M' k- m1 m - #define DMA_PRINTK( x... )8 \2 ?8 U% o3 ?: V9 D
- #define DMA_FN_IN
7 D0 y5 y; @: c' ~/ V3 { - #define DMA_FN_OUT
. T. C0 n$ \( N7 V/ c" H - #endif2 j' |* x2 g% A5 m1 t6 T% o
6 U7 M4 X, a' [ p& j8 l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* E5 |8 q% h) { - #define STATIC_SHIFT 3: ~6 T# f: g3 H' V
- #define TCINTEN_SHIFT 205 h. }: e# I) q5 k7 X( k' ]8 L
- #define ITCINTEN_SHIFT 21
* h* s( ~. i. F- |1 M' p) \! } - #define TCCHEN_SHIFT 22 x, Y2 R7 V2 i8 g' a
- #define ITCCHEN_SHIFT 23
% b& e& L& r) g2 h: ?
! q( q, n9 n5 a- static volatile int irqraised1 = 0;
( }6 H. T6 i4 M - static volatile int irqraised2 = 0;1 M& B1 p# D( j9 d6 [( y' j
: l( n+ F# k) m% x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T- ~, \& x5 l1 }2 t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: N1 y% t" i# i' {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ |0 O; m# n3 H. d3 ?
- R$ L2 g9 |$ S! v* N: o- dma_addr_t dmaphyssrc1 = 0;- @: ]- w* W' Q2 d
- dma_addr_t dmaphyssrc2 = 0;
6 M' ^' i9 K: m- w4 I9 i1 C - dma_addr_t dmaphysdest1 = 0;
( t, C2 y) v. j- O3 z$ ]5 q - dma_addr_t dmaphysdest2 = 0;
7 ^( j7 Y& T, z7 R8 L" U) M2 K
& U2 a: ^: k* l0 e- char *dmabufsrc1 = NULL;
2 d" C' o5 r# C - char *dmabufsrc2 = NULL;% ^. T* n J. q8 z! J
- char *dmabufdest1 = NULL;9 V+ _' m) {" B
- char *dmabufdest2 = NULL;: Q) Q- g* ]! x2 X% b7 p
. g1 M; b5 a3 L+ U# ^; Z! F- static int acnt = 512;) q& J0 z& i" {* L
- static int bcnt = 8;$ a8 u+ v0 P; O2 L
- static int ccnt = 8;
- C# m, u+ }! S; F( Z: `
/ V0 r& z0 D( }3 w- module_param(acnt, int, S_IRUGO);
% v# M1 q1 d3 g. | R - module_param(bcnt, int, S_IRUGO);* C6 T$ c, i1 A2 K" A' y" i
- module_param(ccnt, int, S_IRUGO);
复制代码 5 X+ ]) E7 r. E+ r
( }+ S* P6 X( M+ c; L* \7 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) b$ h! k/ c+ ]1 a; w5 j9 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" z9 w+ q* ~- Y' C) W: ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; p9 k- O& M& `: R) B e2 C3 T. e2 t+ m1 q- o+ T. e, S
" F( F) _% ~! h6 x! N7 |, p7 a |
|