|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / i1 s5 z! G8 T, }, t
- [code]EDMA sample test application
: J7 @. w% J9 V: G% W/ V5 V - /*
8 k2 n C- U3 Z. G2 ? - * edma_test.c3 {: b$ d9 M0 J$ k I/ ]4 M
- *
7 j9 S) \& k% Z+ [! k8 H - * brief EDMA3 Test Application
8 a4 S+ K. T1 {2 Y0 a - *
2 q. W$ C: K4 ~5 H8 o) { - * This file contains EDMA3 Test code., H% F; O- b) @
- *! a$ Q7 S8 A6 L+ ?# n$ L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 A5 W5 ?% w4 u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) X3 u( v* Y( C+ b, x8 ]* d( u
- * TO CHANGE.
) X) q, E3 [6 t4 q. ?4 I4 _' t - *
. N! K* a9 \6 l' O& \" w9 w# ?7 ]- S" ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 G& z) P2 o4 ?/ p0 v- a# _ - * \" g( m+ o, I5 Q. o
- * This program is free software; you can redistribute it and/or
8 ?6 h& J* ]6 c! q6 n, z - * modify it under the terms of the GNU General Public License as
) j/ O& H+ d% Q% p/ i6 H - * published by the Free Software Foundation version 2.. S% d" v1 G' J9 F' J
- *$ a- C g3 P# [( |( o; H" x/ ]8 r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 X- Z! Y$ S( \! H( v% ` - * kind, whether express or implied; without even the implied warranty
! V' l' x' ~- E5 Y* b) ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 u/ V, Q' I9 C/ G1 |. j
- * GNU General Public License for more details.8 A/ b" v% ?% }! d0 J2 Y1 r) C
- */
# _! J% v. {# ? S" y
0 r1 F. U# N; |- #include <linux/module.h>& n) D' @+ V. j! G6 B
- #include <linux/init.h>6 [/ J0 l% k0 R- O0 o8 b3 J
- #include <linux/errno.h>2 s5 R# G- Y) l8 U7 _% R. Y
- #include <linux/types.h>) y) B" U$ ]7 r: i: r4 H
- #include <linux/interrupt.h>( u2 c& V7 ~1 I* Y* x* x8 W) k
- #include <asm/io.h>0 a, x1 W, V1 q' m
- #include <linux/moduleparam.h>
# U6 I; H; D# w6 P" x# n* B - #include <linux/sysctl.h>( R1 s1 E2 Q: L/ K1 b) p
- #include <linux/mm.h>0 o0 c8 \* M. e. Q' k
- #include <linux/dma-mapping.h>* b' A& f( a, H5 G% o
- / A5 \7 a' R0 ~5 }
- #include <mach/memory.h>& }8 W' R2 I' R o7 n8 ^$ r' N- G
- #include <mach/hardware.h>( c% Q+ `4 i2 X) \
- #include <mach/irqs.h>- P0 Q: v/ T$ b& B9 `) }
- #include <asm/hardware/edma.h>( F# T( {' Y- c6 ]. x) N+ f E4 H
- / B+ N; T5 q3 w
- #undef EDMA3_DEBUG
3 n3 u( t$ t0 y: H" F; t - /*#define EDMA3_DEBUG*/
* C# R6 J& U- P4 [8 e - : a; d) s; s( F' U1 l5 z
- #ifdef EDMA3_DEBUG
9 g m/ R! E& ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), g# ~/ s1 a ~7 e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- V) k! o/ j+ o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 c9 x; v) O3 \1 S: z# u - #else, T# C7 ^# n8 T3 G4 ^9 Z
- #define DMA_PRINTK( x... )
; w, A, h O0 ^$ t! _ t - #define DMA_FN_IN
. q3 {& u( ]* Q0 r; K2 D - #define DMA_FN_OUT
% n6 X+ F3 [1 Q - #endif
1 C" K; U, w9 } - ' _5 z$ k% t* e! K. \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 D% c! U! X4 l9 `2 V9 r, L+ U - #define STATIC_SHIFT 3: J. k, y& \, H/ X* @, j4 a
- #define TCINTEN_SHIFT 20; z* P- k; l2 X6 {1 T6 Z+ c* s& s, c
- #define ITCINTEN_SHIFT 21( P) t" ]3 Y- l- `& N- ]
- #define TCCHEN_SHIFT 22& h! J. S# ~9 d& u- t, X
- #define ITCCHEN_SHIFT 23# X8 h' ~- k4 J$ q, H
1 d5 _; S! R1 ^% I! s. T& J- static volatile int irqraised1 = 0;( k$ n3 M* h1 x5 ?
- static volatile int irqraised2 = 0;$ w8 u5 A5 K# {- P+ s7 G" w4 d9 |% C
+ u u5 t4 e0 s4 g4 z' r. P& b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: P8 T6 i/ l8 ]/ z h1 ^ j7 @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, o9 a$ v0 ?) j3 `" a* U, g$ m# h8 h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 n1 m2 z5 R; [$ A U8 P7 I
- . |4 M& J- i( p2 |: C
- dma_addr_t dmaphyssrc1 = 0;% d4 E# V( ?% T9 t% }9 Y" c+ ?
- dma_addr_t dmaphyssrc2 = 0;
) X, Q. v+ ^/ R2 n% N - dma_addr_t dmaphysdest1 = 0;
+ z5 V! V. k6 F G - dma_addr_t dmaphysdest2 = 0;
4 x- A' Q; r; e3 r$ j - ; m5 U' u& [2 T. @1 U; S0 b
- char *dmabufsrc1 = NULL;2 Z% a, V) a, u
- char *dmabufsrc2 = NULL;7 D! F( F) Z- p6 j
- char *dmabufdest1 = NULL;
4 z4 r, y4 Z: A% ^ - char *dmabufdest2 = NULL;2 F) b; _2 l1 C j) f9 S
. U1 W1 H! I' R- s- static int acnt = 512;. I/ m T* h( Z. [7 p2 P9 e
- static int bcnt = 8;
7 R$ G& ~) Z5 B - static int ccnt = 8;
$ C/ ]: \1 @9 ^) M/ x
2 C0 }* G: H* P& O- M5 y" a- module_param(acnt, int, S_IRUGO);+ h, u: @' S/ U8 g+ |8 m
- module_param(bcnt, int, S_IRUGO);
! S, B8 e5 v" W* W - module_param(ccnt, int, S_IRUGO);
复制代码
; W0 ^9 J5 K; n4 U3 x! }& e, s8 o
p9 R3 x$ K2 @$ ^6 o3 Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ]+ M3 z! ~' earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 v8 i) L% H8 ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 j7 j! S7 W2 t
9 W) d* ]) A- _2 y/ V1 x; y+ r& j- X& }3 ]
|
|