|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 t) p* b( {1 E$ E j
- [code]EDMA sample test application. L9 ?0 e4 m# t
- /*( P/ I4 l% M/ |9 ^3 @; k
- * edma_test.c" e4 K5 L0 m# e* K
- *
+ e* U$ c& G ?( a* z - * brief EDMA3 Test Application8 R) ^* N3 U- W& v' d9 e: z# I. l
- *$ z) f _* m0 L2 c; ] i( h
- * This file contains EDMA3 Test code.
4 e) z& U* L- J- E. W - *
) Z8 o! \. V/ a- B$ l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- d: S f6 a2 h3 \$ t+ ~ R" j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 u& E3 \. ^6 t0 o( q. m& } - * TO CHANGE.
8 B1 e, J6 g5 m& \3 G% N1 O& p - *
8 g: Q8 B( \ W* u* u! q/ l5 i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 `, P6 `4 E' U6 r3 |! o$ F - *, K- l! r9 {* Q; b
- * This program is free software; you can redistribute it and/or
9 d: t$ ~1 ~ c - * modify it under the terms of the GNU General Public License as) [/ y! Z' V1 ^' Y: M% _5 x5 N" |
- * published by the Free Software Foundation version 2.7 S, u U& o: W; B! f
- *
( F+ L* L9 d+ S1 k! N3 Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) B/ n4 E2 P5 y' a- v' ` - * kind, whether express or implied; without even the implied warranty5 A! U& [: @* r3 c# \* K% v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 a& d$ a: U) u y5 S2 b; X- Q) C' I: R - * GNU General Public License for more details.
8 e5 S7 j6 M6 ~! `& c - */# R; l* m$ i* F% _
- $ \4 n! K v c% ~6 L7 M: X% b3 w3 l
- #include <linux/module.h>( X/ n; x0 V& u& X% A1 f7 @$ Q
- #include <linux/init.h>7 ]4 Y: J- l. O8 f9 U# S" C
- #include <linux/errno.h> f4 M, k3 t5 r3 e& [/ S
- #include <linux/types.h>
/ j$ ?" B. ]# \& r1 O) r - #include <linux/interrupt.h>
1 e$ a* q- |0 {9 F2 P: a8 [! I0 k v - #include <asm/io.h>
% E( f) S5 ?1 D/ r - #include <linux/moduleparam.h>8 k1 d- O; O0 b0 ^: Y* j
- #include <linux/sysctl.h>
5 l5 X; B$ y- G* Y - #include <linux/mm.h>
|3 S0 w" o& P& Y+ x& C4 C - #include <linux/dma-mapping.h>* i; o- f/ R, O+ A9 V) P
- 1 \6 }. s! Y$ o$ W. W
- #include <mach/memory.h>
. ~( j) I& z7 q5 F& M$ N; ]" B - #include <mach/hardware.h>3 j8 _( n! R/ ?
- #include <mach/irqs.h>5 \9 o3 [$ \ [; p2 W5 U
- #include <asm/hardware/edma.h>
! F. g1 f' X. ^3 q5 n& A/ U - . k/ G3 w, a B) `) t7 c
- #undef EDMA3_DEBUG
" _% v& a3 Q& d. I) b - /*#define EDMA3_DEBUG*/8 G' A# q+ F' H( @
5 h$ m' u. ?( m( W* j1 i K4 g- #ifdef EDMA3_DEBUG" W) H5 s$ ~9 h( W0 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, v1 a. b1 v; Y7 {/ U% S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; r0 T" K' E. j3 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ d5 U1 w |- ]6 q2 m5 k/ V! J - #else
$ k5 z4 n2 w0 F: W/ N& l/ d, K8 I - #define DMA_PRINTK( x... )
. ~7 T& J* S: ~6 q, `( X1 B2 q - #define DMA_FN_IN* Z! g9 f7 R# h4 T3 q' ?
- #define DMA_FN_OUT
) Y) I3 b& j0 U8 Y' ^9 Y7 p - #endif
/ J) N) [& t% Z) R" X5 I5 e - 4 {: _0 T! W3 X; W) V0 j( w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 J" v* K& u# M. b! U
- #define STATIC_SHIFT 35 V; t3 N5 i: u* B. z
- #define TCINTEN_SHIFT 201 ~2 e; g& \1 H4 ?8 M7 D
- #define ITCINTEN_SHIFT 21
7 B6 v# b9 w7 E4 j2 J3 e - #define TCCHEN_SHIFT 22
2 a+ F; Q8 y2 ~0 f* ^! { - #define ITCCHEN_SHIFT 23% E3 w$ [( S6 U+ S
- " Z2 X& V3 E: m' `, T& `
- static volatile int irqraised1 = 0;
5 N! L; x5 B" [. I - static volatile int irqraised2 = 0;' _& B! m4 M8 |$ e! y( ]/ u
- . d* ?4 u% e6 }: Q% B+ I& L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 b2 _) H5 I R5 R! n, `1 g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ k: N. f* Q; ]( \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); N* i$ s: s% K1 T
2 | S. m9 M$ g9 n3 z4 q- dma_addr_t dmaphyssrc1 = 0;
+ M v3 ~$ z0 ]$ w - dma_addr_t dmaphyssrc2 = 0;9 G7 _4 G+ c1 k: [6 l
- dma_addr_t dmaphysdest1 = 0;* h+ S B G2 C) U, p
- dma_addr_t dmaphysdest2 = 0;. H7 F6 I/ G. X: J5 Q. g: \) j9 H
) Y6 H, l1 g7 c4 K, Y2 n- char *dmabufsrc1 = NULL;
6 ?, g) e0 d7 O! G( j - char *dmabufsrc2 = NULL;
+ p7 S2 Y1 | ?3 t. N7 P# B - char *dmabufdest1 = NULL;0 Q+ a1 ?- u! { S
- char *dmabufdest2 = NULL;3 s* L0 q! [3 ^9 T% k2 m/ K7 x
- 8 \& z: D' i, a# X
- static int acnt = 512;
3 R* e( c1 J9 u1 O! ~ - static int bcnt = 8;
0 D. T, I' c# W - static int ccnt = 8;
/ Z1 f0 l* t- x3 }: G2 F - 0 X. y0 F# k7 |
- module_param(acnt, int, S_IRUGO);# w4 [6 V: e- E) Q$ B
- module_param(bcnt, int, S_IRUGO);
/ H/ `9 U8 `1 F1 b! P+ S - module_param(ccnt, int, S_IRUGO);
复制代码 2 t- u) \* \' w- H9 T1 K
- Z8 M7 p5 V" n. ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ ~5 V% h! _' M4 r. b& J+ P0 f- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% o6 v9 J" P6 V p0 ?/ T( {$ b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, X1 q' u( Y) O- h1 G
: }! v% j: X( @" K: t& `4 F. U
0 n1 U8 `& s% z4 j! x6 F8 m: v0 U |
|