|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * e! i; g; k& d" h/ k/ c
- [code]EDMA sample test application
+ i; Z: c( ?$ K9 p$ u) Y - /*6 q* r4 j- m C: j
- * edma_test.c2 K: @4 B5 [' t' m( z. r
- *
3 i* Q( S3 l8 G ^ - * brief EDMA3 Test Application' _6 _6 b+ M. @7 I; Z
- *
# {; \+ D( e, [3 n5 s8 O - * This file contains EDMA3 Test code., G6 Q0 f* Y& Z! p2 ^0 E
- *( }8 `9 O n3 h" R# X+ Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; |: a: ^7 Q4 U, R+ j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( w; J' k( J5 ] \
- * TO CHANGE.
- C% ]- f' b8 W: z C7 f y, c8 d! E - *
9 B0 X2 u9 d. D* \; h$ y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# m3 h6 Y# s7 ^7 }% Q
- *
8 Y- f: P8 c: R/ _% N) y - * This program is free software; you can redistribute it and/or- q" _! e+ D; {5 M' c5 ^
- * modify it under the terms of the GNU General Public License as3 L" I/ p' A9 ^' C) l# I$ I
- * published by the Free Software Foundation version 2.
+ O; R( M) ]2 @, `# Q Z - *" p$ [( b: L' }- _4 W y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: f: v$ t H. p$ A; N) [ - * kind, whether express or implied; without even the implied warranty
/ p0 f. R, W: m+ V# ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 F" n! }' k9 e, x8 s - * GNU General Public License for more details.8 b# _- y: K! K1 J. c' M/ A
- */
5 W4 Z' ]/ F" G/ a6 w - : n& K8 z1 `8 t( H$ v: ~
- #include <linux/module.h>' X+ F$ U( R: z; }# {; f$ x8 x) m% T* g
- #include <linux/init.h>
. g7 d# N- O8 B3 |5 g! Z; c" _ - #include <linux/errno.h>
4 @; N7 w# F/ P$ r" w | - #include <linux/types.h>2 _9 ^4 z5 k% G0 Q* {4 k
- #include <linux/interrupt.h>/ `( n5 l" n+ T: g" J0 i
- #include <asm/io.h>. Y% W) z) i6 o' }
- #include <linux/moduleparam.h>
* i3 o# }# |5 t& w& j9 F! W, T - #include <linux/sysctl.h>3 }. Q/ B7 L- X
- #include <linux/mm.h>
, {4 W5 b# V- r: f - #include <linux/dma-mapping.h>9 ~- m6 S9 v" N: x( `& L
$ l* m5 y( Y( X# `1 ?8 k4 g- #include <mach/memory.h>$ c0 E2 o' [% }! Z, O
- #include <mach/hardware.h>
' g% L/ ?0 i! V6 ?9 S; N - #include <mach/irqs.h>
. G9 j( N5 v5 R# U2 j7 J7 p, N6 t - #include <asm/hardware/edma.h>) B; b k+ ^1 I2 e% S' [
- , `3 B# i' m% p3 Q
- #undef EDMA3_DEBUG
$ V6 _* q! S# Z0 W& { - /*#define EDMA3_DEBUG*/
4 V9 _5 |; h: q U - , p1 o5 N) \' y% [) M
- #ifdef EDMA3_DEBUG# \; @/ A# d! _0 k# v' k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 ~/ ]; H3 t/ M1 m+ _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# @% M$ G( _+ x6 Q! v: b/ s! b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 h7 L$ ~( q. p# ^2 d
- #else" z, |) A/ |& l4 z: L: T3 [+ W
- #define DMA_PRINTK( x... )
: g7 _/ r. a/ d7 S$ W - #define DMA_FN_IN
& {+ ^" { p1 s ] - #define DMA_FN_OUT' @0 i7 F. U9 W: w1 A% f; B
- #endif: N8 O9 Z& T9 _+ ?
0 Q" s% [4 Y4 R+ \) M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* l7 g5 H' a2 L% F: ?) `: ? - #define STATIC_SHIFT 3; l y9 ?8 T9 a
- #define TCINTEN_SHIFT 20
6 Z6 D; _5 ^7 b6 b- Z - #define ITCINTEN_SHIFT 21
& B/ b j/ Q1 Z - #define TCCHEN_SHIFT 221 e1 ?7 _; ^8 R- [6 a6 [
- #define ITCCHEN_SHIFT 23) W$ b% O" b a% y, d) c
4 p# t0 m! G$ k3 G9 R3 q, W) n- static volatile int irqraised1 = 0;) c7 X; [& P& M0 h
- static volatile int irqraised2 = 0;
# S$ i: {& v s - & M5 Z+ P; |3 M- b2 A! y# u0 P# N8 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& M) c! U I0 W9 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 m" A8 w' r, Q3 T. I) b* B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% j6 O; J9 T) H/ W* Q& E
) t, R \" n. ~" k$ T8 M3 b$ V& w2 I9 K- dma_addr_t dmaphyssrc1 = 0;- R4 M7 K4 r) {$ ^
- dma_addr_t dmaphyssrc2 = 0;
' K; E( R$ e7 g% W( ]' ^ - dma_addr_t dmaphysdest1 = 0;$ f8 j& k2 N. t6 B5 T
- dma_addr_t dmaphysdest2 = 0;
" `: s, C- Z. C) c k
! p0 d6 A5 ]9 W8 J; R- char *dmabufsrc1 = NULL;
) u% [) Q2 `4 X0 p+ }/ j$ n - char *dmabufsrc2 = NULL;
0 N, ?6 C1 p5 h# u4 q# A- D" E - char *dmabufdest1 = NULL;! B3 H- s3 P: U' t* T6 u: {/ w
- char *dmabufdest2 = NULL;
7 w% e$ Q, h# s& x% c$ M
! [/ A( g, h+ X2 b- static int acnt = 512;4 l6 t$ D' D9 y" m/ T& N% @
- static int bcnt = 8;
0 u# A, h/ A+ W) t; Z - static int ccnt = 8;, n. B4 {) n6 s7 H6 {) l' q
; T" S' G4 r4 z* S6 H2 i8 t- module_param(acnt, int, S_IRUGO);
! n; f/ g4 l3 `, t+ a1 v - module_param(bcnt, int, S_IRUGO);
" t, Q6 u" j4 c8 h" H9 n5 T6 _ - module_param(ccnt, int, S_IRUGO);
复制代码 5 ?# ]$ u7 L4 \5 l4 t' K \( N, \
- o( I% K8 m3 c% ]- d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ j1 G* W6 R" L7 ~- w; n7 u" zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 Z8 l2 t8 r+ f% X' e8 Q" C9 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% i3 O' `$ Y6 P2 P' B
" Y2 L6 M2 W9 ~$ W( A& g2 M8 q' S: D& r
|
|