|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. m0 p1 I6 U1 a2 g: |2 |2 Y v- [code]EDMA sample test application
' u6 |& z) \8 Y( d; S - /*
8 } Z% U" y \6 N6 M. \ - * edma_test.c$ w7 N. w. V" {
- *- o$ q6 x! c( \
- * brief EDMA3 Test Application- R. w* z- {' q. M5 P5 w
- *
' Y0 x( B8 @" H6 v - * This file contains EDMA3 Test code.( V* {, ], a/ @3 L# y
- *0 o# l* f0 F4 N3 [9 [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 ~ Z4 q* O1 r. o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 p. T2 ]0 s/ Z
- * TO CHANGE.
0 A: y9 s7 F/ @+ d- c, K - *( Y# p( B0 O6 P3 g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* g# o/ [4 D0 J9 ` - ** J3 f1 K; H2 Q7 a- ~9 ~" H. ^
- * This program is free software; you can redistribute it and/or* x3 G2 {3 K) a0 `& Y0 `! d, ~
- * modify it under the terms of the GNU General Public License as
, `2 W( D5 m* Z; o5 `: K$ R& H - * published by the Free Software Foundation version 2.! {: L9 X$ P9 X6 G! a% D& j% e E
- *: t( y. u* M, M {7 U* z3 B+ B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! a+ \# Q _5 O
- * kind, whether express or implied; without even the implied warranty, v) Y3 x$ ?3 r# g2 T: R V$ a; |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 \- `; J! U F% G1 l) v5 [ - * GNU General Public License for more details.2 N7 ? x c) {5 a- r. y
- */
8 [: }/ Z+ X7 k( s. N' I - : X# \, V- a* n" l
- #include <linux/module.h>( |2 a. y8 n( O9 a( x
- #include <linux/init.h> q2 ~- F$ @. L% T5 G9 ?+ a
- #include <linux/errno.h>
! P \- a. y9 { - #include <linux/types.h>
8 p% S8 H1 I. u0 ^: h - #include <linux/interrupt.h>
4 Z( Q- o6 s) v5 g' D - #include <asm/io.h>
7 S' c% ^ w+ @3 v - #include <linux/moduleparam.h>
# U) ~% y" Q u6 m4 S; X: w/ G+ G - #include <linux/sysctl.h>
/ I/ @/ b: r6 @8 Q, m - #include <linux/mm.h>8 R5 v, p- h/ C0 u' O4 o. p
- #include <linux/dma-mapping.h>8 Q2 R9 F+ B+ D
. H5 {% z8 D v2 ~- #include <mach/memory.h>) v8 a; D; z8 ?3 r& y
- #include <mach/hardware.h>
) j. c+ z: e3 T - #include <mach/irqs.h>8 ?0 ^; h# R3 B+ H! K
- #include <asm/hardware/edma.h>$ k8 E8 h1 w5 R/ ?! A8 Y: o! I& h
- 5 E# q3 P: c- \& t5 G! y; ~! s
- #undef EDMA3_DEBUG
8 j& j* d$ X# A2 Z- v6 F2 K0 N - /*#define EDMA3_DEBUG*/, `( g& E' J( k# O& m7 X
- - G) A, R- w/ {5 Q5 Q/ m) h4 R
- #ifdef EDMA3_DEBUG- _. u/ V5 K% y, o- L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: w& P8 e7 _: F( n$ b1 b3 D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ U! |! w- @3 `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' w" w K8 h" Z/ u. k& ^( V' U
- #else
" R: f% x2 t# ~( `' a# ]: B- X+ w - #define DMA_PRINTK( x... )
4 w- T5 q- L8 T! b0 y - #define DMA_FN_IN/ ] s+ k. M) [ p% r9 i) f# a" p
- #define DMA_FN_OUT
' \5 i$ l3 E! H2 F, U3 s - #endif, f8 c1 C2 |. p4 F
- 8 B& c/ ?/ A, W( ^, Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 p, Z5 g) O0 m - #define STATIC_SHIFT 31 ^7 \3 _' E3 d. X( q3 ]
- #define TCINTEN_SHIFT 20
]( \( E2 z6 J4 r& v - #define ITCINTEN_SHIFT 215 f. i( z4 W- Q) T% q4 n
- #define TCCHEN_SHIFT 22
, x; Z" L- \5 }3 D. B - #define ITCCHEN_SHIFT 23% j0 h3 J% ^, y+ P2 f# _% a0 D
- 0 O/ M3 q, b v l0 a
- static volatile int irqraised1 = 0;
5 F3 {% Y) S3 ~ - static volatile int irqraised2 = 0;2 F p6 r+ |1 W8 G/ a
- - O' A7 u$ A) y. Y% I& q; w. K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 U& d' D, `$ j I; { P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# }; L( Y: _5 I& t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 l' L$ j$ {1 O7 v1 F7 x
! ^; X5 B+ K# _. c- dma_addr_t dmaphyssrc1 = 0;
* f( O! B& u0 P. g `. T - dma_addr_t dmaphyssrc2 = 0;
8 ~% P( r+ a7 ?3 ?4 z# `0 w# H# U - dma_addr_t dmaphysdest1 = 0;; q$ Z7 L6 [" k
- dma_addr_t dmaphysdest2 = 0;
- K+ l% T3 [* X$ }
, I1 H% O& a& ?$ i; A9 q5 Q6 c/ Y7 I- char *dmabufsrc1 = NULL; g3 N$ V: X/ W4 k+ O5 h' g
- char *dmabufsrc2 = NULL;
! Y; e# ] E6 y - char *dmabufdest1 = NULL;
/ C. n3 ~* U# _9 X7 M8 K g - char *dmabufdest2 = NULL;
$ E2 _ p! I2 i$ I+ F - ; x/ v; N! P: f0 I9 L! m
- static int acnt = 512;
. m, q% w+ ~* M* ]9 D - static int bcnt = 8;$ y9 h8 O! D* F- j5 t" V
- static int ccnt = 8;3 }, k" L6 b- O' U" [% M" M
- $ y5 ~, \" M$ e' K( z1 x
- module_param(acnt, int, S_IRUGO); B- b6 \# U+ |) H% Z$ J9 e y
- module_param(bcnt, int, S_IRUGO);; G* }0 Z g, g( V( A
- module_param(ccnt, int, S_IRUGO);
复制代码
/ Y- A1 I( w1 [/ a! N! T6 | v2 b6 b. g! }4 W# {1 F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' C. b* q* N* C0 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 o l g1 q+ t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 [& D4 Y2 N1 R1 d- j- n, P; _+ j. ~0 t+ s: [8 `
8 ?8 E/ U: B8 y9 O# k- V2 P
|
|