|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ R( Y# |: M6 o" j b- [code]EDMA sample test application
' Z4 k! S5 ?! U - /*4 L7 ` H8 i: f* v- ]$ m5 |, M. w
- * edma_test.c! h0 }" ^! j! I/ g" k9 r0 B- e8 X' H
- *( Z7 B' v' V7 @" {- E# x. W
- * brief EDMA3 Test Application- J" R. |" [7 ]* k8 _
- *
" v |! v8 C# D8 T+ ^8 U - * This file contains EDMA3 Test code.
! _1 ?% ^5 \% D2 q' \. b/ m3 S - *" N2 n! Z9 G5 u7 V4 G5 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- R7 Y( R( q6 k k! j& r B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ U* {, T2 z: V% u - * TO CHANGE.+ R+ ?; b7 t. Y& A* J1 d
- *9 ?# B; ^; E# _& V/ z9 F# \1 k& |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( h4 o3 l. i7 q6 {: i' M
- *8 X) G' I+ W# _/ L; j8 @0 ?9 w' c9 D
- * This program is free software; you can redistribute it and/or, D( {3 F: W" p% k/ w4 W3 l% k
- * modify it under the terms of the GNU General Public License as
2 U3 R6 j9 F+ x, H: j7 L$ p( h+ d7 x6 y - * published by the Free Software Foundation version 2.
1 F' B) P& M& b6 m) g/ M - *
4 J% b% W/ a+ | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ ^0 A0 W1 E: [* o: y* N - * kind, whether express or implied; without even the implied warranty
& {( c9 c7 k/ f5 @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f* P* w- `3 ^/ Y9 l# H9 o - * GNU General Public License for more details.
1 b0 U) W0 h" z: p - */
/ j% p* L& p+ T: U! b( |' _
$ i5 i( u! l# K% ?3 a- #include <linux/module.h>7 |2 o6 q* |5 u8 @ v1 S9 p. u( T! h
- #include <linux/init.h>
- S. \- _' U- i: F, f" F# h5 T - #include <linux/errno.h>
" ]% r" O1 z6 o% B) N8 w - #include <linux/types.h># Q2 U- H% B% G* h. Q
- #include <linux/interrupt.h>
# ?( s9 E: ?# ^. e8 x - #include <asm/io.h>
1 ?; z7 {( m) _ - #include <linux/moduleparam.h>
! }% z* u+ v# V; M2 X7 { - #include <linux/sysctl.h>
/ F0 j) f2 {% \: f( @/ C P- b - #include <linux/mm.h>
: ?) v$ z' M" w - #include <linux/dma-mapping.h>3 o; n9 c# p1 u* P* {+ N. D/ e
- 7 H* ^ Z3 t# ?
- #include <mach/memory.h>
* q l5 H+ _# l* I5 Q9 F8 L - #include <mach/hardware.h>+ x3 P. ^# u0 ?! D) J
- #include <mach/irqs.h>
8 y6 l: B; v' i$ b7 H k+ R5 _& E - #include <asm/hardware/edma.h>
' m3 w$ Z. L+ ?* k* w& W+ b - 2 h0 S7 A7 C- Z9 C
- #undef EDMA3_DEBUG) W& [, b9 D( g5 `" n0 x Z
- /*#define EDMA3_DEBUG*/
% ~! G! z' {: h: E! Q
9 u+ v$ C9 G0 L6 D4 h$ D D, f& Y- #ifdef EDMA3_DEBUG+ |* v+ m5 M5 ]1 s6 o/ f3 t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 t) K9 y' f, L' a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 u% L3 V7 W/ M% H. Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) i$ u: X/ b+ _) u4 ?1 @/ ?6 z
- #else- V: k5 i; Z! }0 e8 o; N7 b6 ^
- #define DMA_PRINTK( x... )* W1 \$ g! e0 l0 X
- #define DMA_FN_IN9 w: k; v& e# K5 o+ N8 B2 R
- #define DMA_FN_OUT3 c$ ^. i9 D) n) }" Q6 U
- #endif" F9 |: C- ?4 [4 e( i+ x
' j1 _, F) b& B2 o( n! `3 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768), j6 V0 g! d7 R) \* h
- #define STATIC_SHIFT 3% J8 `) s4 C+ H6 L
- #define TCINTEN_SHIFT 20: B, ~& k) g7 U
- #define ITCINTEN_SHIFT 21; y0 M! P0 ]. \" e/ W
- #define TCCHEN_SHIFT 221 l2 L) Q3 `: U* H$ X6 B% u
- #define ITCCHEN_SHIFT 239 ]3 c4 e _- b9 i7 P# V# L
' G4 M. j0 V6 \; I6 Y$ F- static volatile int irqraised1 = 0;4 o: o, [+ w M M+ \6 j
- static volatile int irqraised2 = 0;, G( Q8 }% e+ u
- % e: L- l2 {% ~/ g( \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 Z# K. i; M8 n9 i% p Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# S9 Q$ V; ]7 q4 E, z: f" b. ]: a0 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 ]" Q& Q! o2 \& }1 \6 l/ { - % b( u) @. E* G) T0 z" S
- dma_addr_t dmaphyssrc1 = 0;% @+ h) N, K q# Q) X( L5 Y* L
- dma_addr_t dmaphyssrc2 = 0;
- s! h) ]0 m( e) G8 J3 \' V0 f - dma_addr_t dmaphysdest1 = 0;0 q8 [6 _1 V5 q2 Q% y
- dma_addr_t dmaphysdest2 = 0;
/ ], w: [! R5 g: [ - * X" q4 w1 ~# a Z, F1 A. ]
- char *dmabufsrc1 = NULL;
7 h3 m, q4 H: A2 d. u1 V - char *dmabufsrc2 = NULL;" u, g+ i' ]9 k3 X1 ]/ o% Y
- char *dmabufdest1 = NULL;
2 o) I% j$ ^: E* C( _ - char *dmabufdest2 = NULL;2 t% r- x8 p0 j9 J9 z: |
- , G8 E3 |% L- ]5 m
- static int acnt = 512;% K. J! R/ L6 |2 {
- static int bcnt = 8;# H) s# K1 s; X$ {
- static int ccnt = 8;0 c" t' v+ E' `2 a( m0 n6 U/ R0 B
9 J5 U% }- I: ~4 Q) J( d: g- module_param(acnt, int, S_IRUGO);5 M1 C7 s' v+ J9 h
- module_param(bcnt, int, S_IRUGO);% |) A. ^# h9 ?4 J
- module_param(ccnt, int, S_IRUGO);
复制代码 3 b$ E; ^4 M L) E
0 {; r' i/ u" F: r. [4 m1 L* U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* h; s' F4 o: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, S, g6 R/ T* D: ~4 I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; x( S! R& H) ?) |4 L" ^
. ~( l8 c" R# ]# T5 h$ B/ |- M# d
! t% s2 L! ?) }4 t |
|