|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" G2 U! x# |( u2 p; q- [code]EDMA sample test application
( w; z/ W6 {% _2 J7 i3 M - /*
7 q% \6 H |' c- r( o* ^+ J+ u - * edma_test.c6 z5 j* s/ W+ o: D$ y0 {1 e8 T
- *
2 T# g: _ e) M, b w - * brief EDMA3 Test Application O: a) [; Z% M: O" p! S1 C* Q$ j/ W
- *$ F: l$ z6 A! Q0 ^# ^
- * This file contains EDMA3 Test code.3 r, s9 W* D9 v
- *
5 r" p: W2 a! K. n7 Y P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" `- T4 |+ d" b8 j+ Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 L! W* M6 B( o& K
- * TO CHANGE.( e( p" n/ V$ _9 I. V7 i, r
- *
8 [ J- \0 s9 J: Y6 L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 Q' [, o1 p' l g8 q - *
% r0 }% ?$ E9 @; }& u; I' p' U& l8 C0 w - * This program is free software; you can redistribute it and/or
! K: v& b9 x* a$ s% F+ i$ ~ - * modify it under the terms of the GNU General Public License as) n& q# G5 a% x! }: h4 `# X
- * published by the Free Software Foundation version 2.
* S9 Q( c& f8 E$ K - *
* \1 Z( R4 M+ i8 v1 K! Z: u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- U1 K, l% P- _
- * kind, whether express or implied; without even the implied warranty% \. C; p# K& s9 _) C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 `/ X/ |, z& F% g - * GNU General Public License for more details.
6 B7 {! p! t! }2 O4 W! D/ V - */
( ~- e6 F: W) o5 q" T9 t& [2 o - 2 D" A5 `3 u" B0 g
- #include <linux/module.h>0 C& @, Y& ?; B' S# Y
- #include <linux/init.h>
4 k K: \# @7 F5 s6 t - #include <linux/errno.h>
! l7 {7 ~ L/ X* f4 W! c* q - #include <linux/types.h>" U3 N$ @9 [; E6 ?1 }' E
- #include <linux/interrupt.h>2 d: g; Y/ v) {, `3 z
- #include <asm/io.h>
# A. k- K4 Q4 {2 v, } - #include <linux/moduleparam.h>
; k4 ~& r' q+ c - #include <linux/sysctl.h>0 d2 d; H( V& _& x
- #include <linux/mm.h>( [/ U) Y6 h: C! k4 Q9 C
- #include <linux/dma-mapping.h>
. z2 ~7 v* c6 e+ r - H' k4 L! k6 I7 [& C4 P% m' R
- #include <mach/memory.h>% Q1 p: K8 d' {, L: k; z m
- #include <mach/hardware.h>5 i7 d2 F9 c/ `% e
- #include <mach/irqs.h>( t. q: n2 ]' P# }( z% J( E
- #include <asm/hardware/edma.h>
% u% w+ R Z" ~
8 S! \) l9 L! J6 s" a- #undef EDMA3_DEBUG9 U! F5 p3 Y/ z# b* O) t7 v
- /*#define EDMA3_DEBUG*/, A) l0 x3 D E" K& v" e/ f8 Y
- . N+ w; Z# f0 {
- #ifdef EDMA3_DEBUG6 W9 \) Y" ~) B5 k8 \$ u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ U% K( H1 z/ t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# N) e. \! ]& N1 f) o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" L7 c# d! J0 e* P" o8 G S - #else2 P9 B& a! z: s$ i
- #define DMA_PRINTK( x... )7 A9 \6 o7 n1 W3 {2 Z8 K- f
- #define DMA_FN_IN! X b: t! R% A4 {& b( b. a k- K
- #define DMA_FN_OUT9 C6 r7 P- u6 ]! j
- #endif$ w0 }) L' h6 D: k- n# y5 r
0 [; O9 \; v% [. t% H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 b4 Y7 h7 _; s/ y9 d
- #define STATIC_SHIFT 3: ?$ w N; z/ L% ?8 V
- #define TCINTEN_SHIFT 20" g( \+ I: _4 E- H* W; |6 y% \/ J
- #define ITCINTEN_SHIFT 218 x9 t- |1 e0 t+ ]& ?
- #define TCCHEN_SHIFT 22
6 i+ `# Z Y) [, o. d" Z - #define ITCCHEN_SHIFT 232 J4 ^1 c5 l L0 `' Z6 M1 `: Y
& h: h% H" A0 o6 F2 e- static volatile int irqraised1 = 0;5 Z5 N7 C8 H, \/ f% H
- static volatile int irqraised2 = 0;
( H5 p) j, F* O/ t
( Z1 H7 ^+ b0 p9 k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 Q/ `- Y+ h( Y5 e3 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ W2 x8 R( p( n$ O- J. a) v/ D3 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' E/ l5 n% }$ v: b/ A9 B1 I - ) |2 w3 d4 c7 t' Q. }( A& q! ~
- dma_addr_t dmaphyssrc1 = 0;
( G ]! z# w/ A r4 l - dma_addr_t dmaphyssrc2 = 0;, K5 n3 }* g; y
- dma_addr_t dmaphysdest1 = 0;( b1 g$ e- Y4 q6 v+ a
- dma_addr_t dmaphysdest2 = 0;1 o0 Y+ M5 N4 `' R1 A+ f
- 7 \) ^0 ]* o7 x* k
- char *dmabufsrc1 = NULL;
; y: W: e; D, w- H! L' k! u* V7 F - char *dmabufsrc2 = NULL;
7 d6 x% s( G$ b) E - char *dmabufdest1 = NULL;
. n2 O# y/ ^# z3 x - char *dmabufdest2 = NULL;
! j5 v, s% c0 D) K0 q% t6 J - , T4 g- Q9 ?1 M/ [1 H. P7 ~
- static int acnt = 512;
2 [' Y( H, U: |6 {% T8 ` - static int bcnt = 8;8 R6 l, ?9 K r
- static int ccnt = 8;
$ C' w' N# { X" A* ~4 \) g - ! f* D E% N8 B6 t c
- module_param(acnt, int, S_IRUGO);
: K0 F6 X9 K1 `8 B ^1 V0 l - module_param(bcnt, int, S_IRUGO);
& ~5 v! {2 b) L# q2 F( g - module_param(ccnt, int, S_IRUGO);
复制代码 5 [- U7 l5 f6 F. a9 p
* ~ I2 b& e# Q: h" P/ A1 M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ P6 x2 @& O% U$ y/ M! }8 e+ C' h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& H5 V9 c3 A7 X& S* r% Y" L( R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: u0 D6 v4 f! F# K# U0 [3 C- p# e7 j8 _4 v
/ }. o+ j. x( J* R2 }9 ]
|
|