|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 t# ~, |5 v" B) C1 |' [- O) r
- [code]EDMA sample test application- d% P2 `; i d+ |
- /*
$ K2 T5 ?: C) p# i2 k, P; o& O - * edma_test.c
7 O# g" g3 X" P# T: o - *
! u9 |( J% ]- f4 Q - * brief EDMA3 Test Application
! x$ u( U$ j3 Q6 X, `- u - *
. H3 r+ M2 Y, v* ^* d - * This file contains EDMA3 Test code.0 u n' ? d1 d. N0 }: N6 w* M2 p! E
- *+ f6 z, }; F; i4 v; Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 P, p; l9 _' o4 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 ^9 A2 w8 Q: G% S
- * TO CHANGE.
5 h- {' V) g/ Y+ q& z - *# Q+ V/ R2 l/ B9 ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) m- z* P9 t! n7 F+ M - *
1 T8 E6 N T8 _ - * This program is free software; you can redistribute it and/or
8 M8 O5 ]3 }0 T& R$ U% f, x% w - * modify it under the terms of the GNU General Public License as
& V; D6 E9 k6 ~6 Q9 i! h( J8 u; y: A - * published by the Free Software Foundation version 2.
3 a2 q4 A2 o+ k) k, x& } - *
# i n9 t6 B X! D, @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 e9 l# d3 b% e: a4 h6 L
- * kind, whether express or implied; without even the implied warranty8 A; I2 E9 ]9 Q. e. }! J$ E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the N6 B# H$ V7 u6 k
- * GNU General Public License for more details.
7 X# D9 f$ r- c6 v/ Q& k - */, k0 W7 a' I2 A3 z" Q" w
- . J0 z* S6 o/ A" K1 R& {
- #include <linux/module.h>
5 X" R6 E+ v$ K - #include <linux/init.h>
% O; |+ F* b. D' c* ^& r - #include <linux/errno.h>
6 C- [# n" r& I& M8 W1 ? - #include <linux/types.h>
4 p; e: K! s/ b0 Y o - #include <linux/interrupt.h>
% K( ]) l' F: A5 v - #include <asm/io.h>
5 }5 E4 g/ u: u% a6 t$ f% D* v3 V - #include <linux/moduleparam.h>
4 H6 ]+ n0 Y( m8 p8 r9 c - #include <linux/sysctl.h>2 U, h/ b- o# F) E1 |
- #include <linux/mm.h>
) ^3 n! m- z( E4 F( ~3 r! a; ^ - #include <linux/dma-mapping.h>
+ Z0 C5 h1 z0 G* w! G( V% O' D d j
& `" _# h. \" [9 l8 X- w. A- #include <mach/memory.h>; v. u& k/ o! t1 h _
- #include <mach/hardware.h>* Q2 f! r8 M, c3 i' k
- #include <mach/irqs.h># M- b5 \9 j0 u/ V9 V: x0 \% I" U
- #include <asm/hardware/edma.h>, d) Z; d5 ~* ~7 h/ h) \
- / i% e; I# n( ^0 j$ L1 Z! q: m6 Y
- #undef EDMA3_DEBUG+ }$ a" ?) b4 p3 P
- /*#define EDMA3_DEBUG*/9 k, |* @0 t- ?, p1 f# w( H: j$ N1 ?
0 t0 N9 H: X& L3 z; d" [5 [0 U. Z- #ifdef EDMA3_DEBUG t2 s* h8 G% D; v1 p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 G6 X0 f! c8 t4 K9 L$ Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 J- W/ r- }3 k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' R8 o# o1 ?4 i" j1 C - #else1 e2 |3 k6 h5 T2 x( v/ `/ k
- #define DMA_PRINTK( x... )5 q6 @# h' r: p' W
- #define DMA_FN_IN) b% L8 t& k s1 s1 p
- #define DMA_FN_OUT) u( ^7 T, m+ P: X1 K0 ?% k X; K4 q# ^
- #endif* k1 c+ `* P6 t$ z& Z, u4 |0 n) Z
- - j: X! [! A6 Z @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 ? u: Y* \: q( ~, f/ r
- #define STATIC_SHIFT 3
( F" S: G ^& c, S" e6 X - #define TCINTEN_SHIFT 204 m0 q+ s }7 k; F9 x
- #define ITCINTEN_SHIFT 21/ E7 _. @( P) p- K
- #define TCCHEN_SHIFT 22
; f _- p" \ \: M! Q; {4 ^* F - #define ITCCHEN_SHIFT 23& }. s! U5 f6 S2 ]$ D
- ; W/ T: J. Q( ^: I2 d; d
- static volatile int irqraised1 = 0;; O+ L4 Z+ r% d2 h! q. |
- static volatile int irqraised2 = 0;' o# x2 s7 o5 M6 v
2 ~8 y& Y1 ? b8 W9 @% V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" }; ~" g' W, t" i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ j/ X% T6 J" o F* j/ N( T8 ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. O: a( `" f3 X0 d7 r
- . M5 V$ {# e; {' N: ]5 T
- dma_addr_t dmaphyssrc1 = 0;& ^4 H: R- y. d* H8 O7 L
- dma_addr_t dmaphyssrc2 = 0;4 X$ V* G d6 D- t$ k
- dma_addr_t dmaphysdest1 = 0;+ M0 n g% f, o) i
- dma_addr_t dmaphysdest2 = 0;
6 q" b7 k/ A @" ^, f
) d! |: b+ D: m) W3 m9 T- char *dmabufsrc1 = NULL;6 ]6 X7 g4 o$ S$ n
- char *dmabufsrc2 = NULL;
! y3 A1 O% G* X1 G/ V. M - char *dmabufdest1 = NULL;
3 ^" F/ M' k2 I4 E7 t3 @8 D - char *dmabufdest2 = NULL;
p0 o, F7 X) P5 @! K* ? - n. R6 K" i$ P5 b5 h; G1 o- [
- static int acnt = 512;
7 j" j0 b3 ~) H0 L4 f - static int bcnt = 8;
( |% x5 [) V* l - static int ccnt = 8;
7 N. e/ m! T, L9 ?7 x - 8 ^1 q/ |4 a; n9 \9 {. Z
- module_param(acnt, int, S_IRUGO);+ K' c7 t" N" {: r
- module_param(bcnt, int, S_IRUGO);
! z2 k7 o! m) i! ~ - module_param(ccnt, int, S_IRUGO);
复制代码
" K+ Q# `) W; M8 {; `2 J) ]# \2 A% f& _1 _4 l- b% P9 A2 g- ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 y- W9 n) Q6 M4 T( k* a. }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 t' Z6 u* `5 A1 @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! _5 F* v: m5 @
3 Z/ J L! D9 h4 R* y$ ?7 y2 Q2 E' E4 Z8 K2 H. E: l9 e! U2 W9 u: G
|
|