|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 E' O/ o+ w0 F0 O4 b
- [code]EDMA sample test application* Q$ d- f. ?' f0 I/ s3 }9 o
- /*
8 a/ v: J. l5 x" e) V& `" ] - * edma_test.c6 \ s% ]/ V2 ]/ o
- *- C7 E, z' t3 A
- * brief EDMA3 Test Application
( }# M! U# \' @ i - *
* q8 x/ B4 e- v- G - * This file contains EDMA3 Test code.
- [2 L: o: g8 ^8 L - * p% |1 i% F( Z! T) A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. Q, A1 x) z' g2 X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* M7 _% L* b1 n$ U - * TO CHANGE.
+ }" m6 j7 c$ `6 \! |" e - *
6 H0 o2 q7 V4 I, C6 ^" @% o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ l2 K! |* b2 S8 R
- *5 D5 E+ ?' b4 W& }
- * This program is free software; you can redistribute it and/or
# |2 K" _5 p; p( w+ \9 Q5 g5 c - * modify it under the terms of the GNU General Public License as9 ^ C. p5 C6 V6 b# C. v8 K) C9 X& J
- * published by the Free Software Foundation version 2.
p/ J. c. }9 ^% ?. N( D - *
( n/ U, u6 @( x) j; c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 b0 F m4 L; }# X' ]) ~
- * kind, whether express or implied; without even the implied warranty
9 M: {& r) r; k" o# G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, T; f& f$ u. B. s3 B
- * GNU General Public License for more details.
+ R" Y" F5 O% m4 V; L - */! w, S# `# h: d
- % D- X- P, @) n
- #include <linux/module.h>
( d" v$ ^/ R( I# y - #include <linux/init.h>5 C2 G: J6 p* d2 }! `* p3 G
- #include <linux/errno.h>
# y- D3 T+ b" T* M" R - #include <linux/types.h>
! q& {0 t% v7 u% Q - #include <linux/interrupt.h>4 P5 v, }7 Q$ x5 m: \
- #include <asm/io.h>' A' {0 b( m5 `
- #include <linux/moduleparam.h>
* Q& E' e, q+ ~) m - #include <linux/sysctl.h>; A! B- ]) W: n% o5 X
- #include <linux/mm.h>: |% _3 t; J; h
- #include <linux/dma-mapping.h>* k% u) |3 z v$ i
- 0 V3 Y5 \1 |0 X b0 S0 }
- #include <mach/memory.h>$ D& K* J0 K; V& R8 M; K) L6 k; ]
- #include <mach/hardware.h>! `% _, p0 P1 h3 ?4 G6 I
- #include <mach/irqs.h> C) H! q' t: x# m
- #include <asm/hardware/edma.h>8 c5 r1 S4 C! _
- 0 a6 m7 P" {# |* @; h5 c9 o# P9 e; K+ d
- #undef EDMA3_DEBUG
4 h. A9 w* T U0 Q7 e - /*#define EDMA3_DEBUG*/5 I; f( n; |) B- Y% \6 V2 l
+ r, s+ U X# Y! `# F- Z4 m- #ifdef EDMA3_DEBUG% Y c$ v' r, [- U9 }% b3 h- N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! @- `. M2 N2 Z3 z& S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 e! q# r P# V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' K) N! O5 k9 P& _! k& _
- #else
! ], ~/ M, b7 x5 X4 l+ H1 ] - #define DMA_PRINTK( x... )) `# q! e5 n6 }
- #define DMA_FN_IN* j. \& U: G3 U& [. J0 r2 B$ Q
- #define DMA_FN_OUT
U" k5 T2 U, G; h4 H7 f - #endif1 u4 H' x6 W$ ^. x! S3 D8 N t8 q
! L* x; f0 z* {0 ]! B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 u! P* J' ~* \) p$ v- ~
- #define STATIC_SHIFT 3
- ]5 ?9 K+ R* o" v( i4 D# r - #define TCINTEN_SHIFT 204 y8 ]; V9 z8 e( P4 ^% m
- #define ITCINTEN_SHIFT 21
7 A% _, k7 E: @9 M& K7 F2 R - #define TCCHEN_SHIFT 227 A; P# d$ ]) i0 b5 d" N! N
- #define ITCCHEN_SHIFT 23
) g* {9 p' @ x- |# ^# k
. o+ p, [8 L4 C9 P5 M+ d4 i- static volatile int irqraised1 = 0;
" r9 W2 I+ {6 I' _( Y; p; y4 K - static volatile int irqraised2 = 0;
5 O0 s z1 B" o4 D/ y, [
% _6 M5 v9 w, P8 {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 R3 B4 T7 n% ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 x6 _8 k6 a# C2 y/ _5 h0 q3 J' B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); r* k, F1 J7 I$ G+ A8 g2 U
- 2 e, v5 V$ x# t' F
- dma_addr_t dmaphyssrc1 = 0;: N! U O5 T1 i0 ?& x1 X7 b- n9 p
- dma_addr_t dmaphyssrc2 = 0;
$ e; P8 _7 [5 v4 l* J/ |$ s - dma_addr_t dmaphysdest1 = 0;
8 w9 C: N6 R# A - dma_addr_t dmaphysdest2 = 0;0 r/ A+ _% C) I
- 9 M& P7 @- h3 Q; n
- char *dmabufsrc1 = NULL;
P2 W# [/ i; k6 T" y( x - char *dmabufsrc2 = NULL;* v6 D* h0 E% h7 v4 j
- char *dmabufdest1 = NULL;- `1 U: }' \& i, s: w
- char *dmabufdest2 = NULL;5 H. Z9 J' c1 B6 O; b( m; u
- ! H+ V- T, D: a+ d0 x4 O
- static int acnt = 512;# z: t D# Z9 Q
- static int bcnt = 8;
: b# C$ b" y. w7 ]: |" X# e - static int ccnt = 8;
- q i2 \$ \/ d. G! e
% H. h1 X& v& D9 t7 [, M' D2 Q- module_param(acnt, int, S_IRUGO);, y! |- c/ u1 B& N- M
- module_param(bcnt, int, S_IRUGO);$ r( V7 y$ @9 M; z1 s- W' z( a
- module_param(ccnt, int, S_IRUGO);
复制代码
) q% g3 u2 K/ h3 ]. b3 Z' w# v; F" t; D) W, [+ n3 S8 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 W" ^. B/ N) x0 b. b; Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. I \6 L& W9 h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* N& ` N& n2 Y8 T2 Z' K5 E5 i
( q2 \/ i4 q# E3 m5 E, f9 J# }! |. D7 z. r
|
|