|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
a& h: V" b' h, d- k- [code]EDMA sample test application7 ^7 R6 m- I8 T+ b4 ]- i/ d% |. j+ Z
- /*5 ^/ j# M! X/ j2 _6 { X
- * edma_test.c! E& [3 F; f/ H' P
- *
3 K |* O( }3 c - * brief EDMA3 Test Application
6 v* Z" {) i! p - *7 ?5 \# S4 ^+ A% }" K/ o; x* {
- * This file contains EDMA3 Test code.
9 ]3 s4 v0 x( i: M, y9 ] - *$ Z3 X; d( s! h( a0 ~1 l5 s' j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 B k; e6 n, ~) `. n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* E" M$ D2 o7 l7 S; A
- * TO CHANGE.
4 ^- o' a7 Y& J9 R# Y6 w - *
5 Q ~2 I4 I& J/ [4 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" b3 q* E: L, i i# a' D6 L# K - *
8 g4 K9 D1 H3 d5 _" S9 O - * This program is free software; you can redistribute it and/or( ?0 k+ ]8 f7 m8 I
- * modify it under the terms of the GNU General Public License as( u" a* ~3 [: |
- * published by the Free Software Foundation version 2." s4 {5 Z7 Z3 X! d" n' Z
- */ J4 U- B' V& l' }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 e; s; D. a; k3 L
- * kind, whether express or implied; without even the implied warranty8 k7 o* r1 Y( {! P D) N0 I- G7 ~$ E L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' w' X. k/ {4 b7 [4 n! [ - * GNU General Public License for more details.
6 H" b. @$ I- }7 e& B) v2 g - */
. C4 g0 s7 U" v! K0 l: v
. e' n, W2 A7 W+ {- #include <linux/module.h>
! F/ I _" p- u1 ^ - #include <linux/init.h>- K% h+ d. L1 |5 U
- #include <linux/errno.h>
& j+ G/ O0 U- _% \: y - #include <linux/types.h>
; B- h- ~* m2 m5 e - #include <linux/interrupt.h>
9 n5 Z9 F! \2 d3 I$ ^9 W - #include <asm/io.h>
" c& P2 V" s! k, s* ^ - #include <linux/moduleparam.h>% F% ~" P0 O4 w5 s
- #include <linux/sysctl.h>
0 }6 b K8 h- v4 L t2 P7 {4 \4 l4 i - #include <linux/mm.h>
. ~6 v. \# N; x" e1 t - #include <linux/dma-mapping.h>4 l6 M3 _0 C7 e1 l
- " n, ~2 `5 n. `4 z" B2 I' X
- #include <mach/memory.h>
- O/ Z# T0 l o Q0 O - #include <mach/hardware.h>
4 O" ^* d$ x- }7 N [1 A - #include <mach/irqs.h>
$ y8 n# x+ |1 _1 W - #include <asm/hardware/edma.h>$ H' _7 e* u8 r2 N5 U; S9 C8 Q" m
0 T: `& `( A8 u5 T7 h* n- #undef EDMA3_DEBUG
6 _9 p# s4 E" c! ]: e - /*#define EDMA3_DEBUG*/7 O" f. E6 u8 g! y. K( _
- $ N$ t4 a; h' G+ B i
- #ifdef EDMA3_DEBUG- ?2 o7 x" l( Q4 I4 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* Y/ i$ [3 B& o3 ]8 \$ j; N1 x6 ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). k7 K. e/ ~' _5 U* P: X' G" v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 s% V3 _- h; \2 J* A - #else
5 V3 L/ @6 t" i( w - #define DMA_PRINTK( x... ): Y' f: A: v4 H3 L s
- #define DMA_FN_IN0 _& S# @# X+ Q2 F
- #define DMA_FN_OUT o n5 @ H+ q0 s' I+ I
- #endif5 Q& M1 E/ F d1 H/ _/ h
- W* \ `7 X: |$ _( Z# O& S$ e4 H; K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) X5 e' b$ y$ w+ ?: f5 L( [
- #define STATIC_SHIFT 3: a- i3 i3 M! r8 j" B+ |! s
- #define TCINTEN_SHIFT 20
7 S" |# |! ]' N7 x - #define ITCINTEN_SHIFT 21
r, y! g# O7 s d, M - #define TCCHEN_SHIFT 22- I& P" k( |' M4 }
- #define ITCCHEN_SHIFT 238 o, w: V" R/ B) @8 X$ R( b
* A( I G) F9 }5 ?) U- static volatile int irqraised1 = 0;
; N o& y4 h$ _$ m8 r" l/ ^) { - static volatile int irqraised2 = 0;. j) o# ^2 z1 M( Y. H/ z
- ) M1 {4 |( m9 A! f4 n( K- p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 [9 P3 s# g7 M: P/ k, E" L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Y5 k6 ]$ U i0 L# C7 W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) l. S+ ]; z* X2 r8 d
$ ]1 w b. s; b, h" h! j* F- dma_addr_t dmaphyssrc1 = 0;4 y7 V; D& d$ X9 e3 X% c
- dma_addr_t dmaphyssrc2 = 0;
C; q( s; j9 J) i - dma_addr_t dmaphysdest1 = 0;( @" U+ R' b I( I. R* C
- dma_addr_t dmaphysdest2 = 0;
9 h, X- P0 P5 V9 K b: b" L2 h
# H/ I1 H/ [+ n# l3 g- char *dmabufsrc1 = NULL;1 M( w9 B- O3 X( J
- char *dmabufsrc2 = NULL;( \5 V( \4 _% p+ ?: R7 k
- char *dmabufdest1 = NULL;9 F& l' a. O1 m; U9 a
- char *dmabufdest2 = NULL;; h6 P7 j9 u, b# c+ f4 C z8 O+ I+ j
- ( y, Z8 ~- b$ O/ P3 i y' m. X
- static int acnt = 512;
9 j7 l. Z+ l( a7 M9 C - static int bcnt = 8;
+ c; n; ?! `4 j1 b2 u( C" | _! G - static int ccnt = 8;2 S$ r: }1 P* U1 l. Y1 x' `
- # j% b' E; ]" p$ R) K% b
- module_param(acnt, int, S_IRUGO);5 \2 h3 c' v/ u
- module_param(bcnt, int, S_IRUGO);
/ F' U9 u, i9 @7 T8 B3 b' i1 H% S - module_param(ccnt, int, S_IRUGO);
复制代码 + B% S h/ ~9 Q+ \# U
+ R- T0 E: M* [6 K) j' i: O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 L8 e9 C5 I' g$ L0 ~, o& o$ q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 R' f# a, b" w- J+ {' t( L8 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ W. U0 T) J, Y
3 D$ [8 B) J' H& s! U# V7 V7 p/ w: A
2 o1 s6 z: Y* h G2 c8 n
|
|