|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " D- L2 G4 R4 ?" Z( U; t+ W
- [code]EDMA sample test application o" G) ?! D/ X2 F# W
- /*
' ^8 F1 a; h: x8 ~4 K - * edma_test.c
, r5 p, n" U2 t0 S' T - *3 ]. c0 y$ E) q) l
- * brief EDMA3 Test Application
0 B6 d y( t& S8 Z; H" w% Q& ^( g - *) c4 t6 G: F; ~) s9 t9 S9 }
- * This file contains EDMA3 Test code.
; c: V4 l" @) n& B$ g - *( V! B/ p* x7 s: D6 K6 O& q1 K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 R8 ^& A* p# ?- W0 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. m, S+ y( D7 ~+ y" l. M# ^6 c x
- * TO CHANGE.
, Y8 O1 c ]6 [ - *( g; N" Q+ u2 I$ Y0 {% x! J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. \ H9 a4 U9 m9 d# P - *
7 q1 T. t8 K9 H: [% O& o - * This program is free software; you can redistribute it and/or9 i z9 D2 B, ?7 d6 Q4 ~ p6 e
- * modify it under the terms of the GNU General Public License as
0 E2 i: x9 n5 u+ f# @ - * published by the Free Software Foundation version 2.
# f* b( Y( ?; |* _ - *
, ?; i+ l* H# j$ d1 |. w9 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% f/ b# Q9 J. L/ n
- * kind, whether express or implied; without even the implied warranty
* X3 O0 _0 c% O* _; N+ T+ N3 e. o/ U, | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ S: |* e/ |. c8 }% e4 G7 K5 [ - * GNU General Public License for more details.. h4 C7 `( w, `/ |: P
- */
( ^3 V* ?" b) P; B( @
0 Z, h4 W3 C1 I5 j- #include <linux/module.h>
o6 m" v. d4 ~2 N - #include <linux/init.h>
! F% j& j+ J: F9 H U' { - #include <linux/errno.h>* g1 G5 y0 `* w; _0 l7 @% H7 K
- #include <linux/types.h>
& F4 T w/ ]* s( P* D - #include <linux/interrupt.h>
& t. W7 S: Y3 d5 H9 s% F. C - #include <asm/io.h>1 w) z1 P3 }" l5 i5 `$ M! s* u/ a
- #include <linux/moduleparam.h>3 _5 U8 o4 w0 c' m) \% ]
- #include <linux/sysctl.h>
! }( y' ?+ h0 z8 }% N+ e$ C5 ^ - #include <linux/mm.h>
; J- {! M, k& b! j3 `* p - #include <linux/dma-mapping.h>! Q; @: q4 ? e
2 g3 }" l) t) c9 H! D- #include <mach/memory.h>* D# v" N) Y1 n( O4 v3 N$ E7 \
- #include <mach/hardware.h>
) U& Z4 n( d# r R% Q, v% \# V2 H - #include <mach/irqs.h>& ]: s7 i; I! ]/ [* S* \
- #include <asm/hardware/edma.h> r0 F7 I% V* n% Z& F: _
& b. X8 t5 P2 R, i- #undef EDMA3_DEBUG
; a$ C& N; X6 M, @ - /*#define EDMA3_DEBUG*/
n" r$ [( l, A4 d; d( U - - f% P. K8 F5 \' b' U+ b
- #ifdef EDMA3_DEBUG* s- x( }$ ]- r# [2 Z6 o: J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& \& M$ ~! l' ~& D5 O& [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ P) {: q8 W, Q. i3 x+ @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( q8 j, B' _2 U# w/ s: g8 m - #else
5 A- X# H3 w$ Q$ t5 N6 ~4 s+ E+ Y - #define DMA_PRINTK( x... )3 s0 G! M* v( E
- #define DMA_FN_IN- z2 f3 U2 N1 Z( K% u7 H5 W
- #define DMA_FN_OUT0 c, _1 a) n8 o* J8 Z8 ?2 K( O# K. s5 |
- #endif- I6 S, Q4 H9 C) b+ m5 x$ R
- ~2 J. x+ s% K# ?- {. @0 f! |' o5 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' M+ `( ]" x7 n( W2 |/ Z1 J
- #define STATIC_SHIFT 32 c& u" v4 H# @6 l
- #define TCINTEN_SHIFT 20, f) z0 @2 D0 c/ D* _9 w J
- #define ITCINTEN_SHIFT 21
) ]7 h" K1 n* F - #define TCCHEN_SHIFT 220 k- R0 c* M1 k- Z: ]
- #define ITCCHEN_SHIFT 23
; y( [% S5 C9 ^. i+ O - # R# D8 H6 ?' _% J8 [, u' s" n7 H0 [
- static volatile int irqraised1 = 0;' a, u! d' v/ }
- static volatile int irqraised2 = 0; y/ y4 }$ \5 I% Q' o5 w
: ?& m, n! Y @6 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- q6 b* P" x ] U$ C: p5 n6 x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, z$ A" J1 D1 S( f6 l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) @8 i t! r- K" M
: Y/ w; y4 [/ D" c( [$ k# M- dma_addr_t dmaphyssrc1 = 0;
; P" F2 K: N2 u+ i# f Q - dma_addr_t dmaphyssrc2 = 0;6 ?7 [% B- V, o' w
- dma_addr_t dmaphysdest1 = 0;4 z+ G0 s. T" x# O* a
- dma_addr_t dmaphysdest2 = 0;
- P* G' }1 W% S R5 |1 ~) \
# P1 Y% d6 h) C$ v) v- char *dmabufsrc1 = NULL;
% p$ ^2 t7 r1 A5 h9 H" f - char *dmabufsrc2 = NULL;
+ g' X1 t5 a0 a, _; H3 O0 K& A - char *dmabufdest1 = NULL;
& W. Z( L2 a# u# \ - char *dmabufdest2 = NULL;
3 [+ l$ Z4 h. v
- K/ g# Y' B* [, E' @- static int acnt = 512;
8 K5 d5 I' K P - static int bcnt = 8;7 q# y+ F, A1 D; Z& t2 l
- static int ccnt = 8;
5 O- }$ \+ G; J6 o$ S4 d# K - - T' ^% |' @ Q, G; J
- module_param(acnt, int, S_IRUGO);# c% S+ N$ L9 [+ L9 N
- module_param(bcnt, int, S_IRUGO);
: Q, }( c2 W' u( |8 D - module_param(ccnt, int, S_IRUGO);
复制代码
5 f) z. G& E% O, H0 S: E! r, F) D7 b" I! ~! K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* a. P( P5 d& X0 y% A! p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 e$ @$ y& ^3 w0 i# l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 ~0 P I1 X7 g5 G
" F4 v% Y; d+ h* A- f4 K1 w; \
5 z8 n: v9 H* N( N6 a/ I5 M" A
|
|