|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 v% j" o" y# u
- [code]EDMA sample test application
- {8 ]7 R- o3 `) C- u7 n - /*# P" s2 n7 E' @- ]5 c2 V- n
- * edma_test.c* ~2 a8 W, w3 ~+ P8 K# G3 k
- *4 s' H& h" _: k2 X1 c7 M
- * brief EDMA3 Test Application
; j& Z: N2 T! Z9 ` - *3 G0 {* h* h) ^6 Z: u4 O
- * This file contains EDMA3 Test code.' u8 S( ~! _5 O/ d3 s- k
- *
7 b& A: k# l# ^5 s! b5 ~& _, h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 Z9 w3 B) w4 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 U0 f9 _7 i2 \% D9 [& H - * TO CHANGE.
, M l8 w& t7 M1 [, _+ h - *
- ?) t. c- t8 n' J9 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& x' y4 j' V& |" R( T |
- *
9 s z2 {# ~% |' o4 _- L* R8 x - * This program is free software; you can redistribute it and/or/ x. u% L) T a$ T1 ~( E
- * modify it under the terms of the GNU General Public License as
' G' c G* P: U; X1 r - * published by the Free Software Foundation version 2.
2 ^: l4 }0 u" `6 M - *( W( v* m5 V/ k9 U* \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 v* ?( M+ ^4 A3 [, | - * kind, whether express or implied; without even the implied warranty
( M5 D0 r7 U$ B0 R0 z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. V% {5 T1 ~9 _% q. l1 n6 T
- * GNU General Public License for more details.
+ @7 L" J1 P2 T- N, Y \ H) z: m# A5 r - */* f; J* k+ @1 y% ^+ M9 i
% N0 O% b; B& C; s' y4 o$ b# o5 q- #include <linux/module.h>
$ X; x: i# {: l+ ?, X$ m6 x - #include <linux/init.h>- m) T2 n# x( Q" y9 U" i
- #include <linux/errno.h>8 b' Y+ Y) y) Q) J$ V: g* q2 {
- #include <linux/types.h>, f# z9 n" K, S3 H, X _
- #include <linux/interrupt.h>
T5 c4 U9 E. X, d: m( ~* O - #include <asm/io.h>
; k# R- K4 ]0 c/ }; [* p, d3 N - #include <linux/moduleparam.h>; o, n. A7 E' t) ?: j
- #include <linux/sysctl.h>' t* b( a5 e4 }
- #include <linux/mm.h>
6 e2 k/ c* @: c* Y - #include <linux/dma-mapping.h>7 P0 U& S: C- Y$ U& E! P6 s
- 8 ?$ e5 f f+ `
- #include <mach/memory.h>
O- b1 q( H' v4 w0 \2 D& p/ Z& f& J - #include <mach/hardware.h>
) { s& l, L8 T- O - #include <mach/irqs.h>
$ d8 Q4 E3 l% x - #include <asm/hardware/edma.h>& p, w7 N' U# c! ~: u) {
- , T3 _ \( l. a
- #undef EDMA3_DEBUG% r) i. i, [/ A* c* G. h. ?. D
- /*#define EDMA3_DEBUG*/. H! F$ ~3 ?7 @% z' K. A7 W
- ' |) p0 |: _ ]' c3 @! Z4 T
- #ifdef EDMA3_DEBUG X. j) t l* p# j. y u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* u& z Z+ |+ O. j7 z" F; u# ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 M; R( ?: x: [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 e# J5 O5 s* |1 {* k4 s$ S3 c - #else& U! Z: l' n' i/ s
- #define DMA_PRINTK( x... )2 Z8 x" g0 L8 ?2 y% C# v0 l. J1 U
- #define DMA_FN_IN
- j) S4 U( K2 E) ^8 {: `( h' G - #define DMA_FN_OUT
' G. G! x3 t# g3 v! [) i% }* n - #endif6 L1 S* J% z8 d* |! `
0 D T; x$ L7 w+ U6 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 b* R& \3 Q$ n
- #define STATIC_SHIFT 31 ?) s2 S* s+ |( ~ L: W5 j
- #define TCINTEN_SHIFT 20 X! A! _) C8 R
- #define ITCINTEN_SHIFT 21
: i$ n6 i% g& a7 t8 B1 Y( c. W# g3 W0 t" E - #define TCCHEN_SHIFT 22
& H- b4 ]. ~* ~ - #define ITCCHEN_SHIFT 23$ M4 m- H* F; [( A7 W3 v
# e+ c. N- F) N# b# o- static volatile int irqraised1 = 0;$ h7 H+ B" a& [! y
- static volatile int irqraised2 = 0;
" l: w# T6 {1 S( l& j) \
5 b) b8 V7 |" g! F3 N& C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 B/ s/ g: f' b6 Z! I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ~ v) {2 \! ~( A9 z8 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 e1 C8 @5 U/ t8 Y( a2 k
- 6 U8 z r9 X9 P; l4 z& k; y
- dma_addr_t dmaphyssrc1 = 0;
u% C( d4 ~" S. K- a/ O - dma_addr_t dmaphyssrc2 = 0;, q$ X5 g0 h3 N! f; [! o5 J
- dma_addr_t dmaphysdest1 = 0;! F; P5 p$ @$ m% k5 ]; F4 G! U
- dma_addr_t dmaphysdest2 = 0;) }! ^. V' S# M) S% w
- - M. T+ i" }: y- c) V6 P
- char *dmabufsrc1 = NULL;/ V' [8 X, B/ y% S! k
- char *dmabufsrc2 = NULL;$ u( z' \. W" u u. e6 B7 l
- char *dmabufdest1 = NULL;
2 U! _9 Y- A+ M- s; g - char *dmabufdest2 = NULL;4 M) Q2 y2 D" \( F
% o2 \3 E. y0 Q( Z! Q1 P( Y- static int acnt = 512;
* i& P6 @3 E; d9 k0 p - static int bcnt = 8;, Y* d P$ R/ H ^/ |, Q2 a
- static int ccnt = 8;
K. z$ p! T" D: V% k7 u
. i3 ~6 e3 @' y1 r- module_param(acnt, int, S_IRUGO);" [$ j3 x6 w* C, n' I
- module_param(bcnt, int, S_IRUGO);! P8 {* `, Y; P+ O5 z( q1 l
- module_param(ccnt, int, S_IRUGO);
复制代码 . y+ m: u. o( `
( Y! P- P3 x6 Y& f) X% j1 z; O2 g$ A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 r' e G# x6 T) j1 ^: s! k/ rarm-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 W5 _) R8 w' C5 r' b5 r: L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" W# u# b4 d* T+ x! G' _) R% ]& W' p
. o" d9 |0 K; O% W, |% a8 z% ^5 z9 \7 S7 E* E: |
|
|