|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 e% H8 z3 ^+ j0 r0 p0 Z
- [code]EDMA sample test application
6 L, R0 T7 E& F3 j" e - /*
) s6 t) W3 |/ k1 r9 y M8 e - * edma_test.c; X) H" E* H/ M
- *8 X" V4 n! L. \# x& q& @( Z
- * brief EDMA3 Test Application
{" ? Q. l# R4 b) y4 M - *
5 k. n4 c3 K# A7 Q7 ]. d. B9 M2 n - * This file contains EDMA3 Test code.- b4 a( g9 z6 Q
- *7 j0 `7 L8 k3 c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- ~: l: k d/ J( ^7 D( H6 b5 b: L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% Y. V- D0 N7 N+ A. i8 d - * TO CHANGE.
, ]8 F+ H; o" _4 x1 \ - ** r4 e4 g3 I! E, _0 v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 [ ]5 @+ A% @6 ^1 M5 _/ w - *6 k. \% Y+ x+ Z: I& ^- ^
- * This program is free software; you can redistribute it and/or
9 f" |; J2 y$ B) T" B - * modify it under the terms of the GNU General Public License as
0 N; m% R+ O: V3 c) |4 C - * published by the Free Software Foundation version 2.
; T3 E* m( q& T4 N& l; j! r5 M. u9 ]% y - *
5 A; L7 R3 i6 |$ \. K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 \) g5 {: ^5 i; f: m/ V! ]# |5 y
- * kind, whether express or implied; without even the implied warranty( E& Y, K' o5 x& D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ e- U* l% a0 \4 j* x3 u, { - * GNU General Public License for more details.4 E/ q$ H' b4 s$ c. G& `/ v& h
- *// @0 m: f# {) O+ N, @% g' e
- , Y1 R8 L+ K" r# b8 [
- #include <linux/module.h>
: z: h6 j; s: E$ e3 v! u - #include <linux/init.h>
1 e( M9 Q# F6 t. t- ]0 |& { - #include <linux/errno.h>' f. i1 K& F, F$ g9 u" j6 i# i
- #include <linux/types.h>' L+ e% z5 n+ x# k+ H8 w [ \
- #include <linux/interrupt.h>, z) S" V9 e+ q
- #include <asm/io.h>: Z( [, R, v( h2 h) I+ @! E
- #include <linux/moduleparam.h>
) x4 ]3 i0 _- I( o4 B) U - #include <linux/sysctl.h>
' ]1 L# Z% T: C9 w$ } - #include <linux/mm.h>
$ `2 `2 a, ^ h | - #include <linux/dma-mapping.h>: J- M* D7 F8 O3 D
- : Q; N) N# S" G" [3 C) p0 W
- #include <mach/memory.h>9 ~6 c, ]" H, _
- #include <mach/hardware.h>3 X0 F0 m) i% P( x2 b6 A" a; r
- #include <mach/irqs.h>5 Y0 A. a- m1 s o6 S
- #include <asm/hardware/edma.h>3 W# l1 w8 n# }
. v4 \4 |: A$ }: q4 `- #undef EDMA3_DEBUG
, [2 B2 H4 Z1 `: I2 Y, G& W - /*#define EDMA3_DEBUG*/6 x7 G; ~" d3 h3 }, C
- % ]1 }+ @$ X S3 |4 T* U
- #ifdef EDMA3_DEBUG- O U* N3 L) j! W c2 f0 {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 T( C/ P& s9 k; q7 k+ t- o3 s1 D, v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# F6 t4 A: {; _( l1 A' O. o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 K% x g* l; Q$ K6 c; _$ P. V A
- #else
, z/ p4 z! O9 ]' v9 t+ r - #define DMA_PRINTK( x... )
3 f/ h8 x$ c/ H - #define DMA_FN_IN
4 _: ^- l5 x; v# p - #define DMA_FN_OUT) ?9 [# q6 D# r% K( F5 q
- #endif
/ j- u1 v; g/ p. I5 \% Q3 J5 Q - ! a. C8 `6 j' k2 b P$ f# m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 I! E1 i. Q* H$ u4 I - #define STATIC_SHIFT 3
) b" f4 A* X6 H/ @6 H- \ - #define TCINTEN_SHIFT 20 _/ o k! S; ^' R1 t$ {
- #define ITCINTEN_SHIFT 21
9 U% t+ }, \! N - #define TCCHEN_SHIFT 22
* n+ a L( f6 v2 w" }3 w; M - #define ITCCHEN_SHIFT 23( J6 |& e @0 ^
7 T! B4 R" @( R3 D, O- static volatile int irqraised1 = 0;7 l- Y9 Q# b4 B. E' M
- static volatile int irqraised2 = 0;
& D! t3 ~- V: M( | - 9 U4 o6 T1 k2 O0 a* c6 g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 A' [. d: p( f; _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 U) K8 X8 t# ~, I/ L6 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e+ c' S/ J& f' W, J$ {- C
- * D3 u- j$ z: L
- dma_addr_t dmaphyssrc1 = 0;+ d! I& R. ^1 m6 h. k7 b# w0 Y
- dma_addr_t dmaphyssrc2 = 0;& y# h- z. r) k0 n6 c
- dma_addr_t dmaphysdest1 = 0;2 Z! |7 Q$ b& P+ W$ K$ ^6 S8 `- X E
- dma_addr_t dmaphysdest2 = 0;
1 G4 Y. ^% f4 g- b9 U9 l1 J - 4 \7 M, E: r x6 Q
- char *dmabufsrc1 = NULL;
5 v: H8 O( x; M8 d - char *dmabufsrc2 = NULL; V0 c* Y1 O! S4 X! b
- char *dmabufdest1 = NULL;
/ }2 b h5 h+ A. n% g* b) N - char *dmabufdest2 = NULL;
. r1 }: T& Z( `
! U, c* o; _7 e7 T2 W" @' w' v- static int acnt = 512;) ~! w7 k; s6 F. W# g( o
- static int bcnt = 8;
: w/ j1 l' A* a - static int ccnt = 8;
" f/ z' m- X0 ?8 n* g- L8 ?$ k- g - 8 V) e2 l0 h& v
- module_param(acnt, int, S_IRUGO);0 n4 z: {% P3 a9 t' W$ j3 B* U
- module_param(bcnt, int, S_IRUGO);
" S- C4 t! p6 Q* a7 U: d - module_param(ccnt, int, S_IRUGO);
复制代码
. q5 c" }/ p+ G `/ n2 N, T( ^* R& D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 Z$ t0 H+ I! B- K& l2 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) Z, L4 Y& l: Q/ s. A; W0 x$ |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& t9 w' L; z+ x! H9 D z
! g6 F6 i3 C/ U) h. e( q
V. w( S9 f; s3 ~0 a; b# I2 { |
|