|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # l3 j& Y: f/ h
- [code]EDMA sample test application
6 c* e7 H( j I4 @" n1 x - /*+ A; h7 d M7 I3 ]$ p
- * edma_test.c
2 l6 ]0 Q) V) u6 Z& z: F+ U4 _% r - *: b, P i) _9 f+ E2 i# F, {$ K
- * brief EDMA3 Test Application, Q; y) k2 U6 f% a1 N: j- g! B" S
- *
' ~+ h8 M2 F/ P; q - * This file contains EDMA3 Test code.
% r' J, b( _7 W1 z! k) f0 I - ** j6 {3 `& G- u" c6 ^# P; Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. K9 a( W B3 y" _$ A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 [9 [4 C ^* i4 ~& m* E+ i$ z
- * TO CHANGE.$ S1 E1 f- j4 ?- ], n+ K B' n
- *3 S: e7 y- P& L) b% m5 ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" ~8 d* m9 R# [* p+ o5 V - *4 S5 s- ^9 ]5 ^$ q5 Z& {) ?8 t
- * This program is free software; you can redistribute it and/or* m0 \* g. F% ?$ i. l8 h
- * modify it under the terms of the GNU General Public License as
1 m! y9 F1 S ^! G; @! @ - * published by the Free Software Foundation version 2.3 B: }8 h2 |0 G& S) ^9 _ [
- *
& Q9 r) V/ y' H! q% e9 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 t# f4 v: B0 v# c' A: h
- * kind, whether express or implied; without even the implied warranty* N/ Z5 Q% _ ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, Y/ V# s4 S2 K3 B* W0 u - * GNU General Public License for more details.3 S! n( ~+ I# o8 d0 \, ^
- */& C* ^: ?: K8 I% \- v0 r
- ; A' U( w$ d3 m3 U9 _: |4 Z W5 c; x
- #include <linux/module.h>* V4 I2 O3 F! z1 n; O
- #include <linux/init.h>2 |, ~1 A1 j; L# F
- #include <linux/errno.h>* o- }. h& U$ z9 x, A) o) t
- #include <linux/types.h>
: H/ \0 O# j+ i. t8 E0 \9 o - #include <linux/interrupt.h>0 m0 z2 Q6 c# L
- #include <asm/io.h>4 W$ D( c' O9 Y2 K
- #include <linux/moduleparam.h> }& A" M2 o# P2 C
- #include <linux/sysctl.h>
! I( h0 E; |) g - #include <linux/mm.h>: |2 ?& |8 K# j3 \! z: T
- #include <linux/dma-mapping.h>
- y# C; C2 q/ l6 G - 5 A; |# A3 R3 b, `* n
- #include <mach/memory.h>1 a- i8 ~0 z( M" ]% d# K
- #include <mach/hardware.h>
+ R% v: y" }4 R! O - #include <mach/irqs.h>4 w0 D. V7 l" [% L# Y. |5 j
- #include <asm/hardware/edma.h>3 ]5 Q. l0 Q+ `4 P0 g/ I
- 1 L5 P( A8 s( P; G3 G
- #undef EDMA3_DEBUG* d+ G* V T( j6 [, R0 T0 h& Q
- /*#define EDMA3_DEBUG*/
9 D% L6 L! I( t- W0 `7 \/ L7 t6 t4 n
- ^ p% \# P7 s3 W: v- h- ~- #ifdef EDMA3_DEBUG/ v& a# t/ G! J- I3 u0 ~( K; p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' ~4 s* c, E' l# d& \* W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# W2 O; \: h7 A% J! l6 f7 l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); n1 t6 r4 m* z0 |0 L9 \
- #else* k% `* L) W% U) {
- #define DMA_PRINTK( x... )
5 V" _* g( K3 J - #define DMA_FN_IN6 m5 H1 m# T* z& k* x
- #define DMA_FN_OUT+ F" f3 c! r+ n, t F5 V
- #endif
( N, O0 S6 G, f+ z4 e( N - . x2 ?* N& l' h5 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, \) n3 Z1 O9 @9 |4 c - #define STATIC_SHIFT 3
! H" ~- r% s O* F0 z - #define TCINTEN_SHIFT 20
! a' I0 w7 P: C - #define ITCINTEN_SHIFT 21* }4 L. n, r& N
- #define TCCHEN_SHIFT 22
# p) k( o4 P3 }- h5 N+ N8 g/ f4 p - #define ITCCHEN_SHIFT 23
1 E/ g, [ z' Q" G- ~
1 G' P0 Y0 p1 `0 U+ v3 u6 O( r- static volatile int irqraised1 = 0;1 c7 |% X7 f9 ?: e2 f
- static volatile int irqraised2 = 0;
3 e# a% _2 G7 x3 n( E
+ h& }7 i& d$ ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) k* i, _% B3 N& U; G3 V5 n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ S) ]+ k' A/ K" `) f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 \0 I5 e% ^' ?& K( ~$ ~6 O - ( l9 L0 [% x" q
- dma_addr_t dmaphyssrc1 = 0;$ A3 w ]# @, M. E! K* h0 E
- dma_addr_t dmaphyssrc2 = 0;0 z/ D$ p# b7 I, T8 B
- dma_addr_t dmaphysdest1 = 0;8 Z% @* o- s& U/ Q+ p: X1 M! E" D. }
- dma_addr_t dmaphysdest2 = 0;: c3 [9 \; _; s/ ?
! g, c6 a* i! E* x Q5 |% E- char *dmabufsrc1 = NULL;
7 [, |# @, P7 _" B - char *dmabufsrc2 = NULL;. Y3 ~ G( I5 j& X1 s
- char *dmabufdest1 = NULL;
1 i, z7 `9 G, g" ~# x \ - char *dmabufdest2 = NULL;) T, Q! B3 Q5 Z0 \! ~
9 F/ `5 B- y" |! F4 A# V( }- static int acnt = 512;
3 k' {, s l7 Y- j' f# P - static int bcnt = 8;
' m/ e4 P3 Y$ d8 K( r/ I) c$ \ - static int ccnt = 8;/ b l6 f& T) B& M
- , Z% w$ P5 Q0 q+ V2 R# M, }7 ]
- module_param(acnt, int, S_IRUGO);0 [3 p K' x. z
- module_param(bcnt, int, S_IRUGO);
4 e% E9 H) {, f$ W! J5 R7 g! P - module_param(ccnt, int, S_IRUGO);
复制代码 3 x- u1 U+ h9 t0 D/ j2 f' W1 x
4 n1 ]7 S5 `! H! M' f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
Y8 D! }, @8 ]* e/ larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( @+ L# n; S/ G9 y$ [; A; y4 j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 {9 ]" M) B1 P7 k. b( s; d; ~' A Q, L" n
; Q" @- J# k! `
|
|