|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 y/ b1 G/ R4 @5 P- n: b# F- [code]EDMA sample test application# }& c W: S' b1 M3 [
- /*" E( ?( P) Z) X; Z5 u6 U0 Y8 _
- * edma_test.c
' S6 |9 u" e9 @6 k( Q' U6 Y - *
4 c& S3 B- s/ q3 U; V, Y! L - * brief EDMA3 Test Application
: O- j4 C2 R* l6 X' W: `9 z - *7 P* V3 z! }- l
- * This file contains EDMA3 Test code.: `7 V$ r6 O& m0 r) ~" X
- *
0 c- _9 Y& {6 O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ M5 i2 i& V. h+ A; h7 n( M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* L( b7 R6 p: e: V - * TO CHANGE.: j- k: g( }! S6 @+ \9 l$ W
- *& [ R! |4 ~4 l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' C3 d" h* q2 ^5 Q+ C - ** z; G! P! }5 l7 i% c# i
- * This program is free software; you can redistribute it and/or `0 Q- Y9 j: w5 k5 i
- * modify it under the terms of the GNU General Public License as
( p' C+ l! V" g5 y - * published by the Free Software Foundation version 2.' Q; z3 T( q1 D7 w) i
- *' k2 y) q: ?8 Z! ^" W4 L+ C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" `# t+ b& r7 Q - * kind, whether express or implied; without even the implied warranty; z: O+ n+ K' z( O% q! a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) ^% z: h0 e2 j E# `1 a
- * GNU General Public License for more details.
$ s9 `; _* Q7 W% B) X5 H. Q - */
% z1 v8 }4 m3 C( d
) B- A# r" j! K) {1 s- #include <linux/module.h>
1 @7 w! I$ \4 g - #include <linux/init.h>
9 g. e1 K7 t% a9 E) i/ {& Y - #include <linux/errno.h>
5 A2 O0 v6 E1 Q& p. } - #include <linux/types.h>1 `/ E, b3 M* `6 X2 ~% C: K
- #include <linux/interrupt.h>
" ~: p* n, y5 c+ c2 `. ? - #include <asm/io.h>
0 _: }% Q7 A: B: {8 |! r; N5 [ - #include <linux/moduleparam.h>5 M# d9 z$ W2 {$ p/ {# H; T
- #include <linux/sysctl.h>4 m& ?7 n1 z+ k3 y% I% }1 ]* k
- #include <linux/mm.h>
2 |1 R8 A! I* P' M8 Z8 Z - #include <linux/dma-mapping.h>
7 ]8 j# U& x) \ Z- ?# L
: t+ z, k- f, t1 O+ |9 f- #include <mach/memory.h>8 ^/ o( i! d+ A: u" H
- #include <mach/hardware.h>
0 s. T# L- a& v: h1 K7 C - #include <mach/irqs.h>( U/ h1 _4 P: T* S2 x
- #include <asm/hardware/edma.h>
' B# n! @3 K+ I. J+ V7 i - + G& N8 O7 s) \! l6 Y, i
- #undef EDMA3_DEBUG
3 d! r. i; D% r - /*#define EDMA3_DEBUG*/
( y, T" _' e/ a1 \7 b - ( s/ u/ _$ S+ v2 D5 I, L) b
- #ifdef EDMA3_DEBUG
9 J6 T5 _6 B0 D7 g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 p0 V& I# J9 } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( L2 k! Q4 `$ J: H% I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ ] P7 O# p9 N% M/ L5 d' f' `- B l - #else
$ r. G( S" W- C# \% [7 B/ U3 H - #define DMA_PRINTK( x... )) I# y! Y- L/ j
- #define DMA_FN_IN
- A4 w8 n# a5 h - #define DMA_FN_OUT- m; U& i1 L8 q7 Z
- #endif
$ i: ?& O5 b4 o5 o! b - ! n: Y$ [+ V/ j4 {% ~ @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) m, n! g( c* x% j6 V9 _7 T
- #define STATIC_SHIFT 36 j" _$ ^: d& p+ T. e
- #define TCINTEN_SHIFT 20
6 S, P9 {" w( k4 ^0 o$ Y8 R - #define ITCINTEN_SHIFT 21/ h& J7 ]3 O; v; P1 |) c4 P
- #define TCCHEN_SHIFT 22
" {( N+ N) u1 } - #define ITCCHEN_SHIFT 23
2 R2 S7 C' P* b" V: b
& y1 Z/ w; t- [- a$ U# h2 h- static volatile int irqraised1 = 0;
/ D& f9 E' U( H9 d( m2 k3 c0 }5 C6 ~ ~ - static volatile int irqraised2 = 0;
1 N P; Y$ c0 ]( v& [% C; W! t, \; Y
; M8 D1 c- l& W4 Z" |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! u& Q. ]8 ]. y5 e/ ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% D/ J' s' \4 {3 x* P1 T& i* U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, C+ ~: t8 ^# `' f& l+ j' ?- a, ]" } A
7 j4 Z' @% a3 o5 g+ X8 d- dma_addr_t dmaphyssrc1 = 0;! u% V, _. H; t( x3 R- Q# x
- dma_addr_t dmaphyssrc2 = 0;
$ w- [9 R& X" l1 T/ i! s - dma_addr_t dmaphysdest1 = 0;! m$ L/ Q2 p4 b' x8 A# ^8 `- O
- dma_addr_t dmaphysdest2 = 0;
- `4 M. R+ Z/ [: i) | - 4 U6 q, A) }! w9 ]. N# o6 z
- char *dmabufsrc1 = NULL;
! @! ?- ^1 @" { o& z; [; Y - char *dmabufsrc2 = NULL;
4 h1 Q( ~% M5 N' B. o5 E! Q: k - char *dmabufdest1 = NULL;8 L5 Z, E2 k/ d
- char *dmabufdest2 = NULL;
+ b. d v) [/ Y8 X- x
& P+ T a3 I- y- static int acnt = 512;
8 _- ?* J n5 ? - static int bcnt = 8;
7 W4 C- T! B! e7 M9 a - static int ccnt = 8;
& [. b7 V$ s: E, o, R8 P
6 d! Z6 n5 I& s% v- module_param(acnt, int, S_IRUGO);
) e6 Q' v+ A- p1 \$ R - module_param(bcnt, int, S_IRUGO);
& o" z( S0 g% m$ \ - module_param(ccnt, int, S_IRUGO);
复制代码
) H5 r/ \5 x1 u
! q7 f# j) ?+ | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. f. G- G' |# I7 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 p e0 v& W- k$ |: b7 \: R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 a6 c! c/ Y) {. T) `8 I
- J; B* s4 R, u" ~, ^! x
3 Q5 [7 ?& @9 A# V5 Z$ o2 m) l
|
|