|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 k/ Q8 X' P$ a- ?2 C. O- [code]EDMA sample test application- I7 Y1 ]( I% E4 a
- /*
2 H M$ ]8 A2 X( q# b/ S - * edma_test.c
* }- L; E4 p9 p3 p/ `! M; D7 e - *
5 k( S, H9 L5 u0 w1 t - * brief EDMA3 Test Application
0 x; X; B" j8 b- N. W( U - *
: _% S) B( z$ Y3 f4 E; X) x - * This file contains EDMA3 Test code.
: [1 F% H" ^. D/ z - *
. d* |8 q+ E# S* d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# q8 e! p2 `) Z$ p/ ]5 j7 p# r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( w8 d9 k* G* a
- * TO CHANGE.+ x7 u- H- H- m2 W+ s6 h& |5 [
- *7 A3 s& \/ B! S- i1 |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: M/ t( K- i; W( h' Y& \
- *# A9 I$ c# U& ^9 W" I' K3 l
- * This program is free software; you can redistribute it and/or
; f+ {# D% p- s/ n - * modify it under the terms of the GNU General Public License as* `2 c+ @3 K5 k, c, W
- * published by the Free Software Foundation version 2.
9 i* w! c8 R% r$ ]! ^; V - *- m: d0 k/ R8 O7 k& r- I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 n) m5 X) [! U, Z" A9 s* M - * kind, whether express or implied; without even the implied warranty
6 i) l* Z# _: c/ V3 h |0 U3 ^3 \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 n/ u3 {1 X$ d( @4 O7 V2 Z - * GNU General Public License for more details.
2 m% m7 {/ ^3 H: k; V2 D% A4 U - */
' [& j, K7 s! W9 ^ - % R# p! G. s4 K8 ]+ k/ F
- #include <linux/module.h>5 m6 [" I) }; X0 w
- #include <linux/init.h>$ ?( Y" z5 x2 `7 {$ K
- #include <linux/errno.h>
5 u6 H( t- ?8 ?! y2 P - #include <linux/types.h>, j' B l2 |1 t. Y7 I* }% w3 o) o
- #include <linux/interrupt.h>
3 O D1 K, Q! ?- R' ?* [! S% C - #include <asm/io.h>
. I2 W7 a4 N* q: f8 G; \0 w - #include <linux/moduleparam.h>
& I4 g, I& C0 b, C - #include <linux/sysctl.h>5 ~7 Z+ Y1 p9 Z1 W8 _' _1 I
- #include <linux/mm.h>
/ _7 V8 r; k' L% }$ g4 v; N - #include <linux/dma-mapping.h>: b& m0 A% Z% M3 Q+ n! \1 G/ `
- 6 ?) }' K0 ~( V4 m. ~
- #include <mach/memory.h>0 E: y) e7 x0 k
- #include <mach/hardware.h>
6 Q# x2 G5 u: L5 W0 e- e1 u - #include <mach/irqs.h> T6 ^* k/ b/ H
- #include <asm/hardware/edma.h>
" m" T' e0 O1 h& p7 W$ T4 |% {& E
1 w4 O/ ], o( w- #undef EDMA3_DEBUG. G4 G5 F" x. P6 s# T
- /*#define EDMA3_DEBUG*/
& ~0 k# ?/ \$ K5 p9 Q
% G. B9 T+ N: E3 @- #ifdef EDMA3_DEBUG/ j$ u5 W. ]6 ?2 E) P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 ^' f ^- Q: w1 I' t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* n. c9 K# \- r0 ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ x' F8 Z* t! Y" h
- #else+ d6 s" _# I% z' r1 b% n y
- #define DMA_PRINTK( x... )
( t. d0 A# E, w5 n- u" k- ?/ }( s - #define DMA_FN_IN4 q4 ?7 l a2 w7 G9 {) o
- #define DMA_FN_OUT: j: z& v. X# C- r
- #endif* @- p, O9 E0 |8 } K: ]0 }
- * }/ e* _* g% c: W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& `5 C3 F$ R9 J5 }
- #define STATIC_SHIFT 3+ t- W: I: X1 Z8 X, `6 Z. ]
- #define TCINTEN_SHIFT 20% I( F9 p! |7 M3 C" g6 P
- #define ITCINTEN_SHIFT 219 N% y1 A* i- h$ Z6 y: m" z
- #define TCCHEN_SHIFT 227 w, [+ G' `0 H }( z- r7 {5 a
- #define ITCCHEN_SHIFT 231 m8 A& s" H' l/ M8 f
! m/ F6 K5 a9 l) H `5 R- static volatile int irqraised1 = 0;
% m) X9 ~8 e* n! L" R3 l - static volatile int irqraised2 = 0;$ }% t3 t3 M0 ]( @& n" L7 u% n
# g% T5 s0 y' @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A+ t+ ^* F% s, {% n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 I% A K( G' s4 t2 O9 l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ \3 f7 [# S U# o. x3 t! p% ^3 u
% u$ N$ e: G$ ^6 R& |! B3 W- dma_addr_t dmaphyssrc1 = 0;/ G1 x% l5 [/ W9 Y
- dma_addr_t dmaphyssrc2 = 0;( @2 O9 j- ?# e9 I; L7 n2 }/ Q2 \
- dma_addr_t dmaphysdest1 = 0;
. K6 l, d2 G8 B5 s8 u$ ^4 l" E - dma_addr_t dmaphysdest2 = 0;3 F) w+ S; G9 v# \; @: w8 Q/ t
- 0 x% ]7 ^1 c& Q
- char *dmabufsrc1 = NULL;
* E7 [# U+ b }+ i: ~ - char *dmabufsrc2 = NULL;1 I$ m* o f3 y& B ^3 j
- char *dmabufdest1 = NULL;
& p M0 G: R: A! X - char *dmabufdest2 = NULL;& t5 Y$ o5 f/ l+ J/ g! [
- 2 f: g) _3 ~0 R( C( R* m
- static int acnt = 512;/ ^3 ~# l( Z* {2 F! G# \
- static int bcnt = 8;
. v: r8 j3 E$ q( t% j s! U - static int ccnt = 8;. x6 n- C) l, |# w- U0 P
- ( w8 L+ x! V) o A Z& I
- module_param(acnt, int, S_IRUGO);* x; W0 V- U4 O; r) l" Y# ^+ q+ s+ [
- module_param(bcnt, int, S_IRUGO);
: O. w# A' S H+ ~: @4 ~$ p - module_param(ccnt, int, S_IRUGO);
复制代码 . ~2 E ^. M4 \$ q% q, b; Y2 @+ P
5 B0 {3 t8 i! Y9 Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 ]/ i1 ^& D6 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 j# W5 T8 v7 s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ B8 Y" m+ f2 }. c# Y9 V! W, [9 ?. d0 J; F5 X% h- W
8 J, P) S; m' A2 u# { |
|