|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
h# u0 H# Y7 T/ m- [code]EDMA sample test application6 R2 ~& u% q* T
- /*
. K- \) v' @$ v( N8 `6 J5 p3 ~ - * edma_test.c
0 F; {( g9 z. Q8 ? - *- y, T4 m6 `! s$ M& G
- * brief EDMA3 Test Application3 p$ T q5 O1 {' |$ s# f
- *
3 K( m; [: }4 W) ~ - * This file contains EDMA3 Test code.' S; P/ O# W9 P" q
- *
) j' p9 C& v. v" N$ k- B* w* u' R8 k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& A1 q3 V5 T% Q% K1 \: e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 I. L- G6 J, ?, ]' {1 U5 J
- * TO CHANGE.
# G( c: F) J$ n/ [# r& ~. k3 P" r - *
# P1 J4 E2 v3 K; T3 ?. A% q L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 ]) L9 X, x6 u; g5 \& k: F& E - *& y; q7 ?, H6 g7 h" a0 R
- * This program is free software; you can redistribute it and/or) I/ r0 {. d6 ~! o
- * modify it under the terms of the GNU General Public License as
% j) _$ U6 }+ F9 {4 o$ p - * published by the Free Software Foundation version 2.+ a! c6 t1 _: D5 |( a y) v/ J+ X- O3 g
- *
' s4 n; o* E) l/ x H( d+ S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# D6 F% ?. x: E r: \" ^: S
- * kind, whether express or implied; without even the implied warranty( z; u: P9 E' k a8 s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ ^1 { V6 S4 W7 w2 [
- * GNU General Public License for more details.
4 v1 z) \& j( C5 V# S - */
; q# r# F+ U" H! ~/ M. G - + C2 r* l% Q. y, C" ^" C& f# Z
- #include <linux/module.h>
' l2 N% @5 ?8 ]# j. Q- h5 x; r - #include <linux/init.h>$ Q4 O9 c- A8 E& p0 l# o2 v
- #include <linux/errno.h>) a2 I. S' V* H# d1 N7 ]
- #include <linux/types.h>; J5 U9 ?# U( K5 H' Z3 C
- #include <linux/interrupt.h>0 Z/ {2 A& b X+ f# M* T8 B5 Q4 O
- #include <asm/io.h>( K( n* i9 @, g
- #include <linux/moduleparam.h>
. X; O% M4 L' W+ o- W/ Y( {$ b - #include <linux/sysctl.h>
+ n, ?4 |6 z2 o0 R$ b - #include <linux/mm.h>5 L2 a/ f& y* M& w" n5 v5 ^% v3 Y: H
- #include <linux/dma-mapping.h>
9 o6 D5 Q. b2 t5 W7 z% Z) {
$ l2 a6 F# R5 X" _- #include <mach/memory.h>4 _% L9 F U4 J: I1 _
- #include <mach/hardware.h>
+ R" Q+ n& t$ M& K" X9 \. b - #include <mach/irqs.h>
7 n6 c p( D! }4 m - #include <asm/hardware/edma.h>
! k) S( r% K- n4 l
l/ b, n' O9 r' u; ~ r- #undef EDMA3_DEBUG. X: c [6 n) o5 {. S& q# q3 C
- /*#define EDMA3_DEBUG*/
4 c) Q& v! l: u0 W0 \' c - % k' f0 ^/ U, G/ v
- #ifdef EDMA3_DEBUG, T$ F) u; v( g" P$ ]8 I$ @8 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ h+ L1 \. a" u2 B6 { H! \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" h- n( v0 K) C$ F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% r6 X5 m9 A% d$ Y' C) u - #else
) B* X# b! ?- V+ X/ L' r - #define DMA_PRINTK( x... )9 c( Q( d3 O w7 f3 d7 \9 N: S
- #define DMA_FN_IN% B6 L W" z2 Q
- #define DMA_FN_OUT# A9 D; E* D* ?$ |# \
- #endif
. x# ~+ \ Q8 Y0 F - 5 S8 U* M( b d4 s( p; B1 Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( \& `% z$ @6 n, I5 J6 W6 b
- #define STATIC_SHIFT 3
* }) e- V/ M- a0 b8 _" Q/ Q - #define TCINTEN_SHIFT 20
- P% e% _4 ?; T0 L* j. F - #define ITCINTEN_SHIFT 21
. w0 z6 s" H" q7 T - #define TCCHEN_SHIFT 22
, Z3 Q" Q' z( y. ? - #define ITCCHEN_SHIFT 231 u' J) F% h% R7 } w
- v& W5 ?$ e0 t3 l$ R9 j6 a
- static volatile int irqraised1 = 0;4 j& P. x3 G. y. q- p; V' O
- static volatile int irqraised2 = 0;8 N R* ~2 F3 g/ m! i9 }9 ~- l8 B7 C
' ` L/ I9 v2 C: i: y0 x, y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 w8 B/ h. S, r* f( A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m0 _+ @( L8 n$ |2 a- \: l b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* n, z3 P# ^9 Y7 o6 b/ l
: c# u. M$ \* k `6 g' v- dma_addr_t dmaphyssrc1 = 0; U2 J X+ @# C
- dma_addr_t dmaphyssrc2 = 0;; R( `- Y6 X+ J7 m
- dma_addr_t dmaphysdest1 = 0;1 x; R. V1 X+ R
- dma_addr_t dmaphysdest2 = 0;
5 X& O- U8 u8 A8 {& A* z
* h5 m1 A' |+ T. e6 U+ J- char *dmabufsrc1 = NULL;* `" {, c) q0 l
- char *dmabufsrc2 = NULL;
, L" w, Y* Y) ^. E - char *dmabufdest1 = NULL;
7 X- w: m6 {& p8 V0 \ - char *dmabufdest2 = NULL;0 U6 W: Q/ Q, H+ q) k
- 1 i" U9 J" u* G }% [9 g0 ~1 Q
- static int acnt = 512;& B7 U- A( [3 P8 ]& s: Y$ i
- static int bcnt = 8;+ S D9 R) s' ^/ U W8 r
- static int ccnt = 8;
" ^) w2 x, b6 h& E( R$ d1 t - " X% {0 k3 A3 O" t) @& u
- module_param(acnt, int, S_IRUGO);, f U6 k6 Y8 a* ~1 q
- module_param(bcnt, int, S_IRUGO);" ` j( |) y D0 I
- module_param(ccnt, int, S_IRUGO);
复制代码
8 E! Y+ m8 V* j
+ ]/ m) i) F A# J7 t0 |* _- e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ~0 [5 A/ g6 V& k5 B- w# narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) S. G7 T) v4 i$ X5 { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 N. d$ P8 n, j6 N4 z% ^) t2 W0 t
8 u3 H. j) U. C/ }8 x5 c3 }
|
|