|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 b( k5 c4 F% M% v; ^
- [code]EDMA sample test application
! L1 i7 ~" p0 d# F' i4 e, d - /*
( B$ M" P; `5 D. ?" _' W& V& R - * edma_test.c, R2 C' s3 y7 g& N. X
- *$ e; \1 g/ I1 [. N. k
- * brief EDMA3 Test Application
! @' E. C/ r0 X" Q! k% ?9 H - *
1 _; P' C* a9 M - * This file contains EDMA3 Test code.) g$ T, I; } Q& g+ n. Z
- *( C4 i% c# E3 \' U7 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. C9 ]- J7 R( H! g4 O: v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' X/ _* K2 Z' m0 e - * TO CHANGE.: _: Y1 N0 |' W
- *
: q) I3 F: p( M2 o: l$ e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 j% l6 K4 W1 }8 r
- *
4 g+ v; O0 e7 L' b - * This program is free software; you can redistribute it and/or
1 `) y! m5 O5 U3 H/ [) b* R+ z6 J' Z' M - * modify it under the terms of the GNU General Public License as, j" K% P! C- z1 _' L; k) I
- * published by the Free Software Foundation version 2.
' I# I# S; {! W2 T/ h8 s - *
5 _! u* r) {. d8 G, k2 x; q M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- y1 {# q9 i& X3 r; }3 a
- * kind, whether express or implied; without even the implied warranty
5 c7 J& q+ c U. Z! _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# j6 b3 ~! V/ C6 Y: W4 j1 p4 K - * GNU General Public License for more details.
% q. X! E$ I7 Y# v, ] - */
+ O/ c/ r' a6 [- L# C
; t- O$ @" v) \' R: l- a- #include <linux/module.h>
# y. f' n2 y( i1 p: A - #include <linux/init.h>
' M. }3 f/ ~$ y - #include <linux/errno.h>) C0 U3 d/ E: [
- #include <linux/types.h>
3 c; n4 b9 u( k* A+ o3 Y - #include <linux/interrupt.h>& I, Q b/ t' F
- #include <asm/io.h>
* F, ^' ?1 l* E9 ^ - #include <linux/moduleparam.h>" Y/ P. O; {$ N0 H0 [: {
- #include <linux/sysctl.h> n$ S2 g" \ j
- #include <linux/mm.h>
# e( @+ {3 u/ U, y# ~) u6 E! Z - #include <linux/dma-mapping.h># L1 @& O1 m/ F ~
- & Q7 R5 o, ` [/ F: W& W
- #include <mach/memory.h>
' d! X; ^4 u& L' e; d' R( U! b, O - #include <mach/hardware.h>
, l6 v. g w) R3 ~. D( f - #include <mach/irqs.h>/ N0 U* h( \* ?" `4 ]0 m
- #include <asm/hardware/edma.h>
. e% B" K6 {' h( H - 3 p/ C0 V/ Y- u$ r! e
- #undef EDMA3_DEBUG. a) i4 \ O% V; r2 |5 d6 L5 S: E
- /*#define EDMA3_DEBUG*/$ L. y1 ~; W) H, y( P4 E' W3 B
1 J" G: G5 K9 x" ?" l( w- #ifdef EDMA3_DEBUG8 R; c; Q: W: t" i" M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), F+ ]( d- K7 q( x- _4 n$ j4 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 H; x/ |3 N \, `, [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ o; F B, Y9 {: X, N - #else
: W8 c7 J6 H# ]$ Q% |, Y' A/ I* ?- X% Q5 ~. U - #define DMA_PRINTK( x... )
8 x& v" }) I& B$ G - #define DMA_FN_IN
" L5 f& Q, T; z ]3 F - #define DMA_FN_OUT
8 C3 t2 A9 D& r2 R - #endif
s$ [' q0 v" Y8 }4 x6 z; u
6 }) u, o) W, Q6 Y6 D/ ]2 [5 f; o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& q j6 v! Q7 ]/ r$ l; [5 W
- #define STATIC_SHIFT 3' L: k3 L/ H `
- #define TCINTEN_SHIFT 20
6 u' D1 p5 q$ z& l8 \. a/ w - #define ITCINTEN_SHIFT 21
! F$ T4 P( ^% P: j - #define TCCHEN_SHIFT 22) N1 s! T# x1 e$ b! b& Y) L
- #define ITCCHEN_SHIFT 237 N, u; I3 o [. {3 T
( l3 d3 T; x$ r- t# }- static volatile int irqraised1 = 0;
1 a k! D7 L4 [9 ~/ Y+ {+ ` - static volatile int irqraised2 = 0;
" V% K3 G: |' I% O& _/ Z
, @1 I/ e R$ G2 B: m ?7 u" V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 |3 a! E$ {. K& a4 v0 ?8 Q* l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: W* G' ^* z6 B3 j& g; h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" r- D& }. U9 I% ]7 |0 F! {
6 i5 `' P' `% t2 \/ }! I1 W- dma_addr_t dmaphyssrc1 = 0;, I- H) d% t$ c( h5 Z. J. h
- dma_addr_t dmaphyssrc2 = 0;
" S* ]( b2 k ~& D3 p' f! I: A2 K - dma_addr_t dmaphysdest1 = 0;
1 k' w5 G: j. q! M7 d) ? - dma_addr_t dmaphysdest2 = 0;1 c* u' z0 a( m. ~
- 6 g! q+ Z8 ]8 x3 ~
- char *dmabufsrc1 = NULL;, l f3 j0 R4 W2 [
- char *dmabufsrc2 = NULL;/ b& [/ r- [, `. ~ [9 ]8 a
- char *dmabufdest1 = NULL;7 ^2 r8 L1 G u+ \# y) b
- char *dmabufdest2 = NULL;# a2 d9 |# m2 ]9 K" [$ N. e# L
7 r, b8 R, ~( O! ^2 x2 J; b- static int acnt = 512;2 k: X+ ~2 n( s# F
- static int bcnt = 8;
9 a4 L. R3 b) |; a y/ i; K - static int ccnt = 8;
& m L o8 q" e3 t# Q5 c/ ?
, T4 U8 ^* L# n5 P- module_param(acnt, int, S_IRUGO);7 b: n& Y6 |* P/ X4 g3 k. f
- module_param(bcnt, int, S_IRUGO);
( x# v) }4 F( q3 o2 c/ t$ ` - module_param(ccnt, int, S_IRUGO);
复制代码 $ {0 T5 Y3 f, ~
3 F3 m+ [! `2 Z0 z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ T+ F2 X3 I0 l6 d- R4 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 y7 X& q" }3 |7 l7 A- R. a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 E" T' x" w7 K& n' I
. z# E/ C- Q; [1 v6 E: B# y' |! e) t! n9 C& g! H
|
|