|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 ^" a. _+ n/ A p1 H- [code]EDMA sample test application' K. `4 w L1 v5 v
- /*
7 q; W8 y/ W- Z1 z - * edma_test.c
$ F: s6 g) ]; s, a _; ?6 A! r - *
" ~& e9 J4 [; I" U - * brief EDMA3 Test Application9 q( K9 ?# B4 \' m/ m
- * ^# [& s% ?/ Y" v5 G
- * This file contains EDMA3 Test code.: f* X- r) Z: ]
- *" v2 r7 U. _9 {: e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( S% c6 L* S; J% v( C3 y7 O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ Z1 e, _8 O+ m - * TO CHANGE.
+ v* S% X! |- i- b' e& {3 ] - *
( }. N$ {: u8 A7 L$ ~) K4 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
o9 g6 Q. L9 E4 ]* P - *' X2 \- i* Z) A9 v6 }& h/ g
- * This program is free software; you can redistribute it and/or
7 [5 N" y- }3 K2 D" p6 F3 y- l - * modify it under the terms of the GNU General Public License as
W3 M# R. N$ K" G9 T7 p6 z | - * published by the Free Software Foundation version 2.
& B1 K' Y8 O0 v3 Y5 ^) y - *
* K8 l. `* ]& `& b& m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 b2 `, ~; j$ A& q0 r2 \7 Z; ?
- * kind, whether express or implied; without even the implied warranty3 D2 b" n7 C) ]- H# Q2 k' L: {' w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# V5 M# r# V. a+ q) ?4 v) |0 W/ w
- * GNU General Public License for more details.
9 h# F/ B( `' d. W% T - */0 i4 y) s; [* ]* b
) L8 T) Q' e5 P; P% v: T7 s, Q- #include <linux/module.h>& r. R8 ` n( R$ d
- #include <linux/init.h>
; {4 W, o0 }0 I' V ?" \ - #include <linux/errno.h>! ^* d- r* O0 ?4 v* q0 S
- #include <linux/types.h># g0 @% \ s' s; j% v5 R
- #include <linux/interrupt.h>
) r8 a, ^- ^- |6 R - #include <asm/io.h>
# z4 G! x0 V' z! A, `7 {+ e+ ]* n! C - #include <linux/moduleparam.h>
! p* K8 E7 i, ?6 z; I! \- v% { - #include <linux/sysctl.h>
4 B% ^ Q2 t& G) |: N6 d( U! Y - #include <linux/mm.h>1 }. A' S- q! R- ~; \
- #include <linux/dma-mapping.h>
7 Y% }" y& @1 b$ Z2 \# c
8 W1 e9 T, a8 I: n- #include <mach/memory.h>- `. U" ` O( F6 j" v. O
- #include <mach/hardware.h>3 a {+ H" `6 E) U9 q, ^
- #include <mach/irqs.h> @' Z# k& \+ C4 c7 n
- #include <asm/hardware/edma.h>
# Y. Z% l# H- @! K$ k3 p - . J) o& H0 j* v0 Q# p) {
- #undef EDMA3_DEBUG! c9 V1 I$ R, q A& s9 Y$ u( N
- /*#define EDMA3_DEBUG*/
0 j! X; x3 B2 ^1 |/ y# r" ` u$ m o( \ - ) x/ Q# {) S s$ \. j
- #ifdef EDMA3_DEBUG
, T) e7 Q) _ v- g8 V. | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" A8 u3 I. r* [3 K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" M$ r) \; O2 K( |3 O, A% Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): U4 M+ N g, V2 J2 Q: g
- #else
# d0 O! L. l! w* Z - #define DMA_PRINTK( x... ): ^$ \ n+ T8 U- p# E6 c% y
- #define DMA_FN_IN
+ H! y/ a' {1 h* U, n# C8 V7 V- L - #define DMA_FN_OUT
# p2 a8 D2 ^; R) r* c1 H - #endif' {- [0 h& q( ~% k& _
7 x* k$ i2 A0 m0 f6 [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* w' R. K: h/ _$ v9 \
- #define STATIC_SHIFT 3+ S3 P5 t, O; s
- #define TCINTEN_SHIFT 20
- `$ |! X. w. T: n) ^; i - #define ITCINTEN_SHIFT 21) m0 U" ?0 C' e. f
- #define TCCHEN_SHIFT 22+ n/ Z I) c" V/ p t( W I
- #define ITCCHEN_SHIFT 23# V' V7 r2 b2 s* P- L5 K$ f
- 7 N2 m5 v$ b7 G( z1 \" Y' x7 Y
- static volatile int irqraised1 = 0;3 ?- I& f) K, k% B+ U
- static volatile int irqraised2 = 0;. L+ D4 l) L& p9 L) y: n+ p( S
0 |0 f; f- P( @5 V( h, O) N6 @/ G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% M6 g1 }9 G& S# e6 _* N/ A9 A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 T4 @1 a+ u/ c2 i4 k6 Z, X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; e9 q( b4 B' b; k) O
& Z4 t. `% N" ]2 ~% m- @* g$ {2 e5 m' N- dma_addr_t dmaphyssrc1 = 0;8 d' O# {; p% j& @
- dma_addr_t dmaphyssrc2 = 0;
) E1 W; Z/ Y s7 Y& s9 B% }1 t3 \- o - dma_addr_t dmaphysdest1 = 0;. T% C' V9 T* P3 Q |
- dma_addr_t dmaphysdest2 = 0;1 [+ H8 ^0 k1 p t# p; q. N! m$ v* }9 m
- & c1 j' p( Q% P" ]/ {
- char *dmabufsrc1 = NULL;
0 V, d! J4 S) V- H( @4 X - char *dmabufsrc2 = NULL;
9 w5 ~+ R! m. i9 r4 X, [9 [+ [ - char *dmabufdest1 = NULL;
4 F! i% K" J k$ ~9 F - char *dmabufdest2 = NULL;
- }: j3 d6 Z n - / o5 Q% F/ \+ _ S( O3 |( O1 Q
- static int acnt = 512;) T3 S! i' W5 I
- static int bcnt = 8;, {9 e# ?$ t# L* L
- static int ccnt = 8;
5 D" X, A1 ]4 V0 f6 z: ~% ?" Y
4 R3 d0 D4 g* }; Y7 ^8 C \" W- module_param(acnt, int, S_IRUGO);2 B; c& m, a" `: @) a
- module_param(bcnt, int, S_IRUGO);$ x5 B% V4 S o" {+ `+ g
- module_param(ccnt, int, S_IRUGO);
复制代码 7 Y5 b. W c* k" j- o6 _& M
8 Y- m) s9 L5 h0 \ c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% ?! e! F1 J- n J" n0 {5 Z' Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. A3 [1 u# ?$ f v6 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 w9 }1 Q, a( W0 Z. S
v: S. h$ S# _6 D7 R) y* I v6 d! u% C
|
|