|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' G( }" t2 ^+ h+ j9 q' t- [code]EDMA sample test application. o, X) E3 @$ N2 Q' ^6 y/ f# S& l
- /*% J0 M. f. `. r% i, p
- * edma_test.c
8 m" M' C3 d/ L: \8 B) A( X - *
* x9 v2 G& x0 J - * brief EDMA3 Test Application4 W. Z2 b I. {0 H
- *3 o n% A$ @: m e
- * This file contains EDMA3 Test code.
. x" {$ n) K% F - *
' }3 |. t9 l3 s) \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; D1 L4 ~; J7 x: \3 q) B: U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& ^! X0 Y3 | s* R2 t. } - * TO CHANGE.7 H# ~# Z. `1 T' a6 C0 P; r
- *0 m/ u( Y3 b4 o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- R4 T2 x' I( Q/ r- I* V. L+ E0 w
- *, {4 m A) u- k7 x
- * This program is free software; you can redistribute it and/or
4 u8 Y \8 i$ `5 \0 B% @) _ - * modify it under the terms of the GNU General Public License as
& N- I Y# B+ g9 o* l, {, L( O - * published by the Free Software Foundation version 2.
7 T% Z: l3 Y+ J - *) M# v9 H6 ^( ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- j/ C2 H/ ]) W3 ~& b' R* q
- * kind, whether express or implied; without even the implied warranty
1 l. ]& |* W5 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 ]: x% P8 S, @ - * GNU General Public License for more details.
7 l& ~# }# U3 ~& n" q - */: I& \, o8 u3 R' h8 {
: M# a0 z- F, ?+ I8 c7 @- #include <linux/module.h>8 r! I( ^/ \) w Z# g& S' [
- #include <linux/init.h>% ^. c( h1 F. S& A
- #include <linux/errno.h>
8 z; p$ h0 N0 A9 E - #include <linux/types.h>
* Z2 \" u& w) W% E% O - #include <linux/interrupt.h>; d/ T. _9 c, L* O% r
- #include <asm/io.h> m8 }* z! Z6 t5 }7 ^: _
- #include <linux/moduleparam.h>
8 [6 R, @- F0 v$ [0 E4 d0 j - #include <linux/sysctl.h>
7 r* T( R( t) Q- N( x9 t - #include <linux/mm.h>* K# ?& Q) T5 D l( l9 F; m' s7 P
- #include <linux/dma-mapping.h>( l) A+ X9 Q* P9 V& ?" r1 o
' K& D, ~8 l$ {# v! i- #include <mach/memory.h>
, ^ w5 s; c: u4 s0 L - #include <mach/hardware.h>& u! q7 m: N" R
- #include <mach/irqs.h>$ w0 \) x" R o P. T1 m: S6 A
- #include <asm/hardware/edma.h>* K& `( E. i- C$ S5 {) M' Z
- " u! \, p% k9 A: k: t {, F8 Z
- #undef EDMA3_DEBUG9 u! ~! a9 }# {$ r( T' W9 z" t
- /*#define EDMA3_DEBUG*/- Z+ b: Q: ~. p& f+ J0 Y7 c9 c
- ' k+ z+ Q, @/ d5 M
- #ifdef EDMA3_DEBUG
2 Z$ X$ ^1 k) m. Y; _; J3 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 R: o q: H5 T# m. }- c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" G" K& t5 D4 T) x8 b+ Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ U6 F" B; c8 Z/ V3 e2 _ - #else
7 F* b! a+ J0 _( \* l - #define DMA_PRINTK( x... )
) N9 n1 U: [, n" S- y - #define DMA_FN_IN
7 S F8 b0 ?' N; W - #define DMA_FN_OUT8 C" v1 J; R- I9 A8 \0 X T% W5 V
- #endif
: F. q/ {* N( l {1 l/ o% I
' _8 S& F% l8 D0 {$ X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 C8 [/ R8 R! F8 U+ |& A+ r
- #define STATIC_SHIFT 3
. ]' \# c5 }: y8 c - #define TCINTEN_SHIFT 20& s& j" s/ T0 ^' ~8 P* @8 d! o
- #define ITCINTEN_SHIFT 21
4 U) E& w0 M8 |4 I- o - #define TCCHEN_SHIFT 22
. f9 X4 q& q( \9 L+ @9 W - #define ITCCHEN_SHIFT 23
! y" N% u9 e5 }- c; Q+ i' z - : L$ n' {% ~0 e$ D
- static volatile int irqraised1 = 0;
, E" z" z. k2 b8 l% `) ^! \ - static volatile int irqraised2 = 0;
* \3 g$ r3 ^( I2 [: E3 v9 z - 9 V/ r1 K& e$ ~4 n8 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ P4 h2 s, M2 U9 j+ Y' A. \ W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 t3 n* |, M) i2 F4 _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 U* q1 F( d, ~% h
, e; R; P+ D1 [* x% r) d- dma_addr_t dmaphyssrc1 = 0;4 I$ R2 a2 b5 ]; |. I2 m- R' }
- dma_addr_t dmaphyssrc2 = 0;5 W# ^( g! C- C5 I) E4 |- M
- dma_addr_t dmaphysdest1 = 0;0 l( M; x$ ? _2 m: \! O
- dma_addr_t dmaphysdest2 = 0;2 L& |8 Q T5 \- @- Q
9 B. `6 P2 }( [& c# F- char *dmabufsrc1 = NULL;
R1 a2 F4 v+ R/ M$ _ - char *dmabufsrc2 = NULL;; [3 E7 T6 y, m3 y, D1 J/ T( l
- char *dmabufdest1 = NULL;
1 R( B& i, b: C+ y$ a8 W - char *dmabufdest2 = NULL;
# X. o/ c n/ N/ T" {
' v6 x9 K( g( z3 b7 O2 P- static int acnt = 512;
) j# F% u8 C# T$ ]( U - static int bcnt = 8;
* C2 e+ }, h3 e( t8 H - static int ccnt = 8;" ^$ w n0 o2 W8 t9 ?! K; @0 y
- + |* x0 {9 ~# E; m& H/ G
- module_param(acnt, int, S_IRUGO);2 \- \+ D. a* H: q& S9 V; v
- module_param(bcnt, int, S_IRUGO);
: I8 h8 s1 w9 d1 d7 g) ~/ j - module_param(ccnt, int, S_IRUGO);
复制代码
7 t* h! l. k$ S) ^3 s+ T% T& h2 `& U2 i: f2 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! j+ v# t+ G9 L- W) {4 l7 y4 U! J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: c0 c" H8 @* j% ~6 Q- A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* f9 h8 M4 J0 v$ [, B+ n
4 f. z% q# N5 J) J& N5 A3 I- g# U6 b
|
|