|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 ]+ V; p. Y5 T* T- [code]EDMA sample test application
& t" Y7 r8 O) T - /*
8 e8 ~$ _" L1 | - * edma_test.c
3 l* M9 m) Y# g. J8 N - *5 j4 r! g; {9 ~% Y9 w% @4 S
- * brief EDMA3 Test Application
2 ?6 V! V7 ?4 e5 e3 ~ - *
6 S. V6 H) Y2 [- ?6 h! d. B - * This file contains EDMA3 Test code.& e9 y/ P$ j5 y5 E
- *
& {# t' M# \, G' ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 c# i2 z9 S' b8 R+ j- p9 C( F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ Z4 X0 K7 Q$ F% i - * TO CHANGE.
* g1 A8 b5 }5 i- M( o9 u# M - *
8 n6 J' d2 D1 g8 ]) [3 o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- N8 [/ J5 y: d+ M5 V$ o - *
: A' J/ j: l3 q; ?, d( t - * This program is free software; you can redistribute it and/or
. b/ ]8 q; ^4 ] - * modify it under the terms of the GNU General Public License as
2 O) W* I: R# u* Y6 V- I# J - * published by the Free Software Foundation version 2.
* }+ d# I( O- }( |- P2 S - *. X- A/ X# ], M3 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; K1 ~) c t( {3 x; U% r
- * kind, whether express or implied; without even the implied warranty
& ~. U) v) T9 S& }8 V( i% o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 _! Q/ w! m. w) k - * GNU General Public License for more details." x& p- `4 |/ J; U- v: J9 w
- */5 r+ E: ^1 R% l3 l
- 0 l! a3 ] {& z/ B2 F4 }
- #include <linux/module.h>( {% R8 z8 N1 q& P
- #include <linux/init.h>4 z1 g4 {$ C7 I) ~1 h
- #include <linux/errno.h>& d( u! d! ~ X: ]( Y' K" n
- #include <linux/types.h>" i, o- c* c5 T# L
- #include <linux/interrupt.h>8 ~9 f" d6 h; r- Q# E: ]/ b
- #include <asm/io.h>
& Z! D1 }4 e m5 ^) d2 n W - #include <linux/moduleparam.h>) F m) {( i6 w, I3 H
- #include <linux/sysctl.h>8 ?8 A2 S5 u6 b8 @3 [
- #include <linux/mm.h>
- N6 W$ N- P' I Z! q - #include <linux/dma-mapping.h>
: L/ j" B. U5 j) q - " m, }4 A' k" c4 g
- #include <mach/memory.h>
2 _( [' ^2 n# V# ~& _; n - #include <mach/hardware.h>
# P. \8 z" ?$ B: }/ M - #include <mach/irqs.h>
7 r# h) G3 I& U3 l - #include <asm/hardware/edma.h>$ Z( h1 C* [* I/ p* J8 X! t
& d. ^& Q w$ c7 y' t( U- #undef EDMA3_DEBUG8 K1 u' B8 W \3 Y& ]
- /*#define EDMA3_DEBUG*/
' q+ r1 [; g7 v8 n- F - , k' F3 n8 Z& d2 i. r6 _# Y) j
- #ifdef EDMA3_DEBUG0 Z t+ G' C5 t4 S n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 \! a; Z! K% V2 e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# _( C; B1 v+ M2 Q% E. [& f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 p3 @# l& `8 d! P. Z3 h5 M) c, ]7 I6 [ - #else
. h3 H9 j5 i/ Q9 b$ a; u1 B3 I - #define DMA_PRINTK( x... )
; I( F& {9 S w- R - #define DMA_FN_IN
9 q( w) e. z6 Q! ]( \/ p - #define DMA_FN_OUT
. [9 Q3 [9 K. ] - #endif0 B' P. t% o @) u, Y: @( q& @4 x3 F
- + z7 A3 Q$ Q3 @2 P% b! _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 `! Z. L+ Z; i$ Q
- #define STATIC_SHIFT 3
. q( h, g# @1 t F( S1 i% Z - #define TCINTEN_SHIFT 20) K& I. M6 b# c! b+ p0 j& w
- #define ITCINTEN_SHIFT 21
2 s7 {8 n" s$ ?" T0 O - #define TCCHEN_SHIFT 22, Q& r1 z4 s) W& ]/ _! ~
- #define ITCCHEN_SHIFT 235 y* V* w' f7 L5 M3 j# P) _0 J% ]' F
6 s* _, U* y4 f/ m! p- static volatile int irqraised1 = 0;
0 S1 @+ F$ w. O8 c - static volatile int irqraised2 = 0;
9 L1 P7 r( u2 j' b- U$ A' J
4 }1 T. h; e9 w$ f, Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ |; c+ N1 n4 @7 [9 d7 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Q4 t& l5 q9 ^, o/ U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 y2 e3 D% c" D9 V% h2 o+ h5 k - - p0 V; U; ?2 O" ~' e6 U
- dma_addr_t dmaphyssrc1 = 0;
. Y7 t1 H' L! h - dma_addr_t dmaphyssrc2 = 0;
" x1 t0 ^- J+ C - dma_addr_t dmaphysdest1 = 0;
- ?. a% o) m0 `7 H- L - dma_addr_t dmaphysdest2 = 0;
/ v; I8 S4 A K$ x/ j) C' A- i - ( v7 {! g5 K# K5 t* p! \4 Y
- char *dmabufsrc1 = NULL;
4 l% m* O/ I* w9 t6 R7 P8 [ - char *dmabufsrc2 = NULL;9 j' b; E# [) q1 V7 K+ {* S
- char *dmabufdest1 = NULL;/ {$ w Z8 P0 C( ]) N
- char *dmabufdest2 = NULL;4 M9 i6 c2 y3 a. n
- ( Y9 h5 h' Z; |% }) u
- static int acnt = 512;
3 ~0 T* i- J4 x+ k( _; H% x- y+ q - static int bcnt = 8;$ |# B4 s' X3 T/ {5 I& d
- static int ccnt = 8;: E, Y5 Z; b1 N7 ~3 K
- : Q; r, p, B2 Y4 m0 e
- module_param(acnt, int, S_IRUGO);
- p h) N4 S# E9 o1 `- k2 B9 j - module_param(bcnt, int, S_IRUGO);! C3 k2 }5 c% S: D5 n. [, q
- module_param(ccnt, int, S_IRUGO);
复制代码
! R4 s% y ?/ V! t4 B/ D9 g3 R0 |$ ]" _5 z5 G0 G. g' X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 K+ {. }2 Q1 r$ u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& G& Q# M3 N8 o* T$ u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 d# X% V( K: H, B* K
: Z6 q8 Z w3 L1 p5 E9 y
9 o7 ]. \; E+ ^4 f0 V* ]1 ] |
|