|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( x m8 X8 f) G( G2 b
- [code]EDMA sample test application! A# O2 o1 t2 x- {$ l
- /*" Z/ I8 v% g& U2 M5 a: H# Q
- * edma_test.c
) U' j, _( L; i' @9 \- q - *
N, a7 B8 Z, ` - * brief EDMA3 Test Application7 P2 a1 ?" B) \. k* u4 H
- *
' m2 v8 S5 M: @/ p3 J, S* Y - * This file contains EDMA3 Test code.
, _$ }8 g! i6 a# H$ s - *
8 D& V: ], K2 Z3 Q7 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 E6 Z& U3 ~3 @* X) \' K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& {) a% _& l3 U. e5 Q+ {6 i
- * TO CHANGE.4 {$ Y" s `, a3 S8 A
- */ v. Q4 L, k2 G5 }( C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 m6 {9 J& e4 `3 {
- *
! T/ C" h5 P4 S8 k. Z - * This program is free software; you can redistribute it and/or& t8 o% e9 {$ H5 P+ |. }
- * modify it under the terms of the GNU General Public License as
p; f1 t. w) u/ p. U& ]( ~" m - * published by the Free Software Foundation version 2.# U% x: V2 l) Q9 d! S- {, D/ o
- *
' A- w6 ~4 j. M# t8 w+ k5 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 A2 f7 h+ ~4 N% o8 b- @: U" b
- * kind, whether express or implied; without even the implied warranty5 R: i2 A# e: w) a2 c& u1 j3 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ b p' ^, T$ h" h, @" b - * GNU General Public License for more details.
a5 r8 p/ s" A+ d! t - */
, |) T1 J+ x) i0 e/ P - $ G4 {! X7 C; c7 Y0 }
- #include <linux/module.h>
% `8 g$ G( N4 ~, L9 V' C - #include <linux/init.h>
A# g. f( N) V" @% `; S; T - #include <linux/errno.h>
% M. h+ d3 H" w4 w( ~7 m - #include <linux/types.h>- @( S. Y% Q( q: E% m4 R1 O
- #include <linux/interrupt.h>! M& m9 P, S) D& e& C
- #include <asm/io.h>- F; O7 M+ Y, J% L, ?: s1 {
- #include <linux/moduleparam.h>( R6 e. v4 f( E9 f _# b" H6 \
- #include <linux/sysctl.h>
' ]3 d* v$ y& L - #include <linux/mm.h>
6 x5 D0 a" z5 I - #include <linux/dma-mapping.h>
7 x1 T1 U5 d& s4 Z4 A* B, Q8 y - 4 g$ r, U" ^, ~% ~$ I" z0 j3 i- o
- #include <mach/memory.h>
8 {( s% x3 {# _- u& W5 a" X' m - #include <mach/hardware.h># V# g7 l: U5 p" M- k; B
- #include <mach/irqs.h>. j7 e( V/ H3 x
- #include <asm/hardware/edma.h>: }6 Q. W7 c' `6 |* M
+ [# x( ]% ~- Q+ k6 A; q- #undef EDMA3_DEBUG/ I- k, D! a8 T2 U, f
- /*#define EDMA3_DEBUG*/
% B: P: L; i1 l3 E( T) H - : S4 i' ~- f+ m4 d) y+ h
- #ifdef EDMA3_DEBUG
' [: S; m1 P: o4 C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% j0 f/ ]6 h0 |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 U0 o* m t( J. j) A8 ^* a h8 b8 z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* \( R% z& L' ~% M
- #else
/ \5 M1 u6 q/ Z, @ - #define DMA_PRINTK( x... )4 n3 a, ^6 n$ o% J: Y& C2 F
- #define DMA_FN_IN
# g' B0 p* F/ p9 d8 J - #define DMA_FN_OUT
/ D" A, v0 `* C5 f - #endif+ r! C5 F8 Y5 j) k, b
8 ~" m' {- P/ x' V$ ^/ F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 J& ?* A! }. a
- #define STATIC_SHIFT 3
; {7 P% X. Q7 Q8 L5 o: }: ^ - #define TCINTEN_SHIFT 20
5 q7 N& Y8 \& P- { - #define ITCINTEN_SHIFT 218 S* a. K0 w/ O( C ~
- #define TCCHEN_SHIFT 22
' \% J: S( U5 S6 I$ r3 ]9 N - #define ITCCHEN_SHIFT 23( {0 M' C7 z) m# r) L
4 ]' p7 C. ~. E# B+ I3 x8 g6 O- static volatile int irqraised1 = 0;7 z! Z1 o1 _7 U. J
- static volatile int irqraised2 = 0;
9 h5 ]* X6 `/ v) [ - 2 E/ f( u' N# |# M# T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& i9 ?, F/ r* L) _( B+ x. E5 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- y, s" f; O" d; [% Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% c) U0 F+ G/ B# x$ c* A) ~- k
" L4 A* Y. s" h9 G0 b- dma_addr_t dmaphyssrc1 = 0;( s( t2 y0 N/ ^# r/ C3 ^0 M. {# o" O5 z
- dma_addr_t dmaphyssrc2 = 0;
" u# q0 e6 i1 \% Y8 z# | - dma_addr_t dmaphysdest1 = 0;( h0 s$ B" s9 ?1 w/ G3 Z% m+ t/ R
- dma_addr_t dmaphysdest2 = 0;% O5 X5 K" f# |4 [; E& u
- ! r, G0 x! X f. L3 f7 l/ P
- char *dmabufsrc1 = NULL;
1 [& T2 P* v* {+ e - char *dmabufsrc2 = NULL;
; L, }3 y' |( \& F4 `9 h! _5 Z - char *dmabufdest1 = NULL;
! i7 k/ _3 ?/ [7 U1 a E5 m - char *dmabufdest2 = NULL;6 y+ W. P0 N: E( j$ c
- ( I0 M9 l) k. i, q* |
- static int acnt = 512; G% m H3 u& W( C& N! W( a& p/ U
- static int bcnt = 8;+ U1 M1 t8 H7 Q5 |" _
- static int ccnt = 8;
6 {% P, q1 Z3 m) K/ ]. O
+ ~" j% j1 N' C) A- module_param(acnt, int, S_IRUGO);
1 P! K% w4 e$ s: v# L9 g n1 B4 n - module_param(bcnt, int, S_IRUGO);
3 |8 J* o: r* M - module_param(ccnt, int, S_IRUGO);
复制代码
; ~7 U r1 G$ M% X. {
9 g$ w, y7 N- }0 i: W, L+ E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# \( ?# ~6 O9 T- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 n/ Y* Q2 f3 E6 _: Y3 X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 l1 H1 h* y! x! R
9 {) u ?& ~9 ~6 q1 Z$ W. N3 |& B9 t; q- q' |" T& i6 \/ j
|
|