|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 k# @8 J! _- x
- [code]EDMA sample test application
. Q7 J+ V. j; f! f' B2 n: d - /*# g T6 |/ E& }& V% _
- * edma_test.c
8 |* B( V( V; t. ^+ g: h - *; {! W! ~8 x/ X* T
- * brief EDMA3 Test Application
, B1 U- e- C; [ - *& c+ u3 s8 g& Z8 i# V3 ?
- * This file contains EDMA3 Test code.) X. D/ i: X. i# ~ u8 r' @
- *, f/ B, C2 i$ T! Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 F& w( R+ z) d& V+ l$ I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, J8 k7 J5 N! E3 d+ r - * TO CHANGE.+ j6 T# `! E$ J8 e
- *8 K, L# Y; J& j" x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! I* u; m9 | R0 o$ X
- *, y/ A4 T' I5 n7 V( f
- * This program is free software; you can redistribute it and/or) m+ ^* J! R! u# T" a8 p7 O
- * modify it under the terms of the GNU General Public License as; f, n ]: N2 b7 u
- * published by the Free Software Foundation version 2.! `, L; \$ v- S& t0 B! u
- *- h$ i# Y/ L9 D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ M9 g. u c: _# [% j: ? - * kind, whether express or implied; without even the implied warranty) H: K. D; ?1 W. @/ a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 P |- A; l. q' d7 s - * GNU General Public License for more details.
' M" J4 N! ^2 ]3 ` - */& V& q. ]/ Q2 [/ G* z' |2 W6 h; Z
$ `) H- o% y, D- l- #include <linux/module.h>
8 {& q8 u1 C. j - #include <linux/init.h>
2 `$ ]- W, o+ L" E/ M1 B - #include <linux/errno.h>
2 c6 s( y3 P, w* v* [6 A - #include <linux/types.h>* ]- y4 b: h2 L; y" f. u
- #include <linux/interrupt.h>
' x8 |+ n2 P X - #include <asm/io.h>
3 }2 A2 j0 n! Z% W1 A3 S, d - #include <linux/moduleparam.h>% d5 ~7 N6 G8 } ]+ S, m, f. K) o
- #include <linux/sysctl.h>- W7 X5 m R6 ^ F9 D+ X
- #include <linux/mm.h>- m) L( s' \5 a
- #include <linux/dma-mapping.h>
$ Y6 q/ m4 F' V
' F! V5 l$ l4 b% b, M) J6 x) J- #include <mach/memory.h>
' z; i8 k, D+ W$ [9 |7 ~ - #include <mach/hardware.h>
, d+ E) [& E5 W - #include <mach/irqs.h>% i, N5 K( T5 |- d9 K3 w) @0 j
- #include <asm/hardware/edma.h>. {: B! |: d# w% ^- |3 [, G
, E' ?. M' |2 D6 G6 W" ] I- #undef EDMA3_DEBUG& ?2 C' `9 h; B
- /*#define EDMA3_DEBUG*/9 J4 B( {: x! [/ P- H
- @1 v. r2 \6 W& z5 B- b# ]
- #ifdef EDMA3_DEBUG
" h1 i3 L" A3 l. W* O! m* s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" P. F/ J6 k' r; b, t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& n7 [# k Q" S# z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 r7 N" O. J$ p1 F) a - #else- ~% X) |3 A3 N; I
- #define DMA_PRINTK( x... )
* `% Z% ~$ w c$ u" P - #define DMA_FN_IN8 q5 V+ g1 a1 n" P( r, X, N1 }3 a
- #define DMA_FN_OUT0 a u; a4 Y0 `2 s9 K* R& d& R
- #endif
: V; C' {' h! F
7 M7 k) d9 y4 _# M; c4 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768), C& N0 [6 J. _* O3 H/ @7 a
- #define STATIC_SHIFT 3
3 L: o2 d" Y* s- F4 } - #define TCINTEN_SHIFT 207 R% F# ?7 O- {& I. n
- #define ITCINTEN_SHIFT 21! c* o% v; j& O* C
- #define TCCHEN_SHIFT 22" I6 {- k/ G$ ]2 Z# M
- #define ITCCHEN_SHIFT 23
9 [6 r% a- U' H2 [ - 9 K5 r7 l1 L$ f2 f; T- F' H
- static volatile int irqraised1 = 0;
_3 I0 V! p5 v J$ H. \0 J7 _ - static volatile int irqraised2 = 0;$ y0 Z9 O" V/ M/ L( |5 T5 b O
; H$ W& m5 i4 q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! }. y, y& a, m; G. V. J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ d1 ?1 y4 B. c8 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& j6 Y, r4 t/ o) C
, {, [3 U9 K0 B" T0 Q8 i- dma_addr_t dmaphyssrc1 = 0;. G, |' x; ]7 y' }* v
- dma_addr_t dmaphyssrc2 = 0;" y" N& k- i* O% d( L
- dma_addr_t dmaphysdest1 = 0;( |3 F% @) c( k) M/ h3 Z
- dma_addr_t dmaphysdest2 = 0;7 _/ q( B% p4 R" A9 a' w
- F |$ n5 N7 b( @2 G: g7 d- char *dmabufsrc1 = NULL;3 V- B8 Q/ v5 i; |
- char *dmabufsrc2 = NULL;
& k0 d" C# E+ l3 g1 y - char *dmabufdest1 = NULL;! l/ g( f3 V0 E$ I( z( z1 f) V" n
- char *dmabufdest2 = NULL;
9 d' ^7 c4 P" K! H( F9 T; R8 \
% \/ Y! z, p% p, J- static int acnt = 512;
% n5 N& ?3 K! L* t9 _' w - static int bcnt = 8;
h; T9 R! L8 }6 o8 U - static int ccnt = 8;
0 p6 X" h# N3 u3 Z8 n; [! N/ ~ - 8 X$ `) [4 W& k- H2 t
- module_param(acnt, int, S_IRUGO);- M0 r, V3 {' C8 i( |' ]
- module_param(bcnt, int, S_IRUGO);
+ v, H0 N7 y4 v% d - module_param(ccnt, int, S_IRUGO);
复制代码
% H! K3 Z1 ?6 {- J$ z# \9 C, i/ v1 _- `$ J* E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* y+ u- G, S& }5 e8 h7 d& n1 B Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( W: b& W, M, ?; G0 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' a% Q* u0 f5 d; D- a; r
7 d9 z- I5 g3 r- p* r, D' { b: R* [3 y4 w4 }, I. h1 }2 i+ J
|
|