|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # W- d( M' Q V9 y, _
- [code]EDMA sample test application
$ n7 q. \: |* o/ y) T - /*+ N. Y! I1 G8 Z6 ~3 M
- * edma_test.c
9 o: U ^7 L# ~& Y$ E - *5 f _9 h w1 A4 l y
- * brief EDMA3 Test Application
. T1 e! K6 v3 { - *
I4 \$ C* q: K' g0 j( ` - * This file contains EDMA3 Test code.# a- O. x, m. p( @
- *' o$ b3 \" I3 X+ D0 X; N" g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' b8 z, P; B8 b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' W$ |; C1 R8 {* L U; H) { - * TO CHANGE.
! T! L) W6 z' f - *+ ~9 Y8 b; o2 M- ^' @0 m( g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ h' j/ |# `9 ?% T6 U8 v9 ]: {/ [. v - *3 r0 {+ |4 t4 n! x% w' j& k; w
- * This program is free software; you can redistribute it and/or7 O# ]4 Q; w* E+ O
- * modify it under the terms of the GNU General Public License as2 {& p) [1 b: R4 b# x' ?
- * published by the Free Software Foundation version 2.
3 s5 \# {* f' A. h" F' I, E - *7 H4 ~- S& X3 P4 L' s- W4 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 x/ D, V: s# c. b9 k - * kind, whether express or implied; without even the implied warranty7 X9 j8 Y$ O: ?' z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 f k% y A! D4 I9 C$ r
- * GNU General Public License for more details.2 Y) }" z- x6 A' R) U% l
- */2 x4 P; f- I. Q, q# f, z; T
- 5 N7 X* h4 I1 S, D
- #include <linux/module.h>
, x7 Z) W% G/ n6 S( m1 I8 p - #include <linux/init.h>' ]6 _ o" e, F
- #include <linux/errno.h>. I; F+ a! N L) [3 Z) R
- #include <linux/types.h>
( P5 K4 _) Y) L! ?$ e - #include <linux/interrupt.h>
# T, Z0 h8 Z" n1 N( L d) q" U - #include <asm/io.h>2 d) y8 y9 o" C: g" |$ ~* G
- #include <linux/moduleparam.h>4 ?4 f6 M1 H8 J. G" _* A
- #include <linux/sysctl.h>
8 |! ^% M# N3 `0 o9 U - #include <linux/mm.h>& `+ O& x/ R, t' M! ]4 |
- #include <linux/dma-mapping.h>
% _0 M, N9 H$ H6 b" _- b2 X - f9 Z7 O" [2 _
- #include <mach/memory.h>6 ?: M5 P: q h& ~
- #include <mach/hardware.h>+ c, B8 H6 w& c3 P2 y
- #include <mach/irqs.h>
6 g/ | a% w% Z$ z8 B - #include <asm/hardware/edma.h>
) s8 |0 `8 R# a5 Z% x& I* S+ ` - * \4 q$ S. I/ ~& K7 r# Q* H7 y
- #undef EDMA3_DEBUG
) o. d5 x9 @2 a0 @4 y9 |! ^5 X - /*#define EDMA3_DEBUG*/
( `4 \' E, ] @
! V' v6 Q5 b: G% r. c6 h3 g G- #ifdef EDMA3_DEBUG7 i0 p: \( g! b6 \. u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
n3 F$ Y" ]" q1 P7 g9 N3 i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 q9 X( q8 ?+ A% }3 `' k4 ]+ {* H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ O! ?; H4 f' ?, R; n - #else: ]6 {! \# E p/ M- Y/ L' x; l
- #define DMA_PRINTK( x... )
: S+ Q' R9 V( `$ w d! q - #define DMA_FN_IN6 T/ K! X2 M/ b9 F5 j
- #define DMA_FN_OUT( B, W$ H1 R }' d: W: a: u' S
- #endif
# J x9 Q4 ?4 G" k" U9 E# ^2 J - 4 M# a. h6 ^; y6 @6 J: e: A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! ^) o2 e; D# n# I4 t - #define STATIC_SHIFT 3
6 L Z) E( q% k - #define TCINTEN_SHIFT 20
/ r* P1 ?. [' \& k9 R$ H% a/ S - #define ITCINTEN_SHIFT 21
' ~ u2 c3 W% ^4 } - #define TCCHEN_SHIFT 22* w8 e9 e% Z: o9 W6 @% ]' R9 ^
- #define ITCCHEN_SHIFT 233 h8 M5 P/ `4 ~
% J1 h A: ^4 H9 O; d5 ]- static volatile int irqraised1 = 0;
& L% {4 y' y3 C& K: H% ] - static volatile int irqraised2 = 0;
+ n' y! r" t. i( R% c. }0 G y
3 x G. G# H# i; L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Q$ R# d$ _/ Z7 B+ ?; o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 m* P3 S2 D5 k. k3 ?) j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# w6 r( a2 v/ A) x. W
+ C# ?, H! F- J) `0 }6 |; V) K- dma_addr_t dmaphyssrc1 = 0;
7 K8 ^* ^! d# ]3 k) m; y% ] - dma_addr_t dmaphyssrc2 = 0;0 L, V# R: a0 x5 _) {5 C) B6 i/ i! N
- dma_addr_t dmaphysdest1 = 0;+ I) k! B8 l% n9 w, U" a
- dma_addr_t dmaphysdest2 = 0;
$ R5 x# ?/ _9 z; i h5 p8 h
|5 }" i3 K+ c) `7 z9 i3 g" B- char *dmabufsrc1 = NULL;; h& M/ C y1 _! G- S+ a
- char *dmabufsrc2 = NULL;- z! @- s+ [( R5 n, T6 m( v; W
- char *dmabufdest1 = NULL;$ w+ y* l! n/ S+ [# o& q
- char *dmabufdest2 = NULL;0 p! \5 l' P1 {6 Z! ]
- # a z, m M0 x5 o; }( Z
- static int acnt = 512;
* V& e1 e0 n9 S0 D - static int bcnt = 8;. E4 i& J( v5 K N
- static int ccnt = 8;6 U$ l& `* q; o1 u, A
- ' _7 t& V& F# \5 [* m
- module_param(acnt, int, S_IRUGO);
5 [, o; Z1 s* V" O( t2 z9 ?# n - module_param(bcnt, int, S_IRUGO);
( _6 S) Y, r: W6 f; Y- s - module_param(ccnt, int, S_IRUGO);
复制代码 , N" Z$ G! s8 i# Z
7 v% b% K; \; `' N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 B' H' \% U6 u4 d; B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 G3 X& z% O3 ]( u5 H6 R: r+ u7 T1 P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 j6 U4 o; q9 t6 Z
: ?, u* p9 ^; a& U7 S+ ]
) F1 f& P0 ~1 }$ h( y( o9 H
|
|