|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 i' C# K# ^6 p7 `
- [code]EDMA sample test application
% W- M& m) T$ } H( S" J - /*
( `4 S b" Y3 d - * edma_test.c
4 u' s5 } Z& o5 c - *
% r v) \+ b: Q, D4 p* e" H0 B) P - * brief EDMA3 Test Application& B" K8 {. z, g* O; `, z
- *
! k8 J L6 p+ ^ - * This file contains EDMA3 Test code.! z* n9 i# E5 U. T; w- X
- *. q6 o3 U; U( W% V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ p: u& b/ m8 C4 l# d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% H+ A! S: N1 }# |7 v8 E1 k - * TO CHANGE./ I( T. ]" O; x* Z) z
- *; ]( p6 z. i5 S" D2 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 J% \; ~/ R$ ?* e: X - *
: i5 V$ A! y' `1 C, X6 n - * This program is free software; you can redistribute it and/or
: s- r2 c8 n* P3 [7 U2 h9 s6 h - * modify it under the terms of the GNU General Public License as
! g) d7 E/ ~5 j$ n5 w# ?$ l - * published by the Free Software Foundation version 2.
# f4 [7 f" o6 c& ~' U8 e - *& t* y) J, s# Y: A/ X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: H7 f. Q# k& W5 N. M. t - * kind, whether express or implied; without even the implied warranty9 n; r/ ]3 |" N- ?5 j3 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 Q# V+ | V5 t. z" l8 R" T
- * GNU General Public License for more details.
5 N! B1 c- L. n8 i - */
2 v4 q/ D$ X6 o% I! o, ~ - % F, d5 v, G% H4 Y. X! ~
- #include <linux/module.h>! o' J7 q; f' l9 O# l+ A3 B( \9 Y% w
- #include <linux/init.h>6 D, w3 U: k' A. p/ |0 E8 x5 B2 l
- #include <linux/errno.h>
1 b& \" V% _$ L$ e& c: [/ `, Z/ l - #include <linux/types.h>% K! _$ r2 a( A. v$ p
- #include <linux/interrupt.h>
/ S) b. }4 h0 m6 a$ R v: W/ W2 T - #include <asm/io.h>
7 G7 A8 `! E6 W' Z# K - #include <linux/moduleparam.h>
% m4 b# p; A# M3 u* H+ F% V7 A - #include <linux/sysctl.h>
1 | {' L# l! o% S+ h6 H+ Y4 P1 f - #include <linux/mm.h>8 n" d6 K1 \0 O2 R
- #include <linux/dma-mapping.h>
( ]7 W9 x+ B, L d3 N6 O; M - , o7 R& z0 {- B
- #include <mach/memory.h>
5 j r2 K$ g& E - #include <mach/hardware.h>4 D8 ~# r4 A% ^: o
- #include <mach/irqs.h>& P+ s/ B9 K5 Q3 ~. U8 W2 E* t' F
- #include <asm/hardware/edma.h>
+ J: U; a" R& i
; v7 K: G( \3 ^! J; G4 c' \& \- #undef EDMA3_DEBUG
4 ]5 Q' \* m) K" P0 ?, Y5 M+ a - /*#define EDMA3_DEBUG*/2 ^1 u9 G1 L# u
4 ^( z- P2 U! ?# J: d- #ifdef EDMA3_DEBUG! e2 Q" b# P e$ |# y9 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" l5 G: W+ E# W( E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 K1 W; J, Y r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Q+ }. Q+ }0 _0 f4 N
- #else( Z4 ^2 i+ m8 d( z3 l6 t" c& _
- #define DMA_PRINTK( x... )
q( C8 t; Q& _6 [/ r% W+ K& {; E - #define DMA_FN_IN9 v' I* {# h8 [$ Z7 ?. F
- #define DMA_FN_OUT
7 O# _/ ~: S( ]8 }# x - #endif, C: ?& m# z( M& _, O5 k
- , T! b+ d3 q; k# W; q8 V. ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* s5 s# E8 L' G. W7 j! i# p. V - #define STATIC_SHIFT 3
2 V# ?& r4 p: G0 B1 m, f - #define TCINTEN_SHIFT 20
' n @* @% m# O* c) Y$ Z# z - #define ITCINTEN_SHIFT 21' }7 m8 p! y3 _8 n8 N
- #define TCCHEN_SHIFT 22- c( X) b# Q& j' ?# G
- #define ITCCHEN_SHIFT 236 ~& v1 C5 k0 G9 I6 O
- ! ?1 ]6 o8 ^' z
- static volatile int irqraised1 = 0;
. z/ U1 n9 B( D - static volatile int irqraised2 = 0;
: }- U9 ?' ^; c3 y" P
. K6 p6 R- g! t7 l2 u9 W+ p" K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 b e2 f- v, o" p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: H, G& i- |) R; X" X% a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' h3 b+ e0 b7 j
! V/ A6 T* j4 @* Q, N, x- dma_addr_t dmaphyssrc1 = 0;
* s) j& G/ b. q - dma_addr_t dmaphyssrc2 = 0;1 x% Y: r8 t: n/ o
- dma_addr_t dmaphysdest1 = 0;
: a4 l \. C0 f3 W& k' A, a - dma_addr_t dmaphysdest2 = 0;
y. g' S8 N- `8 G
( y2 `; A6 r" g8 ^/ \+ h) d- char *dmabufsrc1 = NULL;
4 ?1 d4 O; {! E8 r" z6 C% ]8 X - char *dmabufsrc2 = NULL;5 Z# z( _/ z7 u' J$ z
- char *dmabufdest1 = NULL;8 N/ t6 f- j6 C- o3 {- c
- char *dmabufdest2 = NULL;
5 C! t6 v4 ?5 T( T* u1 |" B - 9 N" P: `0 x3 a g) d. d
- static int acnt = 512;" z/ q. w7 u: n" n5 l
- static int bcnt = 8;
6 r4 p: l% z3 q7 Y% ?9 O - static int ccnt = 8;6 e9 w1 g& C0 _1 U! D
- # A/ h! O$ b/ q3 ]+ O- q
- module_param(acnt, int, S_IRUGO);6 k/ Q# ~; D X
- module_param(bcnt, int, S_IRUGO);3 R6 A( W0 y9 o* G1 F
- module_param(ccnt, int, S_IRUGO);
复制代码 q. A8 ]: f M* k ]7 d
2 O1 M7 b# Q8 f4 M2 H1 w, r& Z- U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# v5 ]# t$ J" i4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. z5 |' M0 V( c& ~' j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 C5 n( c/ r8 o& k' z
* r) D) C: x1 L% m% ~' U. C" U1 g8 [
0 h" q+ H- ` }9 h# G2 z1 ]0 L
|
|