|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , Z- b; T. W7 s% D# a* w# z
- [code]EDMA sample test application
7 a4 ]% R9 H5 Y5 h! ?9 l$ D6 L - /*0 U+ J. T% ^* f: l, x" {" c2 E$ y
- * edma_test.c
) O$ B7 N5 P/ K3 b - *
. s& A e$ `8 y @ - * brief EDMA3 Test Application
% A* P* Z. x1 A1 Z - *: n9 ~' J4 Y \6 N# G3 |
- * This file contains EDMA3 Test code.. [" D ^' x* Z$ B- O b q5 s8 ^1 o
- *$ y" @% s) Z/ m' y2 d- {0 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" k4 \3 v. f- K. E: O y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% k# e+ x! o3 u9 U0 w* s2 H
- * TO CHANGE.
) r% X" H3 H X! o" p! T - *
$ n, j; p3 i+ F. H i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// N D2 Z# h+ n
- *3 ~' p6 N: R0 R% d1 ]% d
- * This program is free software; you can redistribute it and/or
6 @) Z5 h/ v1 Y- g - * modify it under the terms of the GNU General Public License as# m3 j2 n6 P" t/ W0 @
- * published by the Free Software Foundation version 2.
# Z' s2 o o2 m, U2 S - *
# z- v% z5 o% j9 g; o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" H7 J1 z! G" _6 r
- * kind, whether express or implied; without even the implied warranty
$ }4 ]7 ?- T [( n' L0 q( G& ?- B3 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: N9 f) C6 y6 z/ C; [* w$ [
- * GNU General Public License for more details.. M4 x. M" t+ \ ?5 Y, [
- */ t# L2 i9 y( E+ j9 f
8 B8 C- `( A1 z; i- #include <linux/module.h>
4 } B, U8 h8 t* P* K+ Y2 v: Y0 o - #include <linux/init.h>
. S/ H& [" }- L. c - #include <linux/errno.h>
6 z3 t6 n/ k" D, N# O; ]; X - #include <linux/types.h>" U6 r, D8 u6 } e
- #include <linux/interrupt.h>
" `$ M+ ~1 M' u - #include <asm/io.h>
# ?& P3 {9 X/ F' g! _6 h. j - #include <linux/moduleparam.h># g- S7 x) ~8 Q- f+ \
- #include <linux/sysctl.h>
2 A7 b% l, \1 F/ K, z/ a. L& E - #include <linux/mm.h>
a+ }% n& h \' Z( |0 g - #include <linux/dma-mapping.h>* G5 i$ N8 R' ?! E1 d
: u: G7 R e$ q% d& l( {' d- #include <mach/memory.h>
. n2 D$ b5 s$ ^/ X, D - #include <mach/hardware.h>
# ]9 c7 z) i3 V @ - #include <mach/irqs.h>
6 q4 S. u$ }" L2 H3 ~ - #include <asm/hardware/edma.h> e( h+ T5 O: h* k3 S: D
) a( R6 T) b; j- ]8 D6 R) Y" z, j- #undef EDMA3_DEBUG
- ~- w! p; Y/ ? - /*#define EDMA3_DEBUG*/7 T) N$ e+ m5 y9 Y
- ' s+ o5 r5 m S! F
- #ifdef EDMA3_DEBUG" I: h* O4 b" q7 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ y, W$ A3 h, W$ l! j7 p! w8 U# i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; e2 y7 s) w- q1 q7 V, I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 n5 v4 C, E" f0 e
- #else, U3 A- o$ A2 Z1 M& L$ F! S
- #define DMA_PRINTK( x... )
" M% Q' y, S% B6 b& B$ P; j - #define DMA_FN_IN
. T4 e6 d* `% e4 b3 ~! X/ U - #define DMA_FN_OUT
. A* l3 c& a E6 }5 D, y - #endif2 y F& G, M! [
0 L- @ b5 N! e! r( _, \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; F/ w2 q6 Y6 v6 l H3 ], ~0 l - #define STATIC_SHIFT 3. t- l1 M" x2 ]0 {0 ~' {" C2 o3 c/ t
- #define TCINTEN_SHIFT 20
9 `2 F* Z( ?) W: q- q3 \: A' D - #define ITCINTEN_SHIFT 21) V& d3 J' N& W: E9 v) F
- #define TCCHEN_SHIFT 22
! M$ j5 r+ }& ^% l, b; P0 B - #define ITCCHEN_SHIFT 23
+ u! B8 |7 X; v! w3 J$ c2 C# u
9 E+ M* F7 A* Z9 R6 H# a- l# B- static volatile int irqraised1 = 0;$ M! j, T4 M' ^0 {! j
- static volatile int irqraised2 = 0;
3 L0 M8 z* @! T9 M1 z5 P2 h# s+ b - 6 x' u0 H' n. y5 S' b0 r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ Z4 G- B2 ~: S( @9 Z6 b7 d0 z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 N0 b }/ N1 O- A. D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 Y( C( h& S* x% O - & z7 O' d2 r! W5 u0 p
- dma_addr_t dmaphyssrc1 = 0;; b' M/ V" h9 |( a* Q. ]; x
- dma_addr_t dmaphyssrc2 = 0;
$ }4 \2 I% k; B( U s - dma_addr_t dmaphysdest1 = 0;
: d1 i& R, q8 Z9 A6 C) x - dma_addr_t dmaphysdest2 = 0;
, ^! ?2 Q5 L) @( e `/ `
. ?; l9 [# q% n$ G8 ]/ y- char *dmabufsrc1 = NULL;
' e J3 g3 }/ x - char *dmabufsrc2 = NULL;
2 K8 p, A: C5 p, ~6 j' A" f( z1 R - char *dmabufdest1 = NULL;* R9 F2 I1 O5 x
- char *dmabufdest2 = NULL;1 l; C7 i/ q3 A) c: o2 o$ R9 P
: }$ r* Y6 E' f3 N- static int acnt = 512;+ Y9 p0 o6 C- l$ M) l5 T% O9 }
- static int bcnt = 8;3 ~# W, S2 F4 G
- static int ccnt = 8;9 H& c8 Y5 h+ e, B
- 3 [" D7 ]$ o8 p- G
- module_param(acnt, int, S_IRUGO);
# r `" |0 U- R1 I- \6 {8 y - module_param(bcnt, int, S_IRUGO);
% K" k1 P& e7 V5 d. g - module_param(ccnt, int, S_IRUGO);
复制代码 5 m: I5 q" l% d6 N U9 a: b6 N
, f4 @4 Q" _" }# \6 B2 h, H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 P, f' S7 N& D; G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# s5 d4 l7 ~; H6 a1 S" v1 ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! |. Q/ ]- o1 ^2 x
0 Q$ m! Y2 a/ Z- v/ R3 {0 s3 ]2 K/ ^2 F3 t7 s: H' V
|
|