|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . E6 M; U5 \; t/ @+ n% t& m; M
- [code]EDMA sample test application- [* l' @& r* G7 ^
- /*& d6 ^# k" t/ r1 Z
- * edma_test.c# L1 T( `/ x2 y3 X& u! Z c0 I
- *: I5 C, J- k/ C: i. g& w
- * brief EDMA3 Test Application( F- |! ]: y, Z3 O5 y- F6 Q- q
- *5 r7 l; L4 u p# ]
- * This file contains EDMA3 Test code.
! `, y" ^' V# {6 O. D3 I - */ b% J+ l) a, K* h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ E, n; U" A) _5 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) g/ Y/ K8 Q, v* W5 ~$ V N - * TO CHANGE.( \- P: V9 {+ V+ [6 Z! [
- *
$ A& M4 V, G2 J3 E# `0 W3 } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 E7 M% A( s$ q' q- ]) q4 @) y - ** c. W4 J1 Q) u, W: I- P
- * This program is free software; you can redistribute it and/or
3 c% h3 O+ x7 k/ h - * modify it under the terms of the GNU General Public License as
/ g, J* [+ Y3 ^ - * published by the Free Software Foundation version 2.
! r) @# g( v/ _0 N8 C - *0 V6 e+ l. [6 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& y6 I: m5 W0 Y+ y6 d; W
- * kind, whether express or implied; without even the implied warranty3 N5 ?- X, d9 Q5 b- M! X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 F0 \) \- V7 W) V$ g; d/ }3 {+ F
- * GNU General Public License for more details.8 l6 a9 `" v, X: E( A |
- */
+ c. N* @7 s7 P; Y' b - * j# B/ b! p: v7 y3 V: Y4 E
- #include <linux/module.h># f$ E( U% s0 l4 q
- #include <linux/init.h> G% f" h7 p3 s v2 P# w$ U8 X
- #include <linux/errno.h>. p" Q6 P- k$ y1 p
- #include <linux/types.h>
( ]9 G3 N# T) N5 x. l! W7 K& C - #include <linux/interrupt.h>. ~ K# U1 u) i1 I* N+ c2 t1 Z
- #include <asm/io.h>
: ~$ m0 z( |; u# ~0 {$ @" D/ O" |# O4 A - #include <linux/moduleparam.h>4 C( R$ x0 l% D) F
- #include <linux/sysctl.h>' a7 X ~7 V+ u0 l3 B3 ?) e
- #include <linux/mm.h>7 K" A) k; u5 ^. c6 X
- #include <linux/dma-mapping.h>
G4 g. X% ?! M& X- ^# A$ \ - 8 r0 J$ z& f; b, R+ p5 ^. c. f
- #include <mach/memory.h>
3 v5 c) X1 W# ]/ c9 h) m: W - #include <mach/hardware.h>
$ o6 ?% {& u Y& a7 E! ^ - #include <mach/irqs.h>
3 z3 G+ k! |9 ^& {5 Q- q) d - #include <asm/hardware/edma.h>
! B# Q2 Q9 H$ j) K% F5 f
1 G" Z) o! l0 W$ m' u; N- #undef EDMA3_DEBUG
+ Y6 e8 Q6 L! f; v - /*#define EDMA3_DEBUG*/
' A) d Z e! T$ [ - $ J" x- ~; I0 h* O2 v+ C+ X
- #ifdef EDMA3_DEBUG
/ \' O5 g2 @ |( p, S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 H) r- k' b8 h4 y& i* [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 ?" Q$ C% z, I6 B2 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( A! M( `# k: [6 f" J: q: v - #else7 E/ a3 {+ j5 h6 ?6 G
- #define DMA_PRINTK( x... )
* k/ U& u# f0 f. l2 W - #define DMA_FN_IN9 v$ ~7 M2 W* h1 U+ g" o, b. m; C
- #define DMA_FN_OUT
( V& I) n3 n$ Q/ ] - #endif
$ U* E9 M# X4 s/ W" i( ^
' k/ e- E- d# B7 x: v* A, W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" L( h6 [. X7 W$ }8 e - #define STATIC_SHIFT 3
2 H7 M! V$ Z* G9 I" S - #define TCINTEN_SHIFT 204 f& j1 z/ C1 {" H/ A7 e
- #define ITCINTEN_SHIFT 21$ O- b/ ^" E% B4 W9 |( ?
- #define TCCHEN_SHIFT 22
6 x! P5 t2 ^ i6 H8 W E$ Z& e a - #define ITCCHEN_SHIFT 23
$ o a) R1 S, R, y$ }
5 i( w: E! v: {% o! c/ K- v- static volatile int irqraised1 = 0;
. w6 S, B( Z) x% Z9 @3 n( q: \ - static volatile int irqraised2 = 0;
5 R/ l- [' v. H- i# V - ; ?! n6 Q( M# n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& T/ E4 i G. c. L7 h. w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ^! [5 R$ q% q. z2 f& @0 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' A4 v" Y7 J/ m' l/ P/ f( _" I
, f. S& Q7 y2 z4 J/ i- dma_addr_t dmaphyssrc1 = 0;% Z- r+ J0 O' Z! ]* W# \& C& n
- dma_addr_t dmaphyssrc2 = 0;
: O; `1 Z/ |. ~* e8 K, m - dma_addr_t dmaphysdest1 = 0;# m. D5 m9 L& t$ I! Z [
- dma_addr_t dmaphysdest2 = 0;# i+ o& D+ M' B1 `/ e" {& k. E
- + C2 \, g0 [: h! R) f6 e+ ?; }3 k
- char *dmabufsrc1 = NULL;, y9 G& K$ g- u% L1 c) ^( w
- char *dmabufsrc2 = NULL;7 u( ?; L* X9 H) p. `
- char *dmabufdest1 = NULL;
" l1 g; w8 y+ s - char *dmabufdest2 = NULL;2 }- P9 w- A" p" P D$ \ {+ U3 R
5 I4 a- I R( h: W4 z- static int acnt = 512;
. I% ]9 N$ ] l' r - static int bcnt = 8;2 ]# C' o \" d" j/ }
- static int ccnt = 8;$ L; l- A+ w7 h7 {+ V$ l9 s
- 7 r4 `- o: U$ h" k' w& ^
- module_param(acnt, int, S_IRUGO);
) b& ]6 R2 T3 R. f- w- G - module_param(bcnt, int, S_IRUGO);3 u( E0 o$ ]/ O2 U
- module_param(ccnt, int, S_IRUGO);
复制代码
5 }9 i( |4 A+ [3 K0 @0 @
6 j& C2 h$ l# [7 ]! y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 [( }8 W& Z* K5 r) L* }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( P) c. f" v% c( E9 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; A% {: O: T7 q3 g; u y2 ]4 _ H* y3 l
$ `: ]! w6 g5 ] |
|