|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & W1 V& N3 q0 U. {/ F
- [code]EDMA sample test application
3 F, t7 s" W8 i; S+ l5 n - /*
' ~- ]( v" C4 i$ n$ e - * edma_test.c9 c; ?: w7 n3 O
- *
# ?! h! X# _& s6 v- D3 `, C - * brief EDMA3 Test Application
$ ` C# B |% x - *( Y* }0 K$ M( @5 \0 y3 O0 [) S
- * This file contains EDMA3 Test code.
9 j8 K4 L( }( s6 C6 c - *( Z( o" C2 b6 x W# ~( K. Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" X7 I/ {0 x2 H. x4 `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ B6 n7 ~2 R! L3 w( J5 Q8 d - * TO CHANGE.+ ~6 S3 F# u Y
- *
! i- n$ T% \) n% ]6 i7 h I& } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 n5 Z9 B0 D2 H3 ], Z: T( h - *
% `3 F. {. u/ E- Q+ K - * This program is free software; you can redistribute it and/or7 O5 d- J6 n- {2 K! i) o
- * modify it under the terms of the GNU General Public License as; d$ k2 o4 }' G" I0 |. v- v% r0 R
- * published by the Free Software Foundation version 2.
8 v, S7 W2 N& Y - *
$ s; V2 X* |4 ?3 L" O) c& {; ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* E# |# G1 K+ V - * kind, whether express or implied; without even the implied warranty
- y' Q& U" i" K/ g- p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 O! s0 V) X% g$ q
- * GNU General Public License for more details.
) J( c, R3 j0 w4 q# W9 f - */$ O# v* o$ T; {( ~) M
- $ u# ~1 o/ w+ l/ Z7 X+ {* }
- #include <linux/module.h> f8 [0 W; }6 I( Q- j# B
- #include <linux/init.h>
: @# ]7 g- R3 S% C! i - #include <linux/errno.h>0 U) u7 d/ F+ u7 p* c* B# c
- #include <linux/types.h>
: s- P, |, L* O3 Z - #include <linux/interrupt.h>
. B* W5 P$ F3 r$ { - #include <asm/io.h>- P0 q' \( F. j5 `6 X
- #include <linux/moduleparam.h>4 o: o& Q9 s: i/ _" E: B
- #include <linux/sysctl.h>9 P. N& B5 I# e* C4 d& a
- #include <linux/mm.h>
: n: u8 ^" V! X - #include <linux/dma-mapping.h>5 b5 ?4 U7 i5 H4 U' U
5 ?6 @* F! r# t& T- #include <mach/memory.h># S6 ~! h6 ]( a6 }' {
- #include <mach/hardware.h>2 v/ t/ s7 o& ~: h; |6 G- t
- #include <mach/irqs.h>8 B# `. X1 Z% X
- #include <asm/hardware/edma.h>
0 v' X4 o! N) Q# |' [! l( A - 1 F7 i, K) v! h, \9 N. ?0 ?8 q
- #undef EDMA3_DEBUG
, ~1 p; u" o' q$ R" c - /*#define EDMA3_DEBUG*/
1 w9 h7 z% X, {0 ^
7 F6 m# J2 O1 m8 a) l' a- #ifdef EDMA3_DEBUG
8 T' e N5 Y) I3 ^4 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 ~! }# D" R, @( B' ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 K3 D0 Z, y4 T& R7 H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ ~2 V( ^ {3 ~ - #else
- |" T* u5 ~ ~9 y - #define DMA_PRINTK( x... )
" I* X0 R2 n0 F3 ? - #define DMA_FN_IN
( N4 V' n$ p& V% `, U: _ - #define DMA_FN_OUT
: r% i Y: V9 U1 t3 m - #endif, Z g( H, x- x) s; x4 T, o
) C& A1 e" Q$ D/ j8 s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 y! e4 _( P8 F) O( j
- #define STATIC_SHIFT 33 ? x3 {9 ]' V* g
- #define TCINTEN_SHIFT 20
, ?1 ^" G% m( c9 @9 I4 C& a, P - #define ITCINTEN_SHIFT 21; B" u* b' f6 r9 D
- #define TCCHEN_SHIFT 22
9 V7 b/ ?/ p- _0 w) D - #define ITCCHEN_SHIFT 23
4 U- w5 Q* N2 S0 I# X) [- p
: F3 s$ j) E2 ]. O3 k- static volatile int irqraised1 = 0;# `0 d# O) U/ G6 ]) }" o- @2 o
- static volatile int irqraised2 = 0;+ a; n; [* s* r! m
8 Z) f$ W# d! L R3 R5 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 e; w" l8 `2 P8 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 F2 R) C3 {9 ~2 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); a7 o! H2 }$ V6 H! B4 b6 q
1 l- P6 L% V- ]- dma_addr_t dmaphyssrc1 = 0;
3 ]1 w8 T6 c" ^) E% `: N - dma_addr_t dmaphyssrc2 = 0;" j, O; A$ X' O' o2 I
- dma_addr_t dmaphysdest1 = 0;0 g/ m, ^3 q9 J0 ? Y( p
- dma_addr_t dmaphysdest2 = 0;
4 E4 [. q. D! y3 N9 k
$ d+ A! K0 n5 X% M& { F+ o- char *dmabufsrc1 = NULL;% |2 H$ v& Y W9 c* t" |. M, ?
- char *dmabufsrc2 = NULL;4 ]5 Q. S( b+ x$ x
- char *dmabufdest1 = NULL;
, q# A% x: S; P7 A - char *dmabufdest2 = NULL;
% ~2 J+ n* @$ v& Q - 6 o% `, v' L7 b6 N: g( b, S5 D
- static int acnt = 512;
9 ^7 d @" k }) l' X1 K& x - static int bcnt = 8;5 l; r4 U8 }* F4 y, N
- static int ccnt = 8;
& o+ {6 K; Z" u, l# Z& N9 M. N6 T
1 k! F5 `( F; L- module_param(acnt, int, S_IRUGO);# L' y+ Q: N3 d; G3 K
- module_param(bcnt, int, S_IRUGO);
& Y9 L- e! F3 b" i& w - module_param(ccnt, int, S_IRUGO);
复制代码
) j7 s, y( n; x& J- W# L, F8 k4 x: t" C& a$ H# x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 l G: b( u8 C y6 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 S ~% @3 \' a7 R/ ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) N C" d, ?: I4 Z4 {+ t: o% ?9 d
9 A- X5 z* z# v4 q3 Q* l0 Y! V5 Q% L! z4 @& v! a, W7 P) h9 v4 s
|
|