|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 B5 N& x5 `: Z; |8 g
- [code]EDMA sample test application
3 c3 \/ H, h- q3 c4 v. H - /*
) K t% Z, z3 ? - * edma_test.c! u$ J( H7 T4 p% f+ p4 M0 q
- *: I( C2 o+ d4 o- o2 C& K
- * brief EDMA3 Test Application
, r& u2 R( u0 N0 R# O1 U$ | - *5 I7 A/ O, @+ h4 ^
- * This file contains EDMA3 Test code.
1 r0 ]8 A/ @ a% U4 w8 g - *
: P$ A9 j' [4 M" w# X& P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( L* S0 S# I) j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 g+ P/ m& O+ n; P2 w% [( B - * TO CHANGE.$ m6 |! H6 _* o
- *
. O8 w; a% z' o0 |4 Z( z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% E7 ^) T. X- ? - *6 J7 h& C+ t$ b W3 d. z
- * This program is free software; you can redistribute it and/or
3 E u q. P! w - * modify it under the terms of the GNU General Public License as3 Z; ^2 T: ^8 V- f& C: D. U& h/ Y) E
- * published by the Free Software Foundation version 2.! g) T+ d! o6 T
- *
2 Q1 k7 A" Q. \ v. | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 H: l0 O ]3 [. o1 U1 G
- * kind, whether express or implied; without even the implied warranty, J5 y. s: L9 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( d8 l! L( H; j# ~
- * GNU General Public License for more details.
! ?& X6 T2 a- U$ v+ R) ` - */
; h' M, R+ X# j/ x. ^* N7 L# X
5 c6 q: [9 D0 }( g0 |0 D- #include <linux/module.h>8 ~' P! b& |' f6 `
- #include <linux/init.h>
; Q. S% M% Y, K2 a! w - #include <linux/errno.h>4 U5 l. d9 `5 V5 e
- #include <linux/types.h>; Y* n2 ?+ ]) m" u s( t$ t! |- [
- #include <linux/interrupt.h>
5 c2 q8 Z# v, V( E& o6 O# f - #include <asm/io.h>. `. k' F# q: G. r: |4 C6 ?8 {
- #include <linux/moduleparam.h>
6 x! n3 T* t4 ^5 l4 Q) S9 d - #include <linux/sysctl.h>4 l4 e: y; E! _, { [% ^
- #include <linux/mm.h>
5 H- C" i9 C B - #include <linux/dma-mapping.h>
' r5 t6 u8 s( J8 b0 t( ]0 i
2 [4 Y) T' D; K- #include <mach/memory.h>
* t3 l. i& K$ i' W - #include <mach/hardware.h>
+ |* |3 h% F5 {. A1 S# z$ h - #include <mach/irqs.h>
6 _% }) g4 ?* D+ ] - #include <asm/hardware/edma.h>1 s8 a: m# `1 f" F. a1 }. l5 ^
# N- B% G& n Z8 V3 ~! H7 I- #undef EDMA3_DEBUG
; p2 Z6 T1 g: O5 Q - /*#define EDMA3_DEBUG*/8 o- F# p( |% \% ]
6 A5 n! b. d. k/ j9 w! v- #ifdef EDMA3_DEBUG' V- j3 u' H. ~0 k! V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ B% v2 W5 S$ @- ?+ E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- i$ x0 M6 F% x, o& Z. ?& _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 o7 Y) ]' D' N4 C4 O - #else0 z$ J) t& A/ K, u; d5 O9 O
- #define DMA_PRINTK( x... )+ m* C# l1 u$ c3 |
- #define DMA_FN_IN
& a4 A5 k7 B9 ^ L% ?7 C' w - #define DMA_FN_OUT) B/ W% E% A! H( `' c
- #endif3 ^8 Z5 \% j4 o K4 s0 m1 O7 b) m/ p) X
2 t+ S% J1 Q/ V4 Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" L' W2 t. Q: B9 ` - #define STATIC_SHIFT 3
: p1 R. v; W5 U( a- l- b - #define TCINTEN_SHIFT 202 g" V5 A F! L$ J3 ?
- #define ITCINTEN_SHIFT 21" T0 f: C# Q9 i c" ~. K
- #define TCCHEN_SHIFT 22& \& g1 t) N; e$ ?6 [% I4 q; q
- #define ITCCHEN_SHIFT 23, Y1 H+ K4 i/ C) X: w
- k3 l. p' x" c# v% Z& G3 {4 t
- static volatile int irqraised1 = 0;2 e! z# z- [# Q3 c
- static volatile int irqraised2 = 0;
% N1 L5 o+ @$ D
4 D6 k _% B/ f/ z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" c$ v( I3 D! r" C6 Z! s5 D0 n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& E1 u/ _& Z% f, G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ g# i# x6 V- Z$ \( ^& K
- * a" i( W( n$ s' Q
- dma_addr_t dmaphyssrc1 = 0;
- Q# |0 `. } F, ]2 O - dma_addr_t dmaphyssrc2 = 0;3 |- Y& K# N3 h
- dma_addr_t dmaphysdest1 = 0;
# k& {( m, E+ a7 n - dma_addr_t dmaphysdest2 = 0;& P( a8 i# C3 N6 G/ s6 e0 d
5 C: Y" o2 K# V* C7 c- char *dmabufsrc1 = NULL;
8 R! B3 C3 F( L; u6 ^$ L5 ?/ ~ - char *dmabufsrc2 = NULL;
6 L: b1 y+ z; H2 ?& @. C- _ - char *dmabufdest1 = NULL;. q% O# e' I7 D( M, \9 J
- char *dmabufdest2 = NULL;: j8 B2 J" U- }; {
- ( T; j3 J7 ^ Y& Z5 ~ l7 m
- static int acnt = 512;
6 d1 q# I, u6 l7 X9 t- I" s/ u - static int bcnt = 8;
+ c& Y" G; X1 Q2 M1 q - static int ccnt = 8;
5 D. k+ }2 A/ H7 a# P
! B$ F* w, m- W8 _- module_param(acnt, int, S_IRUGO);+ Y& E( o6 D9 k! A) E @# U6 o/ N. ~) d
- module_param(bcnt, int, S_IRUGO);
6 C: k0 }+ {4 d/ b - module_param(ccnt, int, S_IRUGO);
复制代码 / ~0 {1 F! l# r+ {7 c! k
$ x- m& L7 C' m4 o- r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ^) g f. m6 ~4 w3 R1 I4 S% m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. q _' M0 D6 d( k* [2 l) B1 |& u( z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 O H1 B9 J8 U) k. ?0 ^; t9 v
, \; c$ d- Q$ \& d. R$ r9 Q9 H* k
: |4 E3 d Y. P8 d9 x8 I3 n |
|