|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
V9 s$ i6 J$ f: u5 x4 r- [code]EDMA sample test application. v* J5 F( A5 j! u8 N+ n$ B7 D8 p
- /*# V2 ~7 O6 r3 W' f
- * edma_test.c2 R7 B |% ]; W7 r7 Z
- *
. \& i, A2 l- Y/ B' t% Y- x+ Y - * brief EDMA3 Test Application8 O. \7 H) ~" c. [2 m
- *) b# D5 B2 w5 x3 d
- * This file contains EDMA3 Test code.
1 [' r$ r( @/ y" d! s - *
' M4 H1 X1 t X9 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 `# W/ {4 z: A2 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# ^, H+ K6 V3 M% U
- * TO CHANGE. y" d: p- q0 A
- *
$ ?- ~4 d9 F: w! s* L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 u& y# k% o) a5 P9 e3 [& J - *
, I/ a7 j& f3 E2 \& C* g; E( j* } - * This program is free software; you can redistribute it and/or
' O2 M/ m3 y0 x5 f9 ^ - * modify it under the terms of the GNU General Public License as
1 T' q; }" e A* h - * published by the Free Software Foundation version 2.; `- |& ~1 K8 W2 r) t) a" ~
- *
. M" A7 I9 D% R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 n! Q2 | f1 T% W1 s3 r5 S - * kind, whether express or implied; without even the implied warranty9 H% n5 [ W T& Y j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 \, ~0 D9 q$ B7 I& d& c5 b1 @ - * GNU General Public License for more details.0 E& F0 d& ?* c: l( m/ ~
- */5 ?1 b- @; S; G; P- u
( i& F2 k' O% j1 x" Z1 t+ L+ |) F- #include <linux/module.h>
# M+ f( x; k3 S9 a5 ^ - #include <linux/init.h>
8 Q! D; Q# G3 f2 k( e3 E - #include <linux/errno.h>
; Q1 Z) f$ W2 C3 U# j: _. i8 V" y - #include <linux/types.h>7 S' O+ @- ?+ Q) Z- A
- #include <linux/interrupt.h>( j3 e: S- F2 X: l/ t
- #include <asm/io.h>
+ p$ b5 D9 \# I9 N - #include <linux/moduleparam.h>- |4 D& |% R8 T' F8 N+ ]
- #include <linux/sysctl.h>1 @+ k g) b: |9 \9 g; i" l
- #include <linux/mm.h>
5 i) ?1 [; v) v* q5 I5 v - #include <linux/dma-mapping.h># j' f5 g; B. @7 i% W
/ o* y7 r+ W. P+ ?0 F c6 x7 B r- #include <mach/memory.h>
# h7 J& a' X8 ~$ r% i1 x - #include <mach/hardware.h>( r+ q6 x2 }/ ^1 j
- #include <mach/irqs.h>
6 P" p8 \8 [$ ?; \4 p$ ^ - #include <asm/hardware/edma.h>
5 x0 m q+ O+ S0 \
1 q" y; u [" ~: o l- ]5 Z+ F1 ^6 M- #undef EDMA3_DEBUG0 i0 n$ l' p0 l# C% B; _
- /*#define EDMA3_DEBUG*/' w, \) Q3 z- t) y4 t
3 Z1 S: s4 K0 V- #ifdef EDMA3_DEBUG! o; Z9 X- U" ?& |3 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 J7 P8 D9 N: R3 V U# f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' { g# ?: m5 t; R: c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) N; `: U* O3 ^9 g# g6 i0 u3 B
- #else- |9 B* d% \# C- K$ c
- #define DMA_PRINTK( x... )
0 m' `- q% W( u- r; [% C - #define DMA_FN_IN! `! b# I% `0 F5 C3 A' R: {& J
- #define DMA_FN_OUT
0 X% H% V3 s& ` - #endif
, i# ]! |# n e- ` - $ j- Q; p1 Z$ G# K( M) H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; i: P- ~! A5 D! D, X( _$ P2 i - #define STATIC_SHIFT 3$ i+ k( E0 v3 V$ S: M6 ?
- #define TCINTEN_SHIFT 204 r( q9 g" N. _8 V
- #define ITCINTEN_SHIFT 21
3 n+ r7 i- q; m6 S) h - #define TCCHEN_SHIFT 22
5 @6 H5 K1 P0 [- m1 o% a - #define ITCCHEN_SHIFT 23
, Q" e7 g+ r" c - # \0 E V7 \3 p! n/ J+ L1 i4 Z
- static volatile int irqraised1 = 0;# N& i7 B! W4 N
- static volatile int irqraised2 = 0;8 c n7 { n) j" N2 u4 O8 D
- ) l7 T2 y8 P2 O) P [( `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 n9 H M9 z( p" O* F& ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) e" ?6 ?' R& n+ ~7 R' q) W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ d: R0 ~4 ^' Z! s6 N, b, ]
& i+ R/ [, [5 g% N# u: Q- dma_addr_t dmaphyssrc1 = 0;
: Z8 `. {0 s0 X+ [ - dma_addr_t dmaphyssrc2 = 0;
% ^9 a6 d+ f d# | - dma_addr_t dmaphysdest1 = 0;
- x) S- _4 T. V4 Z U0 e - dma_addr_t dmaphysdest2 = 0;1 ]* a- X- c# {% e C
8 x! H/ \1 X5 b0 {$ L! x6 l1 y- char *dmabufsrc1 = NULL;
4 L3 F3 q' M% V4 N* K - char *dmabufsrc2 = NULL;
, y: I3 v8 q( q1 H8 d - char *dmabufdest1 = NULL;3 |& b. F1 _3 V2 \7 P X
- char *dmabufdest2 = NULL;7 e- {. T0 u) X/ J* }3 {
6 L' Z3 y) ]9 q5 p7 m, Z- static int acnt = 512;
6 w' M$ x/ \) I- Z8 p - static int bcnt = 8;
3 _2 C3 l1 s1 X3 m) m& P+ X! d - static int ccnt = 8;
4 y8 E& |) i$ ^4 d9 K; b0 [
+ X8 G) U2 F& Q& O- module_param(acnt, int, S_IRUGO); s$ C6 G5 X# S, o9 s8 k3 p8 M
- module_param(bcnt, int, S_IRUGO);' J4 d+ F( c9 j
- module_param(ccnt, int, S_IRUGO);
复制代码 / M1 ~' J% ^* k
- ?' i" G- k1 Y8 G5 U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! V; a5 m" @2 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- G$ @: L; m7 e. V* ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 G7 g8 J! \" u; M
+ g" \6 d2 @+ t6 n( O
. w2 D. A8 F; f+ [ |
|