|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 B% s( Q6 X6 j
- [code]EDMA sample test application
; C9 v- }0 N3 G! L$ g - /*' `" J Q% P8 }9 C6 b
- * edma_test.c' g6 \. ]/ E' `& g
- *
. p) ?9 }" y) s( Y - * brief EDMA3 Test Application
5 P* o+ n- K% n# F - */ P* X0 J2 e) H. d" q+ }
- * This file contains EDMA3 Test code.3 j" k w2 r8 ]: q. g; G c
- *3 S9 f! g" t& _% G: C1 X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* x3 d' j1 Z( @- q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 u0 Y _" u8 C: Y9 Z& f" y - * TO CHANGE.0 t2 r; r5 J D/ e
- *
% p1 a7 E0 l9 s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 f9 r) Y" d0 [" ?7 q7 x: ~ - *
0 |( A: O6 y" F0 w9 p! n - * This program is free software; you can redistribute it and/or
, Q s3 h: {6 _- t* C, \" A - * modify it under the terms of the GNU General Public License as. z1 \# q! U+ b) I0 X1 a
- * published by the Free Software Foundation version 2.
\- J' I. h' t/ | - *1 R4 t/ p4 g$ H8 q% B6 ?% G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( R* J" E; a2 D O1 ~8 ~" m# g/ M" y - * kind, whether express or implied; without even the implied warranty- d# z* y% r. E; ]) A6 x, D7 ^' {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% x- B- d8 p H6 J1 f
- * GNU General Public License for more details.' X/ m. e# J" N; [: T4 O5 M' w
- */
& k+ O m. ^, J+ c- w( q
! b+ T7 J/ @9 C" G; S3 q5 x9 p- #include <linux/module.h>, i6 i$ [9 Y; h% q) F
- #include <linux/init.h>
5 ]8 s$ P3 @3 _' s, q2 I# {, f0 C - #include <linux/errno.h>
: s3 H+ e. \. g8 p2 F& j, Q1 p - #include <linux/types.h>
4 d3 I" G; T0 h0 r. S - #include <linux/interrupt.h>5 [* b+ z' i0 T% c
- #include <asm/io.h>5 z% Z! C P* ~2 `* T( B: U- l
- #include <linux/moduleparam.h>6 S+ O* f1 M- B" R4 K. q
- #include <linux/sysctl.h>
" F4 d b( F; \# T' B - #include <linux/mm.h>7 @+ T6 l% P3 Q* y! \% ^* t# y
- #include <linux/dma-mapping.h>
* g4 N6 n% f7 D/ X& g
" k& D! a" g. D) I0 [% S6 `- #include <mach/memory.h>
" Q6 q+ M2 T3 y+ J( B - #include <mach/hardware.h>
' I* x# p3 [4 U# ~# u/ v$ V - #include <mach/irqs.h>6 r& w' f# S& _3 `
- #include <asm/hardware/edma.h>
( z$ H# O. |8 `) ]: A6 k+ o - 7 a! t2 M, H/ R2 h* P
- #undef EDMA3_DEBUG$ {$ t1 k; V& d2 |2 N$ |3 I8 ?
- /*#define EDMA3_DEBUG*/
# Y( w8 U% f# R$ ]8 e - I: i2 C- Y6 J$ t1 m/ j
- #ifdef EDMA3_DEBUG L8 }4 _: A4 ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% V+ B6 J4 z) S# V/ h7 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" M6 p. N p6 q3 l! ^5 ~2 C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! g8 m, M$ A" f' A$ a! r/ s - #else( F. U8 c( P7 f7 J( P
- #define DMA_PRINTK( x... )
" d- S c) ]! @6 h& H% Y! F4 V- @ - #define DMA_FN_IN
9 `0 y5 m6 c8 J2 R6 x/ Y - #define DMA_FN_OUT
; S* ?$ \" E# K - #endif
9 F- Y( E; U, c& \9 y - , D. `' ]0 t$ o! b; i9 E) [3 a/ _( b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 f( ~, }( @& P2 u9 T# f7 E - #define STATIC_SHIFT 3& G( ?7 b" L* r. A5 k3 `
- #define TCINTEN_SHIFT 20 n3 d, j5 x2 l8 k: [% e9 A
- #define ITCINTEN_SHIFT 21" A# {2 Q0 X) L7 ], Z
- #define TCCHEN_SHIFT 225 \, C. ^2 _" M/ R( j' N! L4 M
- #define ITCCHEN_SHIFT 23
% K- `; O; O( h/ Y# a, Z% o/ d - ( \* Z, @4 `( C9 | A
- static volatile int irqraised1 = 0;, {9 p& t- k3 m5 x9 X" q
- static volatile int irqraised2 = 0;! I8 R+ C+ U/ L/ R1 A" ]
d, E+ a+ n5 m7 ]% y0 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- o6 p. R7 r) V9 A9 D, C9 U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ~/ t" ^) x0 M- L2 ~, Z+ i: w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 E% J5 E2 j/ F5 V3 d9 u7 u
3 x, A/ {: j) y7 q1 r1 @4 Y- dma_addr_t dmaphyssrc1 = 0;
! Z1 J* b# m6 n/ I - dma_addr_t dmaphyssrc2 = 0;7 O$ R: q# B+ w6 s
- dma_addr_t dmaphysdest1 = 0;* |0 Z7 d/ _/ r/ `1 I5 k
- dma_addr_t dmaphysdest2 = 0;; F* ?, y& k5 K3 D1 P
- / N1 P$ o5 [, U7 m& x: ~6 J
- char *dmabufsrc1 = NULL;* f4 r; O" W( s3 E* T5 z, [
- char *dmabufsrc2 = NULL;
: \2 D. D& h. Q5 p' y9 N - char *dmabufdest1 = NULL;
) F, X) P* l: r% d - char *dmabufdest2 = NULL;
1 J3 E, l1 l5 [% ]2 f3 ] - 2 _ J: \! N" [2 _+ \' a
- static int acnt = 512;
- S8 i8 k2 P" M( \ - static int bcnt = 8;
, f; C* q4 ?# [3 K - static int ccnt = 8;6 M3 I) B- [" w
% N. W6 e& }. l% H& w& s& R1 ]- module_param(acnt, int, S_IRUGO);
. J- p9 ?+ i: _. B& n - module_param(bcnt, int, S_IRUGO);
! K! {; ?/ a" H/ ^; R+ o- p - module_param(ccnt, int, S_IRUGO);
复制代码 * Y2 D* s5 v& p
; K( K7 c9 M9 V# W0 l. d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 S; ^2 X) o$ ] J: A* H8 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 @# J/ V+ v7 O; Q& ?8 m4 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 y! `3 E6 D1 b6 V7 v! X, X, S. A9 {3 l& a
+ j7 W1 \ q4 s* \/ `5 ~" g
|
|