|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & T1 P* T/ [/ F1 R% }- _
- [code]EDMA sample test application$ b, j% _. t5 W$ f: M
- /*8 k" S3 c, ]4 c! s. c. {7 _( Q
- * edma_test.c
6 j1 R+ l# q# {; v; Y+ S - *
. L" {, P. t8 {; K; L9 { - * brief EDMA3 Test Application
. f5 k7 q% L/ w% ?- q# L - *
: T) J2 v, v' p - * This file contains EDMA3 Test code.) j' w6 j: W5 y I+ p% C
- *" |6 I$ k* Z3 Y1 N$ Y; L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( x, n j& E; d/ `- i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! q# [# _) S) @% V4 ] - * TO CHANGE.
/ U/ M# H4 i' {4 T6 i - *
p! z. A& ~4 u3 M/ I; ~9 b- v' A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( b% z0 e: [4 P7 F - *" k4 u$ k0 R9 f3 a. v3 [; t
- * This program is free software; you can redistribute it and/or- y c2 A" b/ G3 T( ?5 j) x
- * modify it under the terms of the GNU General Public License as
* }& A- ?3 U! l( \8 _8 @9 r - * published by the Free Software Foundation version 2.
8 b k" D3 \4 Y& m9 B - *# r) q! R2 r- z4 O" \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 J4 T) h# h$ B! D! \ z6 U V
- * kind, whether express or implied; without even the implied warranty
" n. {3 C/ i2 g/ I+ j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 m- Z' J- o% T& @2 p U' b# Y. d - * GNU General Public License for more details.
$ V5 @+ b% i* v; Z8 G - */" ^: x& _' Z; z' ?4 D
5 w C+ S k- T8 W! O- #include <linux/module.h>+ V7 K# }: P1 ]2 @! O, K9 B, J
- #include <linux/init.h>
/ G. K. r" A" i Z - #include <linux/errno.h>5 o9 C, q" z- R2 @
- #include <linux/types.h>
, S: _4 `' U& A( ? - #include <linux/interrupt.h>' C, Z9 P9 b& E$ @+ m" z) z8 c0 I
- #include <asm/io.h>
7 r+ s6 S) F, N - #include <linux/moduleparam.h>
4 v( v3 x+ ]/ [* S( [+ I - #include <linux/sysctl.h>8 ~- R# ?1 x2 @/ Z+ @7 u0 Z
- #include <linux/mm.h>
2 \+ |- C. a/ m1 ?& s [: v) a C - #include <linux/dma-mapping.h>
' N$ U' i: d& S9 L' _ - 8 `+ `1 u- D- n" b
- #include <mach/memory.h># S: ^6 G+ b- |. d5 D1 Z
- #include <mach/hardware.h>- @# i2 A n1 Z( ]
- #include <mach/irqs.h>* \0 p# J6 o$ F, j7 I
- #include <asm/hardware/edma.h>
% g, l7 G# E' f7 [. x - " i( d4 i9 _; S! D% `/ f( C
- #undef EDMA3_DEBUG7 J+ `4 \" {; o; v" O& V8 }1 v5 Y
- /*#define EDMA3_DEBUG*/4 B# J4 c4 @! a2 `7 Z, m( ~
! [4 l# B, @, V4 i% k2 Z- #ifdef EDMA3_DEBUG
- ~) ?; v* v( c; n6 e# i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" j1 m( b% Z9 u: Y/ s) u& j! T. W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! Q, H- j5 S$ X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& x$ b9 I; v% E! k% R; \
- #else0 ~) R" [% O; i( t7 \+ a! U
- #define DMA_PRINTK( x... )6 D0 j6 i7 C' p
- #define DMA_FN_IN
0 Q& Y# m- A$ A9 A0 e - #define DMA_FN_OUT1 [* p/ p1 X( p
- #endif1 z2 f0 Q. Q9 l# X3 F
- " O1 K! _3 c2 `; F8 _. m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. p/ N ]( x) S) m - #define STATIC_SHIFT 30 G* J9 `6 R+ l* f
- #define TCINTEN_SHIFT 20
# Z: s- E, w' S' w: i - #define ITCINTEN_SHIFT 21
: I: H0 F' c l9 Y - #define TCCHEN_SHIFT 22& d4 [* F5 q' ]; D1 r
- #define ITCCHEN_SHIFT 23
$ {( L( w5 P' w2 ?5 G2 K& ?
, M. I; ?: h+ K! b- static volatile int irqraised1 = 0; ]* L8 d/ ^9 Y( ~
- static volatile int irqraised2 = 0;
, S7 p5 i0 r D# x* g8 x - 9 l+ u) E7 e" F( P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 J3 _0 x; `3 } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 A+ Y3 ]/ R+ n, p/ F) G$ D* c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) L! G2 J+ z% X
- 4 F) a8 [, N* z; t1 D) C5 }: M
- dma_addr_t dmaphyssrc1 = 0;
* Z/ O" T: L# Y, K) E - dma_addr_t dmaphyssrc2 = 0;. I4 {- i1 K; N5 w, P7 W* D" ^! [2 e
- dma_addr_t dmaphysdest1 = 0;) H5 [& B) A$ i
- dma_addr_t dmaphysdest2 = 0;
y2 M; N) g3 G* _8 L# P7 c2 U - , m6 ?) U6 Q* W4 M0 i
- char *dmabufsrc1 = NULL;
: E' P" r6 c, v0 b; Y+ b. W1 T - char *dmabufsrc2 = NULL;% j% P) d9 ?9 ]. n
- char *dmabufdest1 = NULL;
% N8 R+ K# v" q. \# s9 Y% Q - char *dmabufdest2 = NULL;
& H- o! y: @0 l$ c: m3 y
3 E( u Y5 ]& z: z- static int acnt = 512;6 E2 \) x/ l4 u, Z4 G
- static int bcnt = 8;% o, Z8 Y$ J4 H; S. C5 Q
- static int ccnt = 8;- A6 c! b3 d9 X1 y
- 2 D2 e7 p% a6 m# ?. C
- module_param(acnt, int, S_IRUGO);
+ V' D8 f, Y2 [# r0 L6 O% Q - module_param(bcnt, int, S_IRUGO);! o" J+ `) j* c3 `
- module_param(ccnt, int, S_IRUGO);
复制代码 : E# o) v% y) j# m( u$ G0 O
* g0 ]4 }, m3 @; f N# k: E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' O7 \7 `% f3 Q; P3 B; d3 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 ~2 ]( I# G2 ]) g* _7 `2 _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! h% O* T# U& n9 S; G4 o! }2 Q8 }
! w( A2 `# |! m# d1 R- \
6 ~9 R( i3 D: S# V# z! H6 ]3 a
|
|