|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % j G. ]! M( R# v8 S+ r9 v) d
- [code]EDMA sample test application) `4 T( b" j* b4 B2 H' t8 J! U& f
- /*6 B; _8 Z( |3 [+ `4 o
- * edma_test.c
3 k8 c# U& A+ i# J6 e - *( C. K; r, x+ Y: ]$ b! t
- * brief EDMA3 Test Application
; \7 H+ s# E* r7 |# a$ T - */ t* @% {+ [; O1 G0 g; \
- * This file contains EDMA3 Test code." v* X7 j: c& }
- *, S/ Q4 I1 E4 J/ L. }3 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 h& ]7 V+ R/ o4 r3 f: {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. O# A9 p! C$ U+ t/ T K* m - * TO CHANGE.
! G+ p4 @' I D1 Q - *
* O; u6 ~0 d! c% Y+ R P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# \0 ?1 W w* |& j, E' L
- * b% F, k5 C# U1 |! X
- * This program is free software; you can redistribute it and/or) n' @8 V7 R2 P3 W0 r+ U
- * modify it under the terms of the GNU General Public License as
: o' e- |. o; r1 G - * published by the Free Software Foundation version 2.
; P( g3 L& l3 G+ b2 L - *
& q! n/ o6 L; d5 `0 b8 c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. m2 W. g. ^- S# D* v6 x
- * kind, whether express or implied; without even the implied warranty7 C. l1 P3 t5 F6 W+ d' E }3 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# ^: P( s# p- p2 j
- * GNU General Public License for more details.
' F1 U7 Z0 o# ^ - */5 v, p; u1 W. v
- 7 {! w: L3 E9 \4 x
- #include <linux/module.h>6 H! e8 h: b" B; l2 _4 b. h
- #include <linux/init.h>6 T4 F/ e( D; C+ F. S
- #include <linux/errno.h>
4 \9 \% | Y# C - #include <linux/types.h>* J( T, s3 j$ a3 P- |) F
- #include <linux/interrupt.h>1 B1 d i* S. J0 G+ D
- #include <asm/io.h>
% b: m9 V0 y) o/ s* `" m - #include <linux/moduleparam.h>! C* k4 g5 }" M. b. U
- #include <linux/sysctl.h># t5 }% i/ E: d# b5 N# }6 [) Q
- #include <linux/mm.h>
+ m( R2 [. |! m1 M6 Z Q1 T - #include <linux/dma-mapping.h>6 w" s g1 |" V5 `6 m+ B2 o
- # H# W+ m. o' A; x1 r t* U- ]% u
- #include <mach/memory.h>. z/ J- y& [# Q3 ]' U7 v% r8 v
- #include <mach/hardware.h>
- K: g! w' z$ S! o9 R4 X1 J - #include <mach/irqs.h>
1 y. X5 q. c8 U3 ^ - #include <asm/hardware/edma.h>
0 y$ s2 @! i9 e8 y
4 K4 C, z$ Y) v: D& P- #undef EDMA3_DEBUG
1 x5 F E5 b* y+ e, X& G# [ - /*#define EDMA3_DEBUG*/$ l$ Q Y5 s/ ~2 y3 ]* R. U
. ^ ]/ k4 l( R/ K" {- #ifdef EDMA3_DEBUG
! X9 r4 a% Q! ~1 I+ C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ]7 y* M9 y3 W1 V4 w2 W8 t* g! o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ V4 K5 f4 B3 Y9 D, q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ I! Q, u3 f4 G$ Q, i6 C - #else
7 h M3 S+ P t( h1 @" } - #define DMA_PRINTK( x... )
W* ^" a& Q* `6 s - #define DMA_FN_IN
" V- [+ L, T0 u - #define DMA_FN_OUT
$ u7 h& g4 i" C/ a4 U O - #endif( w8 i0 g9 e+ ?. l5 t
: H, a* M6 c0 @' q# ]% C( H# L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ B2 ?5 h! e+ Z- I+ D; Y5 |6 ^ m
- #define STATIC_SHIFT 3
( `1 S2 x2 Z1 Q! W" h( g - #define TCINTEN_SHIFT 20
( e9 a( u! W" K, q+ s - #define ITCINTEN_SHIFT 21
7 r. u# E$ c, @: m9 ~! P8 u' Z* g - #define TCCHEN_SHIFT 22" |5 H. l/ e1 P. Y# a9 V8 Q& L
- #define ITCCHEN_SHIFT 23
" }5 }# f! c5 m' s' R( F
$ [: c/ K Z) _6 P* j9 N- static volatile int irqraised1 = 0;
! D6 S( T4 k; W+ U- e7 x$ ], F G - static volatile int irqraised2 = 0;
1 l! i0 S$ ^; k4 d+ U1 r+ c' x+ w - ! T: A& w) H |. H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ w: M0 u7 A1 C, I x9 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* {2 z; y' p& [; |/ M1 h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 q8 f% k, G6 L S" w
) Y, ?( [* {& j# [' ^# i6 X- dma_addr_t dmaphyssrc1 = 0;) @" b/ y, a' }; X# _
- dma_addr_t dmaphyssrc2 = 0;
& l# i% @8 n; |: W7 L - dma_addr_t dmaphysdest1 = 0;
. I/ M6 K9 a. G: I+ T - dma_addr_t dmaphysdest2 = 0; k" Y. q' N7 y# o1 R
- 2 q9 }7 Y! L) e$ _0 ?
- char *dmabufsrc1 = NULL;
% R2 N7 }! l w% F5 \; j. } - char *dmabufsrc2 = NULL;
6 C4 D7 L9 l; \( F* p# j - char *dmabufdest1 = NULL;
( U5 h+ w4 N; _. @ - char *dmabufdest2 = NULL;
1 X7 Q6 [3 _7 ?, s) I+ g; c- t - 5 |4 J9 K/ L$ S$ v
- static int acnt = 512;
; {7 n1 N: D# r# l0 d: c - static int bcnt = 8;
5 z( z [& r$ W/ U - static int ccnt = 8;
5 x5 t$ K. J9 L' c
8 C2 N5 f$ `5 z. O- module_param(acnt, int, S_IRUGO);$ F( S0 U; E5 o2 [
- module_param(bcnt, int, S_IRUGO);4 T! u" W( j! S
- module_param(ccnt, int, S_IRUGO);
复制代码 , ^+ }& m" `9 I$ X8 s
0 P% k5 ^! J! g. I6 k9 l3 I I* I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, J i0 o( l8 Garm-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 E% S4 J8 I# m9 S7 j3 s _9 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ L2 l1 _2 J- t e( U; r4 C' r1 I) C" _. J% ]
! W) c k/ {, F |
|