|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ]* C3 j, l. p" b) z. j: r
- [code]EDMA sample test application6 Y( ]. q3 r. G& {7 d
- /*
0 Q- L/ Q0 {1 j) b$ ~- Z- U - * edma_test.c
) ^! K2 A6 K( G2 X/ H, c. Q - *
! m! r: p7 l$ V' j/ K - * brief EDMA3 Test Application
7 ~% D2 B6 z: F5 e1 N( X- M5 ? - *, V5 R) C9 o# ?. r6 |! ~3 |
- * This file contains EDMA3 Test code./ }0 `5 C3 P$ H5 ]
- *
( N8 |. Z7 Y y" T* ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 Q% w+ u, R) e. c. e1 z7 Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* @+ U& j2 j! ~1 t5 V - * TO CHANGE.& K+ L3 ^1 z; q( G2 `( P, Y5 s
- *
0 B7 }% A+ Q% W9 ~# n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. u% d, X# I" F2 ~$ [6 k' F0 k- C
- *
0 {* t0 y# Q* P% u' o - * This program is free software; you can redistribute it and/or
8 C2 q5 l% j/ ^/ p - * modify it under the terms of the GNU General Public License as. I* y% O4 e* [7 b& K! j( J! s
- * published by the Free Software Foundation version 2.- o! L# a% W. t- i& G" w4 f
- *
d4 p8 r$ q+ u: j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, ^- v& A4 y4 I" z" o - * kind, whether express or implied; without even the implied warranty* ]( P8 ~- m# t6 C& _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* M9 i- p7 |9 ^" V. L# d- |+ _ - * GNU General Public License for more details.; F! E4 Z5 |. y5 c+ H
- */0 `1 R% l/ Z: I8 y! v
. \1 p% o$ ^5 W% R- #include <linux/module.h>
: a8 f6 w& P3 b0 v& D$ ~ - #include <linux/init.h>
2 r( Z& y; F# [9 o; k - #include <linux/errno.h>2 K$ B) g, [8 [, ]0 M* X
- #include <linux/types.h>
; n. b9 N! W# z# a! {' J8 p4 R - #include <linux/interrupt.h>
+ V3 d* H7 |1 ^# H - #include <asm/io.h>* ^4 z7 L7 e# a/ U
- #include <linux/moduleparam.h>6 Z, a8 g& L, Y" h- j% T# U) Q
- #include <linux/sysctl.h>
$ l2 _. T: ?3 Y" N/ w& U. K; D. G; v - #include <linux/mm.h>' S. W* r% |" r% y# ?, l
- #include <linux/dma-mapping.h>) t% z/ a* s8 M" h
- 4 ]& J4 E$ ^; S$ |
- #include <mach/memory.h>
. z/ H5 W# K- V - #include <mach/hardware.h>
, X* [/ W) V( i9 Z7 E - #include <mach/irqs.h>
- r1 L2 e ^! c/ q4 o/ D" y - #include <asm/hardware/edma.h>
+ w: N: m& o. }6 E2 R - 4 b5 G6 K$ ~' P y
- #undef EDMA3_DEBUG
, P6 }1 I, P7 I% Z' {& M5 r$ C - /*#define EDMA3_DEBUG*/
) H% f0 Q& `/ o, m$ L
: ?0 D2 Y8 j- \- #ifdef EDMA3_DEBUG
4 [- ?( t& Q* V& |# g3 y# w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); d. u, V6 q, `8 M6 U) G1 y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 c T3 G; z W3 ]8 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 s& H9 O) V' }' W - #else+ R: Z0 p5 k C
- #define DMA_PRINTK( x... )) E- _- S7 p4 t0 q- d9 a
- #define DMA_FN_IN8 m/ z, P$ K2 c
- #define DMA_FN_OUT7 Z/ Q$ @+ H6 n$ d
- #endif3 w' V5 {& x4 @- T5 T, \
' Y) N" @6 X. C- j6 R' R- B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* p% K+ w6 V1 W0 H5 _% I
- #define STATIC_SHIFT 3
/ ^9 A4 O# ]/ B - #define TCINTEN_SHIFT 20' v0 B3 a. O- }
- #define ITCINTEN_SHIFT 21. ?# q3 K1 X& }9 c8 _
- #define TCCHEN_SHIFT 222 N# n# E( G% | l- K& q1 K
- #define ITCCHEN_SHIFT 23) }; [2 @4 C4 ]2 { J
% \% m" N6 I2 |) c- Q/ O: J. s: k- static volatile int irqraised1 = 0;
, M8 s0 h5 F" G4 K4 @# L - static volatile int irqraised2 = 0;
6 F% k5 M$ V( a. }
, Q7 V0 y3 g& u9 ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 W3 F6 X c, x2 g4 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* q3 B0 w; B: G, L/ J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% E Q6 A" ?6 l( [
- ' A z9 i; C$ S/ L1 B+ A4 G# I
- dma_addr_t dmaphyssrc1 = 0;
) P$ k' k/ R- Q( M R5 U1 [ - dma_addr_t dmaphyssrc2 = 0;" Z$ m! S; c z( u' z5 d' j
- dma_addr_t dmaphysdest1 = 0;
/ h7 h4 c( E; D, F# o3 m - dma_addr_t dmaphysdest2 = 0;
2 A* `& n7 a2 `% u) { G - ) I. A# p2 q: B$ Y7 ~! ] s% L
- char *dmabufsrc1 = NULL;4 B! J+ e2 I K# U( a9 x2 i$ T4 \
- char *dmabufsrc2 = NULL;
! I" E# r0 g( E9 T - char *dmabufdest1 = NULL;9 j# s8 L! o. E; @% v* t! i
- char *dmabufdest2 = NULL;. D5 y/ J+ H5 }( O" Y& K% H" h
/ M+ z( t" M- I3 t* c- static int acnt = 512;- i9 r( S y/ K: X5 G. T* M
- static int bcnt = 8;6 t9 c5 j: o1 n2 f1 L
- static int ccnt = 8;
/ y$ e0 n! L- I7 O& U - 5 E+ B) Q9 E! I. \ b9 C/ z
- module_param(acnt, int, S_IRUGO);' r% w/ ?- q& n% a9 n b( T- z% f
- module_param(bcnt, int, S_IRUGO);- ^$ m" ?0 n2 c% D$ ~
- module_param(ccnt, int, S_IRUGO);
复制代码 / N& W9 `: ?7 Q* I1 e" e; n# M8 L
4 Y v3 G2 e0 q7 F: S0 O8 O2 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# z$ I @& c8 R1 g0 E" N" e: Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* h9 m/ I7 O" r) I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ c$ B3 s8 ~) z& @* e. C. T& G1 Y
1 e+ b$ g f* ]. `3 b7 P/ T" j2 Z, ~: j5 p5 g w3 I) ?, B
|
|