|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
t2 A* k* Q7 H D) R- [code]EDMA sample test application
( v6 t# R3 R; m - /*
5 n( O$ J8 [1 [7 c( a - * edma_test.c
6 R! h- h: _) D1 U - *
* T3 Z6 Z8 X: t8 Z, Q( T: R - * brief EDMA3 Test Application
6 L- |$ [0 J0 ^5 U# H8 T - *
* @7 i ?, Z0 q2 a" ?: O" n6 [ - * This file contains EDMA3 Test code.+ F$ d2 E& g! A ^1 K9 p
- *
4 w/ x: M" F+ f7 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 e$ L1 m' a }/ U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) D5 B* w* j$ C5 R - * TO CHANGE.& T1 i1 z4 Q0 }6 u$ ?
- *
? }% p+ g( p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 A2 D N' q3 K+ e- W4 A - *
8 o9 Y1 A7 H0 U; `% G4 T3 h - * This program is free software; you can redistribute it and/or8 A: L+ O/ o, e) y
- * modify it under the terms of the GNU General Public License as
" ]! M0 |4 H# o8 `% [ - * published by the Free Software Foundation version 2.2 `! c5 C5 o+ W4 h: D; p& g1 C
- *
! f. Q+ c6 J) i, E2 C3 u& v/ f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ q& r) i% V- J - * kind, whether express or implied; without even the implied warranty
& _) G4 E+ [$ [: x: Z2 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! k! M1 h/ m/ G9 Q4 y" P
- * GNU General Public License for more details.
( I! g2 G$ P% m - */
- x4 j4 b. G7 d& K% v- T
9 o/ A' q N- M- #include <linux/module.h>3 }% l$ z+ \1 o1 B7 u2 e
- #include <linux/init.h>! x2 D0 H# G1 p
- #include <linux/errno.h>. ~+ l2 ^' ?0 a
- #include <linux/types.h>1 \8 t5 j$ a4 \
- #include <linux/interrupt.h>% W- g5 w4 t. R
- #include <asm/io.h>& @4 U: K0 e( z. l
- #include <linux/moduleparam.h>; ~3 x' J" X% C% \8 [2 [ d- s
- #include <linux/sysctl.h>/ j( c1 y* g) q3 W- c
- #include <linux/mm.h>& J5 F2 D* }8 T9 O, X2 Q
- #include <linux/dma-mapping.h>
& v1 X' s- r% V% f2 G) `) d) P/ j
* n* s0 g0 _# X- #include <mach/memory.h>
# c- j* s) D2 ^ - #include <mach/hardware.h>) _6 D7 U1 d5 K: p; d3 r
- #include <mach/irqs.h>$ |. _- N4 O3 ]4 D
- #include <asm/hardware/edma.h>
G) c7 ]8 n' W' C# f0 r3 B1 Y2 P - : O$ p* @" B0 u/ P8 a8 p3 y ~
- #undef EDMA3_DEBUG
6 c# p5 u" R' B+ H! Y( Y - /*#define EDMA3_DEBUG*/( G2 i n- i- [, a! e. _
^) a6 @& @6 }* |7 s2 W- #ifdef EDMA3_DEBUG% F, F8 Z, ]# H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 R J4 z4 L& `& R) K, G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. Y8 R, z! W* o. j, s! ?: Z+ }, m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# r$ X( l# A( w7 q( y
- #else
8 `8 S) }* y! ~- L& O& [ - #define DMA_PRINTK( x... )
8 S# _4 f6 G8 G3 w - #define DMA_FN_IN
5 W* R' \% v* x4 N; k/ D - #define DMA_FN_OUT: D. O+ \" a' C
- #endif( ?0 \7 L4 k( @2 a
5 }% t: W3 h/ ]4 i, c4 `$ T; {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 G. x7 R: r- w8 n# r - #define STATIC_SHIFT 3) M) r9 G5 k4 e, ^ }; G8 [
- #define TCINTEN_SHIFT 20$ x* p8 y5 b5 i
- #define ITCINTEN_SHIFT 21
" R. y& S# I2 l6 v$ S1 C/ b, I - #define TCCHEN_SHIFT 22& b9 C7 ^5 I0 l$ N) _
- #define ITCCHEN_SHIFT 23, A) z1 L$ @4 u/ _
- 0 j0 D2 V& A2 Q/ n5 j& ^9 s3 r
- static volatile int irqraised1 = 0;1 j5 ~$ Z3 b. h5 v
- static volatile int irqraised2 = 0;% l; P- L! D& |
3 J! }& e, D: J2 L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" E% R- R) C* J& d Q/ F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) K6 @0 Z0 u0 y4 t; r! o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( k( `9 d+ g' g& m" @( j
* k9 f7 k" Q7 c: {- dma_addr_t dmaphyssrc1 = 0;0 ]$ ~) _" D6 U! M, y
- dma_addr_t dmaphyssrc2 = 0;) K' k# Y) A$ B: m1 u5 p% e
- dma_addr_t dmaphysdest1 = 0;/ h, y* x+ A3 m3 ~* O; Z7 d
- dma_addr_t dmaphysdest2 = 0;
4 q5 Z3 H# S! f7 A, t% Y! l! Q4 D8 @ - ) c0 X1 f6 T4 I' X: ^2 R
- char *dmabufsrc1 = NULL;! G) L3 _' O8 ]* g5 X& L
- char *dmabufsrc2 = NULL;
8 R6 X7 n: R6 \ - char *dmabufdest1 = NULL;/ s) C! ]; r$ [ W' Z2 v
- char *dmabufdest2 = NULL;6 C# X9 _' a8 T. C% @
- " Z& U' {4 a0 k Y+ j1 _
- static int acnt = 512;2 h5 @4 _0 \- B: u2 c8 T! C# r" ^
- static int bcnt = 8;
2 p, f. i2 V9 i# X/ E% |) d - static int ccnt = 8;
! r) ~' c7 ^6 c - - X$ h) t, a1 z, @
- module_param(acnt, int, S_IRUGO);2 E& p+ |+ m6 r4 ^9 w
- module_param(bcnt, int, S_IRUGO);
* L4 _6 |: r' N. c" L/ A7 l4 a' i6 l - module_param(ccnt, int, S_IRUGO);
复制代码
- ^+ K" n ]$ Z! M+ j) \/ c0 @5 v& o
- Z3 ?: n4 {0 G" g1 Z: I* p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* n* |+ v& N* M! k/ Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 S& |' M2 @$ A4 e3 E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 V# B6 C$ R/ J) I3 c' y
$ }, ?* N. @/ N3 x, _! g0 M& i% d7 R) R% ?
|
|