|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , w+ n6 R5 e+ M9 m' {
- [code]EDMA sample test application+ N- I7 Q$ @9 ~0 A+ ^1 C
- /*
/ ^& M0 O7 u$ f- \! Y - * edma_test.c1 u- f6 {0 |4 [' m
- *
! K9 e6 u7 [0 x' j4 ~ - * brief EDMA3 Test Application1 M. z" [/ Y, B" {! ^% V
- *3 y$ i+ E" c* Q* Q# Y
- * This file contains EDMA3 Test code.
7 P( c/ D( e$ Q3 P6 d - *
, I/ F2 i8 M1 l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, l1 j: T1 e% X% Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 g9 B( y3 a; {! \ R: z - * TO CHANGE.
9 b! ~% G; {, q - ** l9 E1 A3 r1 u( F1 @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" ?+ C+ O/ Z1 P/ M
- *) S; X; }$ z. Y( e* ]7 j/ g' A
- * This program is free software; you can redistribute it and/or
: m0 {; m( l: J1 [, t - * modify it under the terms of the GNU General Public License as5 j( J6 Z8 G% q
- * published by the Free Software Foundation version 2.$ I' T* g) u" ^. `
- *
* r' t% q5 D/ l! c( w" n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" }4 w8 T' P/ s( N4 k
- * kind, whether express or implied; without even the implied warranty
9 D/ C; R7 h8 a. p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" Y1 W+ v& ]0 H3 Z# e
- * GNU General Public License for more details. T6 J$ m' H+ P! x
- */0 W* w& M$ E; b( m
- ( C \+ q# ?" H. R. ~; f& {3 ~
- #include <linux/module.h>& |+ {- d2 n6 t" ~6 d; b1 a
- #include <linux/init.h>0 ~) o7 q5 ^7 s- p7 i% }3 D
- #include <linux/errno.h>
" F: ^( i. b5 H6 ^2 U1 S1 [' O - #include <linux/types.h>4 M- F% j6 b) K1 }
- #include <linux/interrupt.h>
' B: W; X w7 p+ ^5 ?4 f - #include <asm/io.h># f% [- R Q7 T9 M
- #include <linux/moduleparam.h>4 }( E1 `' i( |8 f0 b
- #include <linux/sysctl.h>
+ c2 v; G* C4 t+ e2 o* q - #include <linux/mm.h>3 [" i$ u& o$ p; H3 R7 R- m
- #include <linux/dma-mapping.h>
! f% d- D" V. X2 N! Q' C/ _ - 9 ~# w3 q; v* s# t, k, F2 k# a
- #include <mach/memory.h>
) y p, C# v7 X% s0 Y - #include <mach/hardware.h>
$ B7 W) |/ c, q$ P2 I! n - #include <mach/irqs.h>
7 O7 B( m4 X2 W5 H9 X# ?, c - #include <asm/hardware/edma.h>
; ]+ c* |8 R5 p3 y f# p - - }! k v2 ]& }! V
- #undef EDMA3_DEBUG$ n+ H9 k) Q4 [1 S
- /*#define EDMA3_DEBUG*/
6 t' A3 n4 T, p, F - ! y7 _$ D' U& i. o3 W
- #ifdef EDMA3_DEBUG
! n% _3 I i: q; g9 d6 S" K. a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 R- A' b0 j" X/ F5 ?7 \& k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" B, {1 T/ y+ F I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 [, J7 v) l T3 Q* d, `) Z5 v
- #else" ?4 P( O G% @/ b+ @9 ?
- #define DMA_PRINTK( x... )
) F% S8 b9 u" d0 K - #define DMA_FN_IN! a9 W# u+ V5 w' s! K
- #define DMA_FN_OUT
: X/ w& A4 ~+ O; w9 j5 M j - #endif& @* ]2 a0 I8 m. m
) J0 b. Z) g) x0 o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& x1 Q6 Q, V7 N- A) J
- #define STATIC_SHIFT 39 d* G" C2 b* ?. ?; n
- #define TCINTEN_SHIFT 20! P$ x; w f% ~6 T
- #define ITCINTEN_SHIFT 21, s3 t1 a& Q- W6 h& p7 H
- #define TCCHEN_SHIFT 22
" Q: s) K h7 Y. `2 ~$ p, F - #define ITCCHEN_SHIFT 23
$ d' u" m; y8 q" P) E/ B
: N7 Z0 C% ^# C( h" b; R- static volatile int irqraised1 = 0;
/ U4 |- U5 J0 A' M3 e4 c, i. i - static volatile int irqraised2 = 0;) D' ?5 w2 N3 h( V2 R6 Y4 T
& C0 M$ S( t* E, T: [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 z* D5 G, J. @/ {$ y9 L- [9 j" I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 J" u$ J1 o5 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ _! a7 k6 D E - ) j9 e, J% i+ \1 w
- dma_addr_t dmaphyssrc1 = 0;; ]% T+ Z* T3 t- p" l
- dma_addr_t dmaphyssrc2 = 0;
7 e6 w8 N" E+ ~3 G% a; y) i% p: D - dma_addr_t dmaphysdest1 = 0;) C# J3 P5 l9 {0 f! I/ M+ k; |; }
- dma_addr_t dmaphysdest2 = 0;) T" T3 d1 W% Q. d' A1 |; X
8 ]6 Z3 x/ _" J$ M! `. ^) a3 o3 Y- char *dmabufsrc1 = NULL;
$ L1 e9 W4 [; Q - char *dmabufsrc2 = NULL;
" k4 _9 ]0 Y' Q/ @8 J - char *dmabufdest1 = NULL;% M% `( p2 K; S2 g8 F
- char *dmabufdest2 = NULL;$ J$ i: y8 h1 N
& m/ T! e7 [1 z, O- static int acnt = 512;2 c; {6 W- ?( s0 S( X
- static int bcnt = 8;
+ B" G. i! j4 V. {& \. j' I - static int ccnt = 8;
+ H: u d, Y. h( h+ v - 2 o% L8 f+ D/ R8 W' _
- module_param(acnt, int, S_IRUGO);
+ ?* d! z2 Q* `5 L2 h& [ - module_param(bcnt, int, S_IRUGO);: ~/ `+ c* k) a) n9 F
- module_param(ccnt, int, S_IRUGO);
复制代码
8 L) r8 r) G' ^: S7 v+ O: L. R8 r0 X3 o9 {, k7 A2 n' d( P- F/ {% G7 h5 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# w) ]- T# c, V7 w6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' C0 m3 r* o3 K! |, R4 z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; `) H- ?$ K" S- ]
; B$ |- z, `; F; w) g& R& i, n5 p1 W# R$ C6 Z$ n
|
|