|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% L8 L, {2 n, _4 W s' r5 H- [code]EDMA sample test application
) D2 ~& J4 U% L. u9 g) H2 l2 U - /*
( I0 h Z* e% ?" a: Y0 B - * edma_test.c2 J$ O: Z4 o( W& A. b% `
- *
# }! q( e+ ~8 D8 P* m' f - * brief EDMA3 Test Application
7 P; {+ Q) A# W) T1 z - *
Z& U* I, y' g; e f q - * This file contains EDMA3 Test code.
6 j$ t- C" m2 ?$ G' j - *& C' k# t3 t# U# r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: B; a( k9 f. i$ ~( H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 o" L/ f$ [) ?& m' J8 I
- * TO CHANGE.) k$ _. ~: h7 A6 C
- *
' D) a# J6 Z/ F' u+ [6 J/ L. D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ s$ Z \. G/ W) q' a
- *
; L3 A1 I/ ?1 G( ]9 s$ Y, p" w - * This program is free software; you can redistribute it and/or) n5 [3 n/ J" S# ^
- * modify it under the terms of the GNU General Public License as1 W( D8 K; Y: M, d
- * published by the Free Software Foundation version 2.
1 O/ n0 T; f U8 r' W& z+ b+ i - *
3 B7 N0 E6 r7 X' e- K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 f3 N; F5 N' c7 |; P; G - * kind, whether express or implied; without even the implied warranty7 T# s$ L1 K% \' x& V9 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" [3 u7 t' t5 a. l4 T9 T - * GNU General Public License for more details.( U1 [! D2 N- k3 m8 X8 Y
- */
1 K/ u# j% a: \) v - * l. \# C2 y4 y
- #include <linux/module.h>+ L4 u; Q O+ i8 v
- #include <linux/init.h>5 m U( b" I7 j2 E/ F( f% x, i
- #include <linux/errno.h>
" E4 u3 K& l) U; S - #include <linux/types.h>3 r% \2 ^- x7 Y2 A% L1 Z
- #include <linux/interrupt.h>
+ B. {7 }8 H3 B/ i - #include <asm/io.h>
6 w# X. b& D2 |' c) _ - #include <linux/moduleparam.h>1 h2 S+ G7 h# s+ L$ t/ @, b$ L
- #include <linux/sysctl.h>
# R- a! f, e+ a( a! Y% b. O7 [3 a - #include <linux/mm.h>) Z' D2 e0 `3 W$ M4 v" W" y
- #include <linux/dma-mapping.h>1 e! h% @' K7 u: k/ L1 S
- * Z3 f, X: x% Z1 o
- #include <mach/memory.h>
, ]/ `7 c+ f. ~; S( T, j - #include <mach/hardware.h>
2 R+ O& i5 Q" R; Z- a; {' U - #include <mach/irqs.h>, w& X0 X) y" B" {7 i; n/ N- y
- #include <asm/hardware/edma.h>& a+ Z, K: t2 e$ F9 o3 c- L
- % b$ M" q' e/ r$ Z+ P* v* F
- #undef EDMA3_DEBUG9 }- W4 c- N- \% D
- /*#define EDMA3_DEBUG*/5 K% m; b; E: q% Q
- 6 K! \6 ]. ^1 |- k0 _
- #ifdef EDMA3_DEBUG
5 s: o: x- q7 H3 F' _: Q5 k R; m# b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( _, K: U0 Q8 h7 j* F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, `/ J! @; E5 C# c3 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' Q& ]/ f1 Q S( E& v
- #else% W' V, y& i! w7 a' b
- #define DMA_PRINTK( x... )
3 Y, u3 k5 M$ k; a& e W% b* |, D - #define DMA_FN_IN
% k/ [+ t* s4 A. Y( s - #define DMA_FN_OUT
$ g& y0 S- W6 ]0 y, V: Z - #endif
H1 C* a% _0 p' c- U ?
6 k3 D+ ~* z# Y- [: Q- }! p" A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* ^& C. P1 y) C2 }+ w* H
- #define STATIC_SHIFT 39 [$ j4 m0 D" R' f! O& o O& n
- #define TCINTEN_SHIFT 20
3 U& ~3 j" ]4 T: l& k - #define ITCINTEN_SHIFT 21
, |1 }; i$ x- U4 e: C* B - #define TCCHEN_SHIFT 22. ]4 x$ U6 g- Z
- #define ITCCHEN_SHIFT 23
7 K. k- i4 Z* {) W% R9 V) G8 n - / c: x& X" ~$ r/ X4 u
- static volatile int irqraised1 = 0;& n& ^0 V# L. ]$ X5 [6 D* O4 h6 y
- static volatile int irqraised2 = 0;
. B- |$ N0 A0 T3 J, Y5 ]0 C - 3 a: B8 u* h6 A I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% h, F' ? U8 ?) D! p% u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# i. [4 }: r+ O4 e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 u9 |, h v8 G# S M - * N, Z$ j( {! m) C% `
- dma_addr_t dmaphyssrc1 = 0;. X; j# U, J% I2 C( E
- dma_addr_t dmaphyssrc2 = 0;
9 X+ S1 E* h0 `8 y8 k - dma_addr_t dmaphysdest1 = 0;
8 }( @: n7 u- d# O! n" w$ U J' v- \ - dma_addr_t dmaphysdest2 = 0;
# c3 O6 X5 W1 \# z; n
, O! {: J, a& r- char *dmabufsrc1 = NULL;4 m5 w! E3 i% U' y
- char *dmabufsrc2 = NULL;
" k( w4 C- l' k2 R$ G* f - char *dmabufdest1 = NULL;* i% ^; V6 v, R# n; p0 G0 c% R
- char *dmabufdest2 = NULL;2 k4 L3 t5 S2 S, P+ m
9 [' d7 _- }; {9 C) u- static int acnt = 512;" ~1 U! u/ J8 A, A0 x: X
- static int bcnt = 8;
S1 U7 s) A" x" j0 B - static int ccnt = 8;
0 ? a- I7 q& O, g' R( [, r - * w" g+ @: {% T, f% o0 Y! C
- module_param(acnt, int, S_IRUGO);4 L, N1 u- k( q7 H- ^; Y7 C6 D/ Z
- module_param(bcnt, int, S_IRUGO);
6 T# B! T4 t4 S# D0 B R4 g" p' ? - module_param(ccnt, int, S_IRUGO);
复制代码
# j$ h( s: F, N, v9 A5 a, o
3 M( S |# z, _5 E* f0 B/ n o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 ~9 m% U7 r* n6 r9 X
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 z. O2 @3 ~2 s* Z: U) C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 L3 K$ ?7 ^2 L) J. a: M; Q w% u
; Q* v: T5 j% u& F3 \9 b
2 `6 ~2 h* Z$ L- |
|
|