|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 K% w6 O# d' Z" ?! }" d3 `- [code]EDMA sample test application3 w$ e5 G, u( j6 S
- /*
% Z# q8 H9 A3 p0 T5 c# u - * edma_test.c
3 ]; F1 }' u% r" Z t* U - *
. y* Y/ p0 E" i0 u9 X# T" x$ w4 w - * brief EDMA3 Test Application
# A( ?+ f. l4 m3 c ? - *3 \) a: Q, l7 \5 v0 O( T- ~* S
- * This file contains EDMA3 Test code.# T, \8 j! C. k' `1 h
- *
4 d4 r$ `- c; z, S9 T0 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 B( H N! `% Q" f0 P/ P: S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% U& m& l4 H! P$ m1 a - * TO CHANGE.( g/ k( q( W0 e) p' i9 I9 C
- *
6 C; }/ M" |" l/ W4 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 l- P4 z: F% b4 q - *
4 m! W9 g5 |/ T3 N - * This program is free software; you can redistribute it and/or
& n0 [6 m6 n7 G B9 B6 U' O - * modify it under the terms of the GNU General Public License as
7 O% L( Q0 C7 z, I - * published by the Free Software Foundation version 2.
. C7 q6 H; W4 ?! g. x - *3 r( h5 J W: Z7 U) o* h: n3 d+ o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ V8 r7 t& F5 F - * kind, whether express or implied; without even the implied warranty
: E* D P! p" c4 z# E$ u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 e5 u' Q l" K* p! L2 h# ^ - * GNU General Public License for more details.
) E, ^1 a9 ?$ p8 f* T - */2 G6 E2 J2 a: i$ v& L3 V
c8 f' R* l; V- c' X- #include <linux/module.h>5 q9 w: l# i$ f+ q% Z" T6 w- w6 @
- #include <linux/init.h>
8 s3 [% ^. X) B/ t7 K4 a+ p9 k - #include <linux/errno.h>( \) \' @3 n r) Q# S' K% Q' V* S
- #include <linux/types.h>
- U9 C9 V A5 b - #include <linux/interrupt.h>6 d/ P' g, M4 W% p5 P' P
- #include <asm/io.h>; ^) T7 N4 r* c8 k! u- L+ D; n
- #include <linux/moduleparam.h>! n9 \. A! D' q4 F. b. G
- #include <linux/sysctl.h>
* _4 x3 D7 M( J; L7 y/ W. I/ d' O% E - #include <linux/mm.h>
4 Y2 Y. j5 P- ~$ X - #include <linux/dma-mapping.h>
0 q3 N+ Y1 i, i/ f+ z; Z9 Z - 6 h( q% ?% `1 R
- #include <mach/memory.h>
! z- n3 H+ ~/ H$ `6 t) ~. f - #include <mach/hardware.h>9 T" H+ H; Z! { S5 K3 G
- #include <mach/irqs.h>
3 p' _$ d1 Z& ~1 t9 m - #include <asm/hardware/edma.h>
& p( X C2 O& `5 v8 ^) o
0 r6 e/ l/ F, }- j8 A& A- #undef EDMA3_DEBUG
- i7 w, v e& [7 G - /*#define EDMA3_DEBUG*/
/ v! G. o8 p" q* H* R$ p+ | - , N0 @$ J) i1 p3 c! k% A6 M& H
- #ifdef EDMA3_DEBUG
9 _1 \- c7 @5 X: C: J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 j+ p. V$ q, {1 n5 ?: | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! U* m; \% h. ?% c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 s" a$ h% O8 b5 N - #else# P! T6 D. L- C$ i, l: }, X5 o- \
- #define DMA_PRINTK( x... )4 O, L/ D+ _- I" F) ]
- #define DMA_FN_IN
% l0 t* |8 K/ X, G, m - #define DMA_FN_OUT: \" N- j- i# ^0 N0 d% O+ ^3 G
- #endif/ k7 y# N N1 }) }( O7 P, h3 b) C
: [& ]6 p9 Y, Q8 ~4 o0 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; w/ a" X R. S- N - #define STATIC_SHIFT 3
$ {4 i% V' X8 @& r- v5 g! A% p( k - #define TCINTEN_SHIFT 20& V) W; A+ s1 x! P# J. U d \
- #define ITCINTEN_SHIFT 21
' ]0 ~ y( ^$ I _2 {5 ? - #define TCCHEN_SHIFT 22/ Y1 I) t$ O/ ]( f7 n8 g
- #define ITCCHEN_SHIFT 23- [/ j& ^* h& w1 l. Q
- , a8 z x) d3 o% N0 I" M
- static volatile int irqraised1 = 0;
9 a9 V0 R4 F4 R$ x1 o+ Z - static volatile int irqraised2 = 0;" X' w( G& I1 S' |' T6 D8 S$ [
- 4 K1 D, f% [7 F) ?6 ]7 M' K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 s# p8 Z# x+ k5 H6 Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' J* }$ ^' n7 Z: E) B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" q% ^( I) A1 ~/ x! k( R9 j - - f9 S. e3 C; o
- dma_addr_t dmaphyssrc1 = 0;) P; j0 g8 J0 h" V5 e* p- k
- dma_addr_t dmaphyssrc2 = 0;8 r0 C( m% w, i$ K' A& j4 t8 m
- dma_addr_t dmaphysdest1 = 0;
. Z" |9 e' J Q7 V6 i - dma_addr_t dmaphysdest2 = 0;( m' a6 o8 R8 ~0 {
p A) F+ n% W9 z- char *dmabufsrc1 = NULL;% y i$ W- C A+ M5 t/ p! \
- char *dmabufsrc2 = NULL;6 L/ o9 S1 @" K7 U4 @% H1 i
- char *dmabufdest1 = NULL;
6 Z3 C+ O6 w# z( a. G: ] - char *dmabufdest2 = NULL;
: U- t: a& B+ z \ y! D* a) J) u - . _, ~+ J, S9 B0 A
- static int acnt = 512;
; @5 X, j' }! \( h& W - static int bcnt = 8;
+ o5 c4 D7 x! c - static int ccnt = 8;8 C% O8 u# B4 e! B
- 1 p% h: [" l- F8 @+ H) Z
- module_param(acnt, int, S_IRUGO);
% l$ K* ~9 [ w4 z& y# ^8 [ - module_param(bcnt, int, S_IRUGO);
* |5 b4 ?: k8 Q# S/ L - module_param(ccnt, int, S_IRUGO);
复制代码 ) k* _7 X' t6 W) x
, u" W# j& L- C7 N$ ~6 l! _* b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- y' g' t8 H' _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ P6 H9 r5 e$ V( r4 p2 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- i) a: e- j: W: h+ d% E
( d" T8 B: D" v" t9 j1 y
! [; P( z' D, _$ x9 [# P
|
|