|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . l; P2 W+ Z8 x; J9 ^# g; _
- [code]EDMA sample test application
0 s- z7 \5 ]" r% c - /** d/ Q: W2 B+ E3 `) H2 ^" w; F
- * edma_test.c+ {! @) Y9 w' g
- *2 }9 W3 {0 L$ X4 I
- * brief EDMA3 Test Application
; [9 k% j0 F3 y/ V7 d0 `- g* E' [. w - *) ]( m* l1 z) j$ ~% O
- * This file contains EDMA3 Test code.. X: o- L% \3 ^4 E' j0 i( h
- *$ o* ~4 y5 a L& Y7 f& O! `' n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 ?+ |' [$ }1 p. k l3 l4 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ V0 B3 t/ l$ d; M k( W ]& o
- * TO CHANGE.
; U- ?$ Q9 p2 a' ` - *
( H5 x4 I( [* w- G% m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 G2 o M( g, ~5 f - *
9 m* w. j5 a) I; _# j - * This program is free software; you can redistribute it and/or$ b" K2 _+ K0 r, K4 M$ B! l
- * modify it under the terms of the GNU General Public License as
( k1 m9 ?2 P9 }" D - * published by the Free Software Foundation version 2.
' h2 d; ^/ Y- H3 {9 ^ - */ d4 w! C& u( S6 k' t3 c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# N- N, @ b4 e7 U) i) y0 P! W& K/ M, f- k& e - * kind, whether express or implied; without even the implied warranty/ Z) L! z3 f( m+ H9 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- d( j/ ^! H& h - * GNU General Public License for more details.% f) v3 c6 c& U; g3 w, @( o5 }
- */4 G2 L/ }8 U" b! \7 W: b; e
- 2 Q/ B* W* q$ O! }- _+ O d
- #include <linux/module.h>
( [8 Q( L) W4 ^4 Z! N' a! H7 ~ - #include <linux/init.h>
; o9 n# a) B& A% ~- @6 o - #include <linux/errno.h>3 Z! @2 n" g, m& a6 m5 Z! G! V* w
- #include <linux/types.h>! F p+ _$ j" t1 Z5 d7 W; \
- #include <linux/interrupt.h>
- J, p) Y6 V0 ~- b) } - #include <asm/io.h>
. Z% z, u( Z- f: K. ` - #include <linux/moduleparam.h>* i* @& [" S6 M1 h$ c8 m: a' p
- #include <linux/sysctl.h># Q% u5 l5 X) o* w' D2 O' E }
- #include <linux/mm.h>4 y7 x0 c$ P# ]' q+ y5 f+ K
- #include <linux/dma-mapping.h>
5 h' J( ?$ _* Q- I - 7 V- P, @% f. u( e' X
- #include <mach/memory.h>
: X" [1 s! N5 B% x- ? - #include <mach/hardware.h>* C0 @3 W- v& T( `; ~
- #include <mach/irqs.h>
( K0 m: i9 k3 v# n6 @# i - #include <asm/hardware/edma.h>. o1 X4 M2 L1 O
8 r6 y: x, h% D- #undef EDMA3_DEBUG. V* H4 \* T/ q6 ` y
- /*#define EDMA3_DEBUG*/
1 r# |6 E! T! J- S$ d- P A - 8 d+ O' \6 d- G% H
- #ifdef EDMA3_DEBUG- D7 s2 u7 ~# L$ S1 F7 W* x5 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 x' }$ A3 V# U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! t! |# |, w( x/ {/ H4 p- E9 p6 ~, C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* t7 _5 c: s0 o4 H+ v - #else }1 ?( G* \& I" ^) V
- #define DMA_PRINTK( x... )+ |' g- Y. v3 n! e
- #define DMA_FN_IN
" K# }2 R) x. b0 l8 V: t( P; k - #define DMA_FN_OUT9 u$ T2 z5 G% T. Z5 P+ o# z
- #endif% J0 W& p: y, Z" Z
/ p5 Q- F' l# p; j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- w3 @% K* g4 q. Z% `/ g' `0 f - #define STATIC_SHIFT 3
/ ~. y6 m3 n5 ~# Z) z5 A( y. P8 d - #define TCINTEN_SHIFT 20% Q( q# c A2 U( y8 O
- #define ITCINTEN_SHIFT 21
5 U+ o% f- M) J7 V, a - #define TCCHEN_SHIFT 22
0 ]) O- k$ }6 Y8 ~1 N' Z4 f" | - #define ITCCHEN_SHIFT 23
' f. x6 O8 }# L5 n, k3 F - " G' V, e; M& \7 v! r1 B
- static volatile int irqraised1 = 0;! L) o/ z- \: f1 |$ D7 q3 i
- static volatile int irqraised2 = 0;( G% {. `% S6 ?" j6 Q. [* u2 E! C5 q
- 9 k0 c6 y4 }+ \: ` A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
_3 W9 R) ~: P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, T& J( X: I" r' w! i- g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 ~3 r1 G& T! L! O) o) Y' a. q - , f0 Y2 `( x3 D" \
- dma_addr_t dmaphyssrc1 = 0;& p, Z4 {1 G* L/ Y2 ?/ j" E& t" u
- dma_addr_t dmaphyssrc2 = 0;* q9 h+ ?, o0 U6 L; Q6 W. G1 v- {
- dma_addr_t dmaphysdest1 = 0;
) Y0 l; g) ^$ q - dma_addr_t dmaphysdest2 = 0;' b$ c, h! O5 |
- * g W/ A/ `2 Y8 Z) o. L+ w
- char *dmabufsrc1 = NULL;
5 a! l$ t; _: R& j; q - char *dmabufsrc2 = NULL;
/ o7 f( J9 P2 G( t8 D( z - char *dmabufdest1 = NULL;- K0 x) l) I0 ~9 c
- char *dmabufdest2 = NULL;8 w+ S9 |& R! {
- 1 r* h$ Q* G% k9 ]2 [! x; S
- static int acnt = 512;9 Z7 Z" s0 R" f# a
- static int bcnt = 8;5 K$ S/ h5 y" d6 T2 S) |+ g& G/ S
- static int ccnt = 8;2 Y3 b4 P* b! r: K1 A, [
3 p' G6 G. G2 U4 u- module_param(acnt, int, S_IRUGO);
9 p5 z4 m. {% U9 n; x1 s! o! K - module_param(bcnt, int, S_IRUGO);1 Y- M4 J9 Y$ f
- module_param(ccnt, int, S_IRUGO);
复制代码
% v: j" F# b3 }6 I0 K! C! I o. R* j. b* T0 B* X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: g+ @8 T& W; i, R! [' ^9 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- e$ Y" m+ e2 j4 v' {' A1 z1 i/ q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# y* Q' e. n1 E- @- W6 R0 O
$ y+ w a( s% D7 T+ f
0 D( Y- h. o3 k8 ]6 B |
|