|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 } |# t$ B* s& ^% g; P
- [code]EDMA sample test application
2 q! N" n) X7 b% B3 S2 c! X3 H - /*
6 D5 \8 M& p# B" _% i9 z8 h$ b - * edma_test.c
( A; ~7 t [/ r9 }' m7 M - *
4 s' e5 l8 R, L# Z+ t - * brief EDMA3 Test Application1 `: Q% R1 H, B3 r5 K
- *. ^* n' `* B, B4 |6 E# u
- * This file contains EDMA3 Test code.0 z$ W- |1 [" F. k# [" e6 C% U' \
- *
! |/ {* g( _- y. q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- c: ?4 B0 R9 W8 q$ j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 g6 {: I: ?7 @+ j g
- * TO CHANGE.
2 F( T. v0 Z3 B/ k# Z9 X2 G& y1 h - *
+ h$ w, _0 {& q9 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 ^6 A `+ c9 ]0 y: |! R7 R' x3 t - *! V. y) Q8 B) S
- * This program is free software; you can redistribute it and/or! {( Q2 w% f" Z% M$ e
- * modify it under the terms of the GNU General Public License as
; O8 ?6 o( _, l" x7 j - * published by the Free Software Foundation version 2.
! ?. v. u' C/ @& {9 z7 } - *
2 |0 z! s" t. Q% y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 w9 ]7 |3 j; u! P, b - * kind, whether express or implied; without even the implied warranty
O0 O9 u1 S& z9 Y; ^2 \% ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 n& d* x/ _( h% J) ?
- * GNU General Public License for more details.
1 P( H; V# g1 K- O+ w H% ?( c - */, W0 |" t/ \: P# D
- 8 ]& l5 U: {5 `5 y
- #include <linux/module.h>+ ~5 y3 w; q" H2 r Y1 _; K6 U
- #include <linux/init.h>* S& i; e5 h# X1 a
- #include <linux/errno.h>
8 @# X5 f1 }. z5 L; _ - #include <linux/types.h>
, u) _1 ?3 Q7 r1 } - #include <linux/interrupt.h>+ X, r( ^8 {# Y& F! P
- #include <asm/io.h>. b) q) ~; K9 }4 N% j A
- #include <linux/moduleparam.h>7 t( w& y7 A+ u4 n/ ?6 G
- #include <linux/sysctl.h>- n4 x/ M5 i8 n1 E' }% T3 [8 T
- #include <linux/mm.h>
; h ~! ]# m, G6 Y8 W - #include <linux/dma-mapping.h>( v3 H2 O. z( e$ s$ b2 \$ x- V
- 9 h" i! Q4 C( G7 _$ y. d% u
- #include <mach/memory.h>& Z. W3 |% ?9 Q2 H- Q& R* }8 V+ }
- #include <mach/hardware.h>4 i* Z7 |/ D/ e5 B. f* V5 m
- #include <mach/irqs.h>' y) j' C. C4 S/ K! O" Z
- #include <asm/hardware/edma.h>" z4 W4 F1 b K f/ I
- 3 t) O! ~. G8 f, l
- #undef EDMA3_DEBUG# u. M3 ^1 D$ @8 c
- /*#define EDMA3_DEBUG*/! m( ~- J) N8 m: _# B
2 g0 @# A# W7 I1 y8 G* T) m- K- p- #ifdef EDMA3_DEBUG
! `% R1 n. i$ W g- B3 ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 e5 X+ e+ f0 [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& O' `8 l/ x( c9 l ]1 P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( r% s$ ~/ S$ F" n8 f& E' h/ V - #else" Z( I. C$ s$ e/ M4 J9 t: D9 y
- #define DMA_PRINTK( x... )
, W3 Z0 \+ L' ~ - #define DMA_FN_IN
4 ]: e, F% _0 B( } - #define DMA_FN_OUT4 E/ S" K" Z: [' ~! l# K3 |
- #endif7 K5 T# a# }9 j3 p; Y
8 E) M$ O, R7 @8 i7 y) ~' c- #define MAX_DMA_TRANSFER_IN_BYTES (32768) m7 g" N0 g+ o
- #define STATIC_SHIFT 3
3 A* l6 a) Z. k- _& ~ - #define TCINTEN_SHIFT 20
, O! u9 P. p4 B$ y& V - #define ITCINTEN_SHIFT 21
' V$ o; _4 x9 ~- W: z% h7 C4 ?' p - #define TCCHEN_SHIFT 22/ |& U, O2 H9 K
- #define ITCCHEN_SHIFT 23
8 s3 P+ g- B8 x M
) @: E$ O8 n1 m; X7 p- static volatile int irqraised1 = 0;( m( N8 r; P6 L& V. [) f5 s% |
- static volatile int irqraised2 = 0;: H/ x* t6 a: z" k w3 o. V+ S
- 5 s% M- g& w& B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. n3 Y; }4 C! x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 F9 o, @( U2 h; ~' y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K4 P1 L9 `4 h8 g" m
- & m7 P0 |: W' C" z u5 L5 T9 r' A& m* _
- dma_addr_t dmaphyssrc1 = 0;, N3 k. y* _; Y" T
- dma_addr_t dmaphyssrc2 = 0;
& t6 H* h5 I0 N( \# N - dma_addr_t dmaphysdest1 = 0;6 l. I R! `# \ B+ Q" d5 V' P
- dma_addr_t dmaphysdest2 = 0;
E) g8 t% V4 u' c { K - . J2 S- Z$ O# H' x7 j# c7 |& K8 Y
- char *dmabufsrc1 = NULL;5 ]& U7 X- k9 L- L
- char *dmabufsrc2 = NULL;% u& g3 ?* R5 L: V: L$ c
- char *dmabufdest1 = NULL;. D2 C" f4 @8 v; a6 m. g, A4 ?- R
- char *dmabufdest2 = NULL;; g2 i0 |! p: _ i4 T+ [
4 o0 E) N5 P6 j5 E- static int acnt = 512;+ m4 \) L4 M" R" b, y7 L
- static int bcnt = 8;6 d8 O7 }& e8 k' E" h
- static int ccnt = 8;
+ c) f+ x( {8 w! ^3 c: A
& }0 ^9 n& c0 G& {1 H: T; G2 `1 H- module_param(acnt, int, S_IRUGO);
c# E3 e: c6 Z; o# A& n' \ - module_param(bcnt, int, S_IRUGO);! X6 Z. ]% D2 ^7 J6 u; x1 ^- z U
- module_param(ccnt, int, S_IRUGO);
复制代码 ; F! o, A" ], q% U4 N I
; c* _3 V& ?8 }# a/ j- k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! y4 q0 ^# Y5 w* k6 D' Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 K* n1 s3 e! {5 N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; C9 a! ]- P4 P) [) Z( l9 ^1 Y
7 [9 r2 g' Y) n7 i7 M4 R% f/ v$ U7 {( ] q
5 Q5 G; i) h3 _; q }, \+ A
|
|