|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 G8 @/ p1 o- F P- [code]EDMA sample test application
- ~1 g- d% S7 f* }7 g" D3 A - /*1 u7 F* e0 d2 Z0 l3 Y
- * edma_test.c
4 i% `. ]1 L; H$ t - *
& }7 X5 O, j/ n1 \ h+ z - * brief EDMA3 Test Application+ m% M) g1 L( q: Z0 Q& ~
- *
( J% R# [8 ~7 a- a) w5 I6 R \/ o - * This file contains EDMA3 Test code.
* i7 r+ i+ i4 u1 u% S' k - *; [' v8 s# @0 A6 q+ K) q) [3 Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ \8 \: D; \0 h! a/ r$ Q! O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. p/ l+ ], w; Y, D: }, K - * TO CHANGE.
' }1 b4 {. h' T' j$ { - *
; {; G4 |8 X2 _. F4 U0 D2 _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ N6 j- j' U; v% \9 z - *5 F3 z5 G+ N4 r! Y" U' z: ^
- * This program is free software; you can redistribute it and/or1 D1 d& R. z" p. j2 W
- * modify it under the terms of the GNU General Public License as
' V! d9 J9 L/ V1 N, ~. B* h - * published by the Free Software Foundation version 2.+ o: _% Z! r: {& S1 w
- *4 A3 k) t' T$ l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ }8 K; Y. b/ z4 C! z' p
- * kind, whether express or implied; without even the implied warranty" n' L J$ t6 R: j: ^- E% {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* ^* i6 @1 M( O! t" K
- * GNU General Public License for more details.! j: ^$ B; c+ [. \; f* D
- */
+ ]) m* I% Z; }9 T4 d
# `6 f$ ~) V9 h: t- #include <linux/module.h>
2 \6 q" l# `/ v2 A& g4 X3 z - #include <linux/init.h>5 a) o B" ]' V0 d9 c% g4 }
- #include <linux/errno.h>
2 Y8 U0 O/ D. S G - #include <linux/types.h>3 Q2 Z) T/ b1 p7 e4 D
- #include <linux/interrupt.h>
; F& ~* N, m6 b8 h% f - #include <asm/io.h>
: Y$ c& Q) Y0 s; c9 \: F - #include <linux/moduleparam.h>) d* F$ y9 g( e( J; H. H# q/ v
- #include <linux/sysctl.h>
d. F% q) A y! x0 e - #include <linux/mm.h>
" h, A: r$ Y- A) C" A - #include <linux/dma-mapping.h>
9 s" V& ?/ @* Y6 q
' F/ `2 V, D) L/ g0 T- #include <mach/memory.h>
4 C! D1 O) g4 ^: y# W; Q8 g6 ] - #include <mach/hardware.h>
& Z9 I: F* o( O0 g" V" c/ q( d - #include <mach/irqs.h> ~0 I( o8 u! r# }0 R- V( a
- #include <asm/hardware/edma.h># l5 F5 G4 N$ i- H$ n$ [
) W/ f( U. |2 a1 D+ r9 ?- #undef EDMA3_DEBUG/ G# ?, ^" K+ J5 f. b5 j' O
- /*#define EDMA3_DEBUG*/
! d4 @1 H* `" `: v8 H - 2 @: e/ [$ {. i. W2 j, G6 z
- #ifdef EDMA3_DEBUG
8 O9 t; Y; ?$ z4 T5 ]/ T& } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 J8 Q$ U3 s- m$ t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 T* K% \% |& a1 g: p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( ?" |0 {# I+ z# ~6 Q - #else
' ~- S7 Z. M! E( S7 n2 u7 V - #define DMA_PRINTK( x... )
. C( V8 ^. b) H. C" ~: L8 G# p3 M - #define DMA_FN_IN4 D4 e, u; L+ c' y5 I% n5 ?# a
- #define DMA_FN_OUT, `! J B( U1 ^4 d
- #endif2 |9 r7 x+ a! F0 Y/ E" S
- " z9 R/ t2 F, L! q+ L: s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 a3 \! G0 l9 e! \
- #define STATIC_SHIFT 3$ q% V6 r/ ]7 ~( y- T. P/ B( z
- #define TCINTEN_SHIFT 20
3 d1 x# A7 }* R9 l7 o - #define ITCINTEN_SHIFT 21
/ [ U) Q' |* K - #define TCCHEN_SHIFT 22/ ^( ~, \1 Q* ?4 Z7 Z- K( B* j- S
- #define ITCCHEN_SHIFT 23. s7 n Y3 a( \6 F4 q
: [6 r [2 Z0 I3 i9 v# V- static volatile int irqraised1 = 0; s B" k. V& ~) `3 H/ U
- static volatile int irqraised2 = 0;
1 G- U, Z5 U5 }- ]3 b
! |5 J. ^( ~; x) Y6 q" N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# m \" }) L9 Z' a+ q4 }7 k9 n; z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; N9 d y7 f/ @- E1 T4 E" o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 W! Q/ O- r0 ^8 Q
3 F4 V% y1 R* a2 T1 e( v- dma_addr_t dmaphyssrc1 = 0;+ q) b) @, \! |+ H! {
- dma_addr_t dmaphyssrc2 = 0;
+ P( [. H$ i+ v5 o5 J - dma_addr_t dmaphysdest1 = 0;* E3 C' w8 G3 A8 y A& u
- dma_addr_t dmaphysdest2 = 0;5 @; w, ^8 N9 ]' D: J! D: D" Z Z* U$ B
2 m& f* M \' O& U% A: G- char *dmabufsrc1 = NULL;
+ l/ y$ ~" r; h( W, D - char *dmabufsrc2 = NULL;
) [& i' a0 |# l$ [% p7 y3 u. ~ - char *dmabufdest1 = NULL;8 N- b& ^, E: q5 E' P8 l5 ^; n/ _
- char *dmabufdest2 = NULL;
9 r4 j5 R' g! X" A8 u, S J4 S5 F - 6 p& | Q( x4 V7 G2 v# O
- static int acnt = 512;
! A8 ~: A$ A" K; G( s4 p8 F - static int bcnt = 8;
& C A8 p1 @+ J& u# R3 C* J - static int ccnt = 8;
[1 i8 |* M: i# J) W$ D. W
5 L- Q% j: V% H1 ^! K) ~: c5 R* D- module_param(acnt, int, S_IRUGO);9 V7 T; u" o9 y1 t: w( j% _4 o6 K
- module_param(bcnt, int, S_IRUGO);) h2 {. L6 Y1 P* W
- module_param(ccnt, int, S_IRUGO);
复制代码 " L. x9 [4 C& i. S
: L7 }- \! i$ S! [4 `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ J, }% u# `" m) Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 `9 V6 D0 [/ w- v6 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ G5 P5 f2 q5 g* V9 c- `
( Z+ R8 w% k9 f( v
8 Q! S, {$ e& ^5 X
|
|