|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 v7 R/ ~% H6 i& L- m" |
- [code]EDMA sample test application' P# c) `$ ~ k0 x1 n& O3 q
- /*5 l; }- u, n$ Y& `4 l6 M$ C1 u4 [0 h$ d
- * edma_test.c0 k2 n ]+ r" z3 Q: T" }4 x+ |
- *
% h2 r& m: Y0 R1 Z - * brief EDMA3 Test Application- T5 P$ O( w& v( v8 h4 t+ {
- *( |7 j- j7 Y# z r! L2 i, z8 I) t
- * This file contains EDMA3 Test code.
" i+ M, c4 q! i4 P, ^ - *
0 B4 a7 p* M7 D. j, [9 r! n/ q0 R3 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) e* x" f+ V: j$ Z; Q9 v. |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& L# f4 N$ W/ q0 d7 z& H6 k+ } - * TO CHANGE.* D5 D* q/ w/ z+ `& X3 ?) H
- *
$ v/ A- H1 a& y# F# T/ [5 c4 y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 z, T. C& ]. t1 B F$ E, h - *9 V2 |, q. `! h' q# m' e" Z
- * This program is free software; you can redistribute it and/or
" `; K1 ]+ N- w; y: T - * modify it under the terms of the GNU General Public License as
/ P+ P. r) K' i6 Z" Q) l/ q - * published by the Free Software Foundation version 2.$ h# E: T) r5 D
- *
0 \2 z8 e) ?+ z$ R0 ?8 C, j( Y! L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 t) f4 s$ E0 c; g) i - * kind, whether express or implied; without even the implied warranty
! D" P$ o( I! \; `) s2 J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: j j$ L( V1 d2 ~# Q' g - * GNU General Public License for more details.
! u0 t9 L6 j4 ^8 [ - */
& R% E+ J" z; y8 [4 B - % H/ j4 W6 I" T! {' p; ]
- #include <linux/module.h>5 L) ]: v' k) b y) e# o
- #include <linux/init.h>
. V/ J2 o& x; Y: }2 O: E. t - #include <linux/errno.h>
9 D/ m" O# }" T& L - #include <linux/types.h>& L* \+ q4 Y [" o# L4 Q
- #include <linux/interrupt.h>( P* y5 P \6 y# U& f, V
- #include <asm/io.h>4 n# y3 e* X1 p1 i# Y" n% E+ r
- #include <linux/moduleparam.h>
z, ]1 L7 P1 s: C9 D c' a$ j1 H - #include <linux/sysctl.h>
" X5 t( L' h6 C' Y- Q* ?0 a3 N - #include <linux/mm.h>
* r. A0 i5 b1 v- U6 A: m - #include <linux/dma-mapping.h>0 f4 s2 Y$ A$ }- v+ H4 r& f" V
2 P- h" P: u* h$ S2 X \: v3 J- w- #include <mach/memory.h>
7 F7 U1 \) z. V: g2 P- a - #include <mach/hardware.h>
6 S4 T- ]% E+ j0 O6 [8 ^ - #include <mach/irqs.h>5 E% n; D+ R. P6 J2 |% A
- #include <asm/hardware/edma.h>. b" e5 O$ N' K1 k' n) K
- & w* l; T7 M# I' T
- #undef EDMA3_DEBUG8 V5 |# _) ~8 Z
- /*#define EDMA3_DEBUG*/
2 f* ?, K! |$ u- L" m2 e* c \ - 9 j. H8 a& m& C
- #ifdef EDMA3_DEBUG8 b- |- O) U4 `, j3 h' D! c% t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 V, E/ b/ x9 P8 N2 S6 d+ k5 {$ I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: V! j% T- T, g8 Q! A `5 t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& K$ V3 H6 k% o' S/ Z
- #else7 R# Z0 r3 C2 P3 Q7 P* o
- #define DMA_PRINTK( x... )
. E5 V+ b1 i5 l) H8 i - #define DMA_FN_IN! C2 l" p: N) L6 ~" g' b( O& @
- #define DMA_FN_OUT
1 ^/ g; e; {* X8 d5 ], S - #endif
0 A* ^+ g) [2 `! O
! A) J6 L1 }+ ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 }$ {; S7 B ?
- #define STATIC_SHIFT 3; }( z6 d0 `3 m- C
- #define TCINTEN_SHIFT 20
; N' j$ \) L2 y( G Y3 Q - #define ITCINTEN_SHIFT 21
% b* E2 C9 \' L. y1 j5 x# o1 B! p, R - #define TCCHEN_SHIFT 222 G( i7 o' U5 A; B
- #define ITCCHEN_SHIFT 23( {9 t3 y: V# `5 I* d% f% W9 j
) i/ } t" E& ~! w- static volatile int irqraised1 = 0;* I7 @) x" M9 z0 [7 T
- static volatile int irqraised2 = 0;
8 S: Z# J0 r0 m8 ]1 q t - 6 D" p7 x. y0 b' C) O Z! P# n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% K+ z0 D: _; ^4 w( A. g& T7 p0 ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' A3 V; v2 l% x; _/ Z. a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 j* h& a7 Q! s9 y
& Z+ H+ V& ]" f; z- m- dma_addr_t dmaphyssrc1 = 0;+ N/ T4 H1 G" w; X0 g: J2 W3 t4 l- {6 b
- dma_addr_t dmaphyssrc2 = 0;, Y1 c0 C/ b9 \1 h5 v. F
- dma_addr_t dmaphysdest1 = 0;' e" W: T) l; v) w- L
- dma_addr_t dmaphysdest2 = 0;2 ]) c7 g2 e, N* z7 i: r
5 u" M5 g1 z, f# W! y, @8 u1 b$ ^- char *dmabufsrc1 = NULL;- W% C! ?: O: k1 M6 Q) M( [
- char *dmabufsrc2 = NULL;
/ e; ]7 L4 j4 E" R7 A0 e - char *dmabufdest1 = NULL;* M! N7 B/ `* A% s
- char *dmabufdest2 = NULL;4 L. `" ]$ z# z$ A- g
- , l9 J4 h P7 e! a! X. i
- static int acnt = 512;9 O4 G$ V! j h) ^) m$ }
- static int bcnt = 8;
7 [2 o- p1 l8 C- U3 Y3 u1 s6 K9 z5 E1 ~ - static int ccnt = 8;5 `1 m1 D6 j) [3 [0 F
- 8 x+ }* ]2 w/ x- T: o
- module_param(acnt, int, S_IRUGO);
8 q' |+ e$ G: e6 ^/ H8 T - module_param(bcnt, int, S_IRUGO);$ X! A) l* o: W# ^
- module_param(ccnt, int, S_IRUGO);
复制代码 ! C" p% |0 h0 U6 j. x
! x. P3 Z% d) e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 e. c# m: G5 ^9 h$ e2 u4 v& z* Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 N3 F* n6 n! h5 d9 t4 Q: d0 a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 J9 \/ x! `1 O, H6 n. j
6 |. T) }7 Q$ C4 w# z7 e8 e; ~
3 Q% K* l/ s! q& U
|
|