|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 Q: d* R. I7 B1 \- [code]EDMA sample test application/ Z. f0 b8 Y& O& `- Z
- /*. j9 i& P" o$ ~1 s0 k [& p
- * edma_test.c
% S' w: M# T9 B9 Z, p8 Y: q: u - *
: L% p3 `7 W8 r) \' M, f - * brief EDMA3 Test Application
0 f$ R6 m6 E5 s4 r% i( p3 n - *
; a( v. `+ Y4 H: ?% H. X - * This file contains EDMA3 Test code.0 W5 U. u: S6 {8 ?4 k, ^' U3 q& D6 f
- *, j' Y6 N+ l6 w& A2 ?3 k9 v. d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! }$ U+ V/ ~; d4 q8 Y; t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 u$ {& X8 H H3 c( ]% d
- * TO CHANGE.$ }. d( {8 b; l2 [' Q& I
- *1 g) p3 u/ `# e. P0 z4 A+ z6 z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* J/ e. Q6 x0 V2 K3 h8 M - *. P) |$ Y" G9 U
- * This program is free software; you can redistribute it and/or
7 B( C0 z7 H8 J( V) a7 W - * modify it under the terms of the GNU General Public License as) R5 H% r6 m9 R4 U L6 f
- * published by the Free Software Foundation version 2.
- t1 _. T. p) Z - *! D d0 o! d" }5 v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 W" n$ n! k$ j. ?) y4 h* {" ] - * kind, whether express or implied; without even the implied warranty$ V! i ]" I( c7 E, A7 s2 ]0 |: ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 Q6 z( L: b9 i# f& v) m( [
- * GNU General Public License for more details.
- o4 Q+ h2 S. J1 z - */7 V5 h6 c2 e! {* H9 g3 @ @
1 n& e4 t4 [% x+ a4 Y- #include <linux/module.h>6 d& E& y2 f) g! L8 g
- #include <linux/init.h>, E+ \. b& u+ I# V1 I( p; T
- #include <linux/errno.h>
' w6 ~# `" i9 j% |4 k - #include <linux/types.h>
$ m% M5 `1 j- o* U1 O! X - #include <linux/interrupt.h>: w/ V) v$ S. X5 s" V1 I; P' X6 B
- #include <asm/io.h>
0 O/ q$ f+ G* _; i$ b - #include <linux/moduleparam.h>$ W0 x+ x1 X! E" g* C* F5 W& h
- #include <linux/sysctl.h>
/ O: x4 {3 ?. c6 z' x# V0 Y- G# K - #include <linux/mm.h>
* ]* Z& J& d# r6 ]9 p - #include <linux/dma-mapping.h>
4 ~4 m7 k# |+ S- t9 k
& U9 U# u# Q4 p9 U1 E% S- #include <mach/memory.h>
/ B5 v5 Y0 t4 [6 v5 E - #include <mach/hardware.h>! a( j; U& U/ L) f0 g8 k
- #include <mach/irqs.h>
% a: a8 k4 ^( o. q - #include <asm/hardware/edma.h>
0 J {6 H N9 s9 B) o; }) u - ! ]- F8 [8 P+ |
- #undef EDMA3_DEBUG
; t, B& K$ g! ~4 w6 {1 n0 _ - /*#define EDMA3_DEBUG*/$ ^8 y$ I$ a9 m& Q* ^5 q" ?
- 4 V8 d# ]! O1 h
- #ifdef EDMA3_DEBUG3 N8 v; j# J. N. h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ J" j$ E* N7 \) d- A3 K! m$ p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 x; V. ~, [, Z5 c# ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% L) s6 _( O9 |3 n - #else
& f \4 {- _" W: a# a/ B) X" U - #define DMA_PRINTK( x... )$ u L/ m3 @' a. {
- #define DMA_FN_IN9 F8 {# Q& H4 M# f5 V- A
- #define DMA_FN_OUT
& l0 V, e4 X# P - #endif
. J2 o, m8 u! ^! i. r5 b
- Z$ c" d/ G8 M4 A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 I* F' ~ }* w* x6 a1 y. P# _: ?
- #define STATIC_SHIFT 31 a) M3 [( x' i
- #define TCINTEN_SHIFT 20% L9 |/ J# i$ W* \% v; h4 G2 L' |2 B! y! m
- #define ITCINTEN_SHIFT 21
7 S: J3 r+ z/ }0 L5 k7 K- r - #define TCCHEN_SHIFT 22" K- H! W, M7 S) f# u( k
- #define ITCCHEN_SHIFT 23 J2 `( w8 O8 ]; P9 ?' a0 [9 m; f
- " c; U6 O% s) M; v9 d6 G5 h1 B
- static volatile int irqraised1 = 0;
/ @- ?/ O) x- x u3 G - static volatile int irqraised2 = 0;
! z+ c) e5 k3 H - ( o9 b$ w6 c+ n6 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E( F ?' b6 j* Y/ B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 Y: Q# }$ u% o+ N7 y2 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, k* c0 e' Q4 R& ]% u - * k& X; K$ p; P
- dma_addr_t dmaphyssrc1 = 0;
9 R$ w1 j" X! o/ a4 W- c* K: g - dma_addr_t dmaphyssrc2 = 0;
+ q" a- Y7 ^1 c+ v# G - dma_addr_t dmaphysdest1 = 0;
8 E4 n' K3 b) K k9 W4 s: ~ - dma_addr_t dmaphysdest2 = 0;
+ C; i' ^: A) f$ d |
1 _2 }9 W% Y/ L0 u5 t0 j6 \+ S8 M- char *dmabufsrc1 = NULL;# \1 W8 L' ^5 j8 ~. t2 M* U
- char *dmabufsrc2 = NULL;2 @9 m: |0 ]* J
- char *dmabufdest1 = NULL;$ u! q5 p, P: i/ J; o
- char *dmabufdest2 = NULL;
+ S. t! C3 Y W' M4 [0 q
' ]4 o$ F) o* J5 W o o- static int acnt = 512;6 l b5 V5 w$ h
- static int bcnt = 8;
2 R+ O2 ?% G" A9 ] - static int ccnt = 8;
: z% s* i. G2 F, F/ |( z - & S d6 O6 {6 p, S+ m3 N" M
- module_param(acnt, int, S_IRUGO);8 Z: f5 t, t% p' E; f/ H' T
- module_param(bcnt, int, S_IRUGO);) [8 o M w" b; I% ?) n
- module_param(ccnt, int, S_IRUGO);
复制代码 7 |1 D# i# Q1 H# {; |
' O9 F7 W3 R* J. f" `, d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 \& _( |! p% l1 O0 o5 W! U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% \7 l' j1 d* x. R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 u: U4 i% K# f: E
& g4 U- X6 r: J3 d: x5 ~- g; r+ S. P* B3 V: z
|
|