|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - H7 U, r2 g" ^
- [code]EDMA sample test application) ?1 d2 s0 a- o! N8 s
- /*) z+ N) x+ z5 e" b
- * edma_test.c
) k9 b* `# X7 e- m - *
3 j2 x, Z4 h0 g) z - * brief EDMA3 Test Application3 G$ s9 d" A7 ]' _$ O( R
- *: g* F' t5 e. `* q# [
- * This file contains EDMA3 Test code.+ t6 C$ i" c3 E# J5 k6 a: z9 W
- *5 s& B+ i- L' \7 d5 c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( A' `8 R2 _" ~( g. s9 _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% g- i( H& L1 k' H; {
- * TO CHANGE.8 {1 q" H0 A. P5 X' B6 s
- *
6 c8 ^4 q) l/ D) h8 H9 Z0 h- j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 d- o. R) A3 O$ ^# P; e
- *
3 p2 D5 s" {" K" g2 ^( B& j4 D - * This program is free software; you can redistribute it and/or8 b8 z) Y- S9 k0 ?1 d, t
- * modify it under the terms of the GNU General Public License as
$ H" p. t$ I1 q# s6 [* S& v - * published by the Free Software Foundation version 2.
4 a8 k1 Z3 E1 G) Z# e Q" O - *
& J. Y3 H d: j* r3 j3 j" e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& [; C( x' j2 ]# K" R - * kind, whether express or implied; without even the implied warranty- l3 Y/ T& {* `; z8 a6 G$ @& g# p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" h6 q- s. a0 N) U) I( M$ A
- * GNU General Public License for more details.7 }$ [* w, w: ^& I/ g! G$ |1 o* s/ W
- */+ V! z% E4 F" b) [) P
. I* ^4 b: j3 A2 E4 k- #include <linux/module.h>
( \- x8 c5 h2 U W5 y! h - #include <linux/init.h>* t7 U8 s6 _: z% V* p& k
- #include <linux/errno.h>
( Q7 X$ V& f( J# T2 n9 X9 A - #include <linux/types.h>
/ Z! \! L( H- B! \ - #include <linux/interrupt.h>
7 d) |, J L4 Z- t7 ~6 d/ V- S$ P - #include <asm/io.h>
8 S. L; ~" U2 R; `/ T - #include <linux/moduleparam.h>
* E$ E0 |( Y( S$ P) l - #include <linux/sysctl.h>8 c9 d$ H( p/ N$ q
- #include <linux/mm.h>" ?( _( L, y& ?( y5 w! T3 ?
- #include <linux/dma-mapping.h>
+ m$ f8 W6 w2 _% r4 `* k' u1 v) I
1 d: ^. C5 o5 E0 }9 v, _- S- #include <mach/memory.h>6 Y5 w# X' V! ?8 C! p/ X- `5 H
- #include <mach/hardware.h>. Y0 | k! b4 P7 ^. E+ i
- #include <mach/irqs.h>
, y; u W# ~! v) V' j0 V - #include <asm/hardware/edma.h>
: c6 m( {* G; X* @ n0 `: d
4 w- e; i X9 J6 c! B- #undef EDMA3_DEBUG" _2 @! ~+ G6 i7 j) v
- /*#define EDMA3_DEBUG*/
. w( V* S1 c! v3 n/ p' v
: M: j1 `! E7 v, R: Z- #ifdef EDMA3_DEBUG
$ B0 z0 e; E0 K4 q5 Q! x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, B4 y( o% A( ^9 ^# a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 w" S/ r/ W4 V& `6 ~4 j% n, t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, t/ {5 k" v6 d" l7 } - #else
- q5 \, ~$ s1 R - #define DMA_PRINTK( x... )2 w) {3 [* ?$ c! j
- #define DMA_FN_IN2 s/ f9 a0 s& m, f4 r$ P& E8 H
- #define DMA_FN_OUT
F& R. R5 A# \+ J2 ~8 _. t0 G - #endif
+ F' W& L$ e- H* F - . T2 s/ a8 G8 `4 v8 {( s& C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; m& E B: h6 A% M+ ] - #define STATIC_SHIFT 3* }& U$ Q6 M z5 h* o: C
- #define TCINTEN_SHIFT 20
8 l* f) T* d, I& M# f - #define ITCINTEN_SHIFT 21
( Y$ Y% i1 @! s5 @. m - #define TCCHEN_SHIFT 22# ]+ B- ^. U$ V8 M7 Q
- #define ITCCHEN_SHIFT 234 H7 V# \1 g: C, Z$ `
- ! r: h# S8 a; Q2 ]. g e/ m$ i! G
- static volatile int irqraised1 = 0;
9 g5 F9 ?* o: `7 h, ?2 e1 t- y - static volatile int irqraised2 = 0;3 U' W* b) l/ x
- 3 O i3 i- X5 J% `7 Z6 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; s* q1 I& X) F V8 A7 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ^2 [ [/ S. y' O3 P( ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) K+ d; b: h+ b, @0 z
- * n5 I$ Y) Y8 P- u- D
- dma_addr_t dmaphyssrc1 = 0;
! W+ E1 k% n+ N4 V+ |% \0 i - dma_addr_t dmaphyssrc2 = 0;' g( ^ @$ m# R* [9 }
- dma_addr_t dmaphysdest1 = 0;/ E/ e1 x8 ?. {, f: \' y
- dma_addr_t dmaphysdest2 = 0;- k2 [9 g8 E' q, _3 Y
- + o! E: D2 |$ g# F, g9 A0 ^
- char *dmabufsrc1 = NULL;+ \* h3 g. R) E$ o
- char *dmabufsrc2 = NULL;6 M6 G; w- S$ \
- char *dmabufdest1 = NULL;* o# q" Z7 t! b
- char *dmabufdest2 = NULL;: v3 u0 q" {8 Z9 ]1 i- \
@: t" h1 E @; s4 P- static int acnt = 512;
' z! H1 C- {: j6 Z i; [" s - static int bcnt = 8;, T# L o- w5 B+ ^
- static int ccnt = 8;$ m$ F2 B7 o: p) ]( h. `) V, _
8 x- s9 Y. U9 @* A4 k9 ^- module_param(acnt, int, S_IRUGO);& t" O o! ?& z5 q- }
- module_param(bcnt, int, S_IRUGO);% W7 S1 p" { U$ @
- module_param(ccnt, int, S_IRUGO);
复制代码
3 t; y8 m' e4 x# ]. Z6 `
% B; q% u1 M7 A; ~5 a. z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. \# P: y s$ Q4 F# E% V" D/ M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) L8 r \0 ?' y( w3 V' [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; m# r) h; T6 s3 o2 i7 F
1 x4 j4 I; X7 @! T! M& `. D9 F6 h) V9 O: N+ c
|
|