|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 z3 n# L- n7 |4 R+ ?2 d
- [code]EDMA sample test application! z5 p9 C0 O @+ J
- /*+ F4 Q+ a8 t" P4 k9 f' f! C! V) E
- * edma_test.c
* y( G1 B! h% z4 t - *
# s9 h, u g, U5 G1 ^7 S' y - * brief EDMA3 Test Application' y+ l1 q2 B% Q! C1 I
- *
* e t5 H9 @$ z - * This file contains EDMA3 Test code.& t. T" w! J; a
- *
" J3 c0 J1 S; }" \- k; c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# |* }4 Q: m; I2 [$ r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% E, |4 ]' d7 r6 E, e# H - * TO CHANGE.+ w2 u: i; a2 [
- *
( N3 ]# q$ |! D' H' Y* Z4 t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% p" u# O: E0 P: a* |
- *
. H; n5 u2 {; Y; N - * This program is free software; you can redistribute it and/or: B( M$ V% s' C; {, J" `. z6 d' X) M
- * modify it under the terms of the GNU General Public License as
& x% m8 c8 i3 d* Z9 S, `& p& { - * published by the Free Software Foundation version 2.
3 J2 z4 Q8 g5 a1 a - *
4 k" U- P4 v! r4 y- Y- { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* i, U+ {' _* N0 ?2 Z - * kind, whether express or implied; without even the implied warranty3 v( L% j! l! W$ Y" j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, u [$ {- i/ F0 |) M( ^2 a9 N5 Z- n, l - * GNU General Public License for more details.
9 l4 r) C; p7 P7 q- k) y - */
) S7 ?! L* ]" O7 c$ i5 k: c
4 x! m& C, Q5 D- #include <linux/module.h>
" Z2 d/ v) w& l+ A& ~9 P0 }9 i - #include <linux/init.h>% p3 [) B- @0 R! X
- #include <linux/errno.h>; z: d& @1 P: h# ~& [# N/ S
- #include <linux/types.h>% L h- X6 {4 W& B% W5 _
- #include <linux/interrupt.h>! j: A7 r2 I8 l% S
- #include <asm/io.h>' [+ J" u, V9 l# [
- #include <linux/moduleparam.h>
! P* n; R* x$ H \5 ?, @ - #include <linux/sysctl.h>
( r% T3 Z* j( b3 [( t - #include <linux/mm.h>
0 M V2 _% r* G/ O& L - #include <linux/dma-mapping.h>. v/ n9 ]: Z4 h) V: \2 ^
- 7 ~! l" M8 K% u
- #include <mach/memory.h>
. ^5 j% }$ P2 R! z3 [ - #include <mach/hardware.h>
7 N9 H5 D9 d) d3 D+ a - #include <mach/irqs.h>( q. I5 k. _8 y; L
- #include <asm/hardware/edma.h>& D+ c1 L7 y1 Z, q) _! I$ `
1 D$ X& ]- j% M3 p. c8 M9 }- #undef EDMA3_DEBUG& b x2 A; r; z5 T
- /*#define EDMA3_DEBUG*/) x7 t; Z, q' E0 n4 b" { f( y( E
- 4 i5 v+ J7 A* x! B* @+ E
- #ifdef EDMA3_DEBUG" o( k. R- ~4 B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). O0 ]6 ]! V9 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% e% b8 y W2 F+ A, [% Z" b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; _# l! f( m# N/ |. d - #else
7 j0 D% V# m! t. L+ D. e - #define DMA_PRINTK( x... )' A* U* g' I c9 J) r
- #define DMA_FN_IN
- a) @; t* }; V: Y2 M - #define DMA_FN_OUT
" C+ c) f8 }* c7 {+ I" h3 D - #endif
2 L" j, B0 N0 ~" V3 I. K
3 [2 n/ O6 |) m3 F `) G% X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; M: d2 ?* W+ f( m* W - #define STATIC_SHIFT 3
" t! Q( k: [0 i. F1 s - #define TCINTEN_SHIFT 20/ J$ T, w# e9 b; F
- #define ITCINTEN_SHIFT 21' p; o/ O6 U. b% ]/ H! l7 r
- #define TCCHEN_SHIFT 22! l0 m7 y: x6 N" B2 O+ m9 J* C
- #define ITCCHEN_SHIFT 23
A. }# G W' ` - 6 Q3 |, a! y: V+ ]' t
- static volatile int irqraised1 = 0;, Z# D, {$ |6 g4 V
- static volatile int irqraised2 = 0;. f8 a5 E( T% h5 q' S2 g' F, T
- 4 [% `5 _' w8 E! H4 n/ D2 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 g7 m- d7 S$ O2 D; n6 o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. M# u& a, e T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. d, c4 v. O4 f
- / i% m8 a' ^9 }0 _2 y, H2 \: l
- dma_addr_t dmaphyssrc1 = 0;
- A9 N/ |) g% R. s - dma_addr_t dmaphyssrc2 = 0;
6 B$ p: U; w1 z" W G& r, j" V - dma_addr_t dmaphysdest1 = 0;
- u8 W; M3 \% ~$ k - dma_addr_t dmaphysdest2 = 0;, n$ w4 F' X+ e( F. l( F0 t g6 }
8 D1 j+ X! ^4 g: H- char *dmabufsrc1 = NULL;
/ Q! @, W; v# s' v# h - char *dmabufsrc2 = NULL;! r! J7 S [) _' Q0 X: c
- char *dmabufdest1 = NULL;6 F4 u% I5 ?2 J1 G* l! f
- char *dmabufdest2 = NULL;. h# n1 j7 ~( l$ W3 o
6 v3 w% M% h. Z+ a: g- static int acnt = 512;0 T2 I7 {2 u2 O r+ ^( o' E
- static int bcnt = 8;$ `2 X+ L" M4 C$ P' @
- static int ccnt = 8;2 ?( ^# e3 Q, N! `: [- ^' R6 k
- j0 G$ }, {( u$ e
- module_param(acnt, int, S_IRUGO);
' A' v& }' H# ]" v - module_param(bcnt, int, S_IRUGO);
7 y: \6 B* V; Q) N" I - module_param(ccnt, int, S_IRUGO);
复制代码 * j: O6 Y J) L, ], q! A5 o+ A
' q3 f4 {; g1 ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ A# ]+ X) P& C4 _9 m _4 [4 [( k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- W7 u; L8 q S! {. L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; ]+ j1 H0 |1 p; P& O; ]! G- U' V" L/ M! H" ?
9 N* v# H/ E1 I* v |
|