|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 _' J1 ]5 u* t' B
- [code]EDMA sample test application8 M6 c- X+ f5 W8 P' A: C( e
- /*& G% C3 \; P( F" D4 N
- * edma_test.c4 N1 [) z) c: A" V5 U
- *
+ ^' H( J! D& X) K2 r- I4 d - * brief EDMA3 Test Application
( ~, y! d, H- x+ V - *: k/ V) v7 M6 e- m
- * This file contains EDMA3 Test code.* I* h& B+ C4 P
- *
( Q' j+ Q t9 ]* E; L/ `4 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ s+ i6 P* o, U- H/ f% u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 m; U$ v7 i' R
- * TO CHANGE.) x# `! P1 M' V. |6 m' L
- *
6 B# X9 Y% @+ R' [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) Z; C$ g2 g" h& j
- *
. h2 J2 p6 t" S' q* v - * This program is free software; you can redistribute it and/or3 V- w$ W! H8 U3 ~4 r( t9 N. S
- * modify it under the terms of the GNU General Public License as
6 S3 z: T9 E9 O0 f9 K - * published by the Free Software Foundation version 2.0 M. T7 e, e0 }1 x5 P
- * k. c# k3 D( O- v6 Y9 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 M; y, {: c8 [7 U% [3 ] - * kind, whether express or implied; without even the implied warranty
9 b. @6 P* _, e( p0 H( T, o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 E+ k8 _" H9 a. H! `" f" O+ U - * GNU General Public License for more details.
9 y7 V2 L9 p; } - */
7 b6 E& s+ _, ~( r/ v. D1 N
8 z' v7 r3 X3 U4 q" P& q3 @6 A- #include <linux/module.h>
& w t8 W+ e* g9 W0 o - #include <linux/init.h>: p1 X4 Q0 g; Z! y' M0 C7 i' G
- #include <linux/errno.h>
: |5 U2 H* F' u5 [ - #include <linux/types.h>; f W; T: {5 \, n3 a& B" g
- #include <linux/interrupt.h>
7 F( M/ s$ Y3 I - #include <asm/io.h>. V: p) _/ K7 ?9 G* X" ]( `! q! Y
- #include <linux/moduleparam.h>* E; b7 k) s1 U" B6 r) n
- #include <linux/sysctl.h># G: ]' r3 \" W$ P- B B' U
- #include <linux/mm.h>+ g) ^; t/ U+ Q2 F
- #include <linux/dma-mapping.h>$ j R, B: B) A% R
- ' M+ w) \* T! x# K, m7 i- q" a4 ~: F* ~
- #include <mach/memory.h>
9 {; S8 W# n3 Z2 x# N - #include <mach/hardware.h>9 \ W$ S9 Y: ^, `. P1 n/ q3 @3 M0 {
- #include <mach/irqs.h> ~' k( p6 X# k5 t2 ~5 R# d
- #include <asm/hardware/edma.h>% l9 g: x! P& Z! C
- 0 M# ?) A) S2 J+ u) z5 ~% h: U
- #undef EDMA3_DEBUG
% Z4 x8 e2 ?5 @, w - /*#define EDMA3_DEBUG*/8 L/ p( |- J1 R
$ z7 S* R q. t; _' |8 k- #ifdef EDMA3_DEBUG
3 k# p3 X! w. K8 b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): `; A' V7 W( @ d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" k7 S$ K* H& ~ _/ G; i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& ~- _3 O | l9 |' w5 ` - #else
& W Z3 u3 \) w7 _( v) J' F - #define DMA_PRINTK( x... )% q$ g" V7 `7 t6 B3 t0 V/ b. i1 @
- #define DMA_FN_IN( u! R9 `* |9 x3 e+ | {! }
- #define DMA_FN_OUT
$ \0 |$ d+ R- c5 Z6 t Q - #endif
' i1 a% l; A1 E' V3 t& |0 |2 w l+ F
8 [1 P8 n) F* j- a3 d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( i9 J+ c3 ]& J9 Y- J7 S. g4 u/ J d
- #define STATIC_SHIFT 3
* n" S8 \3 k3 ?$ z K - #define TCINTEN_SHIFT 20) n' x: f+ y" ?
- #define ITCINTEN_SHIFT 21% N6 l7 z* r+ |1 P4 x+ u
- #define TCCHEN_SHIFT 22$ |7 A/ i% }4 c" _' m
- #define ITCCHEN_SHIFT 23) E6 ]! L* }% I; `
- * h$ z& Z, e2 r- y% ^5 M) H
- static volatile int irqraised1 = 0;4 |7 @% k% @! g- [, ^2 W
- static volatile int irqraised2 = 0;" |) @& C5 z) J! Z
6 m f, i4 Q3 t' v, ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; `" p! t9 g/ {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& s( J7 f3 G0 Y' C* z2 F# b$ l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 U& y" h# e5 g A% x) ] k5 A
$ T5 P8 q5 z) x! s" s- dma_addr_t dmaphyssrc1 = 0;. X6 `1 i; T, O& [% @) B7 W6 Y
- dma_addr_t dmaphyssrc2 = 0;
. Y# R/ B8 R' M& U2 P; ^2 F - dma_addr_t dmaphysdest1 = 0;
4 v. [% d g6 }& {. h' b - dma_addr_t dmaphysdest2 = 0;) G( B P# @" i4 M
- ' P. s5 F" h. ]
- char *dmabufsrc1 = NULL;
: M( h( q+ j% c% m9 r - char *dmabufsrc2 = NULL;
- I2 q4 C) Z! s - char *dmabufdest1 = NULL;0 }( K! a+ u6 ?3 _& _
- char *dmabufdest2 = NULL;! X1 ~* ]" H% a3 k8 I5 Y" k
- - t- n3 T: h- I2 s
- static int acnt = 512;# t' R9 t2 v( |1 _' ~
- static int bcnt = 8;) ^, H M' b3 p% d2 {, y
- static int ccnt = 8;+ y5 w3 t) L$ ]9 h
- 0 R6 M' p. F# a2 g) q+ b
- module_param(acnt, int, S_IRUGO);
, x9 N+ ?" i; \% j' l - module_param(bcnt, int, S_IRUGO);% O9 c0 C0 P& N2 f/ g' ^
- module_param(ccnt, int, S_IRUGO);
复制代码
3 l+ ~1 f5 x3 |! P$ R: ]5 B
I" g8 w$ ^6 W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% r# n9 C" w8 U, N9 H. Q9 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" ^( G+ t$ \$ Q+ I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; { m' k+ Y$ L" ?5 {& ]/ c
) [$ q0 K3 \+ L! e# f+ Q) d
) z& G- {: W& w; ~ |
|