|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( J. E& v3 ]$ ]% T) u
- [code]EDMA sample test application
+ E C$ W$ |- l; g$ c - /** p& s+ G! {! P4 c5 D7 o
- * edma_test.c
4 w8 N1 B# K2 T( o1 ^! @8 v - *) S% C& q' t* V5 H# c7 p
- * brief EDMA3 Test Application
- {5 m. U1 K: k& Y! v. d - *! W3 H! t* F; X- \
- * This file contains EDMA3 Test code.
+ i5 Y# }( X' X - *
! R( [# h& D6 s! T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 r$ R; \- d$ x" H i1 m+ A- t( n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, p6 u$ m. A% y: t1 Y1 G - * TO CHANGE.
! \' T! L# u5 ]( Z4 u* { - *- G S5 u' c9 b, `' N, ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 O0 S. ^0 Q# E. T - *
$ @+ n$ W- q' |' ?5 k7 _& N* n" ? - * This program is free software; you can redistribute it and/or" y/ u! D4 w: Q/ d
- * modify it under the terms of the GNU General Public License as
( ?) N0 ^7 p- L* N - * published by the Free Software Foundation version 2.
' A$ e" q8 K- n- X/ W" ]4 P - *4 M2 E2 c' Q0 @4 S5 p0 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 s# o& S. ? e0 u0 n$ Z
- * kind, whether express or implied; without even the implied warranty+ B8 k* K7 j: ?& G% R3 b* U( `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; r7 }# E# d8 G) n+ D' ?' k - * GNU General Public License for more details.2 D: `0 l* n! `4 ~) d' d+ D8 u9 d
- */
' ?0 p6 Q: C% R" v& Q2 G7 Y - 8 W( K8 q5 w; _0 T! F
- #include <linux/module.h>
: s6 K( d$ V6 R( J" O* h3 i* B - #include <linux/init.h>* |+ K5 J: w# L% _* u/ x& K
- #include <linux/errno.h>
/ }+ }9 J$ K' q7 w5 H - #include <linux/types.h> K A" b! M, e- C" ^8 `) F
- #include <linux/interrupt.h>
+ c# N8 V7 z+ u/ ~" f. H4 f$ C - #include <asm/io.h>" Z0 }# d# j9 v2 a
- #include <linux/moduleparam.h>
6 X) v9 [$ H& [# R1 g" }! W" P - #include <linux/sysctl.h>
, x( B) X6 h, M( q6 p: d - #include <linux/mm.h>
: O$ {3 p. r9 A) X9 F. E - #include <linux/dma-mapping.h>
/ H5 `0 g+ `- t& N- d
! Q2 j: b7 \2 }2 E; `- #include <mach/memory.h>. A2 P- m1 H- c: W" M. f6 e
- #include <mach/hardware.h>& v0 v. P! M3 o7 g* p" e3 n( P
- #include <mach/irqs.h># o( p3 J5 f, _$ Y. J/ s/ y
- #include <asm/hardware/edma.h>
" e5 b4 L- T- w - 6 e- x0 c' I6 x |. m, R% Z; b) M% M
- #undef EDMA3_DEBUG# ]6 Y9 r" C8 S+ m% C! }) @% c
- /*#define EDMA3_DEBUG*/9 Z ], k7 w6 D$ q7 V# R
- : R5 z+ h1 b/ F" R+ x$ Q
- #ifdef EDMA3_DEBUG5 a: I1 F6 j, d( w) c0 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# F6 A! A! x- A5 _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: l) w) O* s' Q, J4 E2 m, w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& ?; c3 ]1 p# \- J
- #else
( G, `/ b8 `" I+ o6 [9 I - #define DMA_PRINTK( x... )
: P8 N# ^) N/ w - #define DMA_FN_IN8 Q; m! B8 [( O8 l. @" a; n
- #define DMA_FN_OUT/ i, m+ d, u6 l, L- i5 r/ w6 O2 s
- #endif
% i% o/ w. L; ~3 _. q% U - / W# a% ^% S! Q H. v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 M/ g K+ V( @) s6 H1 g4 G/ F - #define STATIC_SHIFT 3/ G2 M+ d5 y6 G! }
- #define TCINTEN_SHIFT 20
4 j5 o/ {+ f* @6 m% j1 h - #define ITCINTEN_SHIFT 21
, i& m1 c* n1 |$ a- X - #define TCCHEN_SHIFT 22- C. y1 Y/ Y8 U, z" [7 f( B9 p
- #define ITCCHEN_SHIFT 23
3 Y! h, p+ A3 c5 s: X1 D* f - [+ U$ Z- G9 x& l* a! `
- static volatile int irqraised1 = 0;
6 f- O9 [( i* s; j1 E+ {# v0 @. g- S - static volatile int irqraised2 = 0;
0 D' r$ t* ~" J. [: }9 ]: a+ j6 \ - " K# e# \ [9 S! Q; N, p6 S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 `& V, s& V& H `' I, y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, V/ \* z3 b' V$ z4 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 W. ]9 K- O; r; F, R3 @; q' Y
+ J9 w. ^7 _: \5 i7 l! @+ A- dma_addr_t dmaphyssrc1 = 0;' T9 C3 h, S0 f8 W4 I0 R) Z) b
- dma_addr_t dmaphyssrc2 = 0;4 e% X/ p, S. J. [* k
- dma_addr_t dmaphysdest1 = 0;# I, q% X3 D; E+ O/ W( l2 q
- dma_addr_t dmaphysdest2 = 0;6 ~8 ]8 b& p0 p+ j
- p) S7 p; d' q: T4 O1 b4 N- char *dmabufsrc1 = NULL;4 U, r. J3 o* w2 d n
- char *dmabufsrc2 = NULL;
, d' O5 c) k' V5 b, m4 j3 X5 [! Z - char *dmabufdest1 = NULL;
8 W- _6 F4 v+ N/ f* ~1 h - char *dmabufdest2 = NULL;/ P# ~& I) v6 O* f4 E8 B+ d% v+ g
( l( Y. }, g. B" ?$ v- static int acnt = 512;, D1 J. P) `1 v7 W
- static int bcnt = 8;6 F* U' H( F! l% ?
- static int ccnt = 8;
; K8 k# X! g. [+ _/ w8 M7 h# U) A/ Z8 T - ' z, p! s9 ]* x' b
- module_param(acnt, int, S_IRUGO);, [) c6 r5 d) g( S+ d9 D
- module_param(bcnt, int, S_IRUGO);( D4 p7 {' R# X6 j* W: `
- module_param(ccnt, int, S_IRUGO);
复制代码 - q" M/ P- H1 j2 ?$ c. B" g1 P- _
6 \% l# x1 l7 s( C, h9 K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 G: h, Y9 C7 p( T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* H) P8 f) i6 E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. O1 h; g: I" T6 }+ s9 u3 \3 Y3 W
% D/ n1 P8 p5 M: L8 ^5 @0 F5 p4 b
0 F; D4 Z. `" P8 K7 \( f0 R |
|