|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - o, \* c8 K4 k; @
- [code]EDMA sample test application1 n/ G, {) w9 C, b( S/ U# t
- /*
9 y$ J% `: k" ]6 P' K* b - * edma_test.c
4 v' @" E8 z0 ?" \5 z - *
$ s0 K$ f& b7 {- @' G- S- L - * brief EDMA3 Test Application8 d+ t( Q0 N( ?
- *
0 K- {6 ~% J; \7 N5 h* u - * This file contains EDMA3 Test code./ e0 C0 b! R4 d; M0 y- Z# t8 w- _/ d$ S
- *5 v, K; S' ?. A& P0 [7 J/ ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 V1 S! b2 {/ V: [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 B% o; R z5 e: ` - * TO CHANGE." v/ l" x$ h% j3 D" B! s7 R
- *1 A& ^! w, e* e3 U" W, v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ e7 L5 v" N( t0 Z
- *5 D1 |. r5 m$ _0 _7 q3 v
- * This program is free software; you can redistribute it and/or/ T8 P0 X3 K3 z8 Y2 E4 q }+ L
- * modify it under the terms of the GNU General Public License as
4 C; M% m. e4 S5 s$ K' J - * published by the Free Software Foundation version 2.
- D+ b+ z4 c; l" P - *
0 V n' k/ s0 b& ]( G7 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 e( `' {5 a' l9 a
- * kind, whether express or implied; without even the implied warranty* Y2 F& K, F! O2 r& s( M7 x2 @/ Z9 R" @- V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" c2 j5 L. H! g- h- C! }5 s8 l) ^
- * GNU General Public License for more details.8 h/ H. V' s; d( `
- */& c* h/ c7 r: B' s6 ~4 z
7 n% H7 i) y3 Y! ]- #include <linux/module.h>% F/ {. m( q2 l. F" c3 H
- #include <linux/init.h>
8 O# Y, S; u; I% i% ~* r; y - #include <linux/errno.h>; h7 W$ u9 q( I* T$ T0 J: p
- #include <linux/types.h>
/ S( f" U; N% @3 z7 C4 w! o - #include <linux/interrupt.h> S6 \2 R1 s) X0 _* N
- #include <asm/io.h>
v# L1 c' T" \2 ?9 a - #include <linux/moduleparam.h>( e" }1 E( i* Z4 V
- #include <linux/sysctl.h>8 [: O! t& G8 x4 o# M) j7 m
- #include <linux/mm.h>
. Z3 i9 P9 X- N, c% t - #include <linux/dma-mapping.h>
/ N1 A: Y6 Z" q. P A! `8 s3 g
) L( F" I6 Q% R. `- #include <mach/memory.h> V. ^, |. J+ ^( R. G% U2 e2 l
- #include <mach/hardware.h>& `) {. K4 P2 t( z6 ]$ I6 U( ^1 o
- #include <mach/irqs.h>
& }- c5 V# j# k p2 q3 H - #include <asm/hardware/edma.h>
5 M) L5 p8 m6 H' q) Y - V4 Z9 G U+ B3 ?
- #undef EDMA3_DEBUG! x9 z/ U% D% ^7 o8 K
- /*#define EDMA3_DEBUG*/2 f" l& m5 A. l6 G' o( T
- ; s) }8 J; P- o' X
- #ifdef EDMA3_DEBUG
/ _9 t$ x. J* I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 S: J9 y4 g! b# f* ~; P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 j1 m) _- L) W+ b$ K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" S$ Q4 }* A( O: H5 Z
- #else
2 B# m+ M4 x9 v - #define DMA_PRINTK( x... )
0 W- F8 x7 g0 V; j - #define DMA_FN_IN
: X% | @* g. P/ d: N( _0 v4 P - #define DMA_FN_OUT
" [' S8 H- Q {" G7 _( S2 A - #endif% z8 P0 N) W/ J
- 4 M& m1 n6 ^' q" Q9 x$ Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 H m0 ^/ [% c& F - #define STATIC_SHIFT 3
* X: @/ G; o8 S- R; I9 ^ - #define TCINTEN_SHIFT 20
$ L0 b! V% j3 H- K' T+ s i$ s: D - #define ITCINTEN_SHIFT 21- Q7 f' p3 ^6 l- j2 h) \4 I& T
- #define TCCHEN_SHIFT 22, A0 h7 D+ S ?: w7 @0 W# s
- #define ITCCHEN_SHIFT 23
M# u5 h2 I$ X8 P2 ]$ T
4 g' ?' J, R& U. _' I- static volatile int irqraised1 = 0;
, Q" ^+ s7 z- T, y4 ^: C - static volatile int irqraised2 = 0;
7 U* S: T$ ]$ C - + H- w) G j; M. n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ^: c+ h0 S4 |+ M! z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 J9 ?( E" o3 ]& Z% g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p' e g7 l) d, m" \
- . m9 Q( D/ E X- l9 Y
- dma_addr_t dmaphyssrc1 = 0;. J& `3 v6 Q$ H
- dma_addr_t dmaphyssrc2 = 0;
( S8 g& u# o; U' i. s - dma_addr_t dmaphysdest1 = 0;# g2 B& a- L) [1 ^! x) }1 ^1 Y( O
- dma_addr_t dmaphysdest2 = 0;; q0 W* _- d2 v7 G
- {6 s, z% m" v3 a2 k
- char *dmabufsrc1 = NULL;
, J! \3 g$ m5 Y - char *dmabufsrc2 = NULL;/ U$ e- l/ a% W! Z
- char *dmabufdest1 = NULL;- H0 W0 G r I2 Q! M6 }2 N6 `
- char *dmabufdest2 = NULL;
; R0 e. Q# x6 C* P* l8 m
7 v- `" R( i0 C" e. C- static int acnt = 512;, R: Q( R- O2 d6 u' A
- static int bcnt = 8;
# Z9 d( N. e8 e( o" {& \ - static int ccnt = 8;
9 M. a6 W2 z) Z/ i4 }1 o2 R+ b+ v
$ J# R- O7 b9 g. m- module_param(acnt, int, S_IRUGO);
" ~8 S8 |8 g' b* `# j - module_param(bcnt, int, S_IRUGO);4 H6 M; {- R+ g7 H
- module_param(ccnt, int, S_IRUGO);
复制代码 ' Z! a; r; @# |0 a) U4 B5 f
) j4 D4 ~ w4 `/ o5 I; C0 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! r1 k9 I9 S. Z$ f" n* b! Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( I$ r! D: M' b# |( J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 ?6 m) Z' c3 h1 _8 @/ @
+ ~! V, F6 V4 U3 W1 f
8 N1 l1 S2 I( p3 `" o |
|