|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + t7 p0 t: w0 _# h! A
- [code]EDMA sample test application
0 ~3 |) \& }; n }4 m' l - /*2 Q2 ^4 C% y/ `$ N3 k+ m- S* x3 q
- * edma_test.c
8 r0 ^8 _4 p$ w# J; |3 F, k5 m6 { - *5 ?8 ?0 O1 J6 ]7 g( h
- * brief EDMA3 Test Application3 o; B: c1 p ]- T6 f8 h
- *
2 r5 x1 ]- y$ d% p - * This file contains EDMA3 Test code.
2 D/ E* N" Z0 h# p& E - *
5 N* F* f. J# e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 p L. J' w8 N" C; Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 \' Y) C) o* i - * TO CHANGE.
9 c. K7 F. y; _+ x: J8 ~, G5 H - *, K% o$ o5 N& ~' u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ l1 m# S6 o7 C8 H" R1 I4 a [
- *2 i9 O5 K: S+ J* F
- * This program is free software; you can redistribute it and/or
7 A& j5 _3 j5 X# l$ o. z& |( f - * modify it under the terms of the GNU General Public License as
6 o2 l |* F2 S1 G# O) n - * published by the Free Software Foundation version 2.
7 Q" H, Z$ K/ Q; v: w$ { - *
2 |& {8 b3 N- U& ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 o$ X0 L _* |: F; [ T
- * kind, whether express or implied; without even the implied warranty
/ o' f- V! x1 l- i) T6 l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" {: v; V9 @8 M7 P) ?* g - * GNU General Public License for more details.% D: x2 ^1 B- k
- */
# Y6 c# L3 F0 k' t2 K - " A5 G) p1 Q* l2 e0 y0 R, F
- #include <linux/module.h>5 {2 {; r. S& ] j" x3 k4 ~# D0 R
- #include <linux/init.h>8 b# j2 p0 U3 I! |7 [/ y
- #include <linux/errno.h>
) {" E5 D$ H4 @6 N0 Y - #include <linux/types.h>
8 T5 M, J2 t1 O8 |! X1 V, L+ K2 H, J - #include <linux/interrupt.h>: y# F7 b& K$ ?
- #include <asm/io.h>7 M9 s, W- g( U
- #include <linux/moduleparam.h>$ y2 f( K8 c% G/ T3 W
- #include <linux/sysctl.h>. R$ D3 v$ x! }4 f$ A8 l
- #include <linux/mm.h>/ _% h8 ~* a! [& c& [
- #include <linux/dma-mapping.h>* M$ [. Z9 M4 C. d* W L" e1 r
- ! U- |5 l0 ?% m" s; y
- #include <mach/memory.h>
! l9 \ g; ]( Y7 h2 q - #include <mach/hardware.h>
+ d1 p. ]. e9 ?) a; }& ^ - #include <mach/irqs.h>
& ^! _. o9 S& m X+ n4 D/ _3 K - #include <asm/hardware/edma.h>
/ b' W, @* |( @4 N+ L - 8 J- h( D; c. P
- #undef EDMA3_DEBUG
1 j. L! l) ~: Y9 Z - /*#define EDMA3_DEBUG*/
" ^7 F( c- G- w: B4 z& U - . q! _9 t6 ]3 H8 |$ c/ m/ W, x
- #ifdef EDMA3_DEBUG0 G- {& v/ H- M8 w- H3 m7 o/ e5 N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) i* h4 N" i- d+ x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# K0 a3 m& K( N& a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ D# t3 Y! k& r - #else' e; R9 q* n+ U7 H9 P
- #define DMA_PRINTK( x... )
]9 [9 q- f% w$ D - #define DMA_FN_IN4 l. k5 j) c; l, X0 N- F* M5 I
- #define DMA_FN_OUT
: X# W) y9 [$ t& U- c, V - #endif
, H+ h- Y) |" T8 t
8 [5 n' V% q8 }- B5 E2 Y# O+ {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, c. x5 Y: n" t# m. i - #define STATIC_SHIFT 3
* p4 k- F9 }# G( O: S H+ Z - #define TCINTEN_SHIFT 20
. `+ ]2 |7 C: k" K - #define ITCINTEN_SHIFT 21
* r S2 g6 o/ T - #define TCCHEN_SHIFT 22
" g% Q5 X1 K( {! s - #define ITCCHEN_SHIFT 23+ b, I8 w9 c3 @0 p
* s! d/ D* N2 U7 a, ~6 m0 U- static volatile int irqraised1 = 0;8 m- u/ m8 R# w! x
- static volatile int irqraised2 = 0;, y8 P$ V5 F: l, n8 R
9 z' X2 m6 I' r2 Z! L9 e. h; C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( M% ?1 G+ Z f8 { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 m8 a* I+ I2 A8 `/ d' ~$ O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
u7 [' k+ d; k
" R7 J6 ?0 N& e- P( K- dma_addr_t dmaphyssrc1 = 0;
7 F; r0 P5 E& k4 T& ? - dma_addr_t dmaphyssrc2 = 0;5 Q: u9 l! W, i
- dma_addr_t dmaphysdest1 = 0;( x& Y. ]& L2 q. }
- dma_addr_t dmaphysdest2 = 0;
* ^+ a3 K3 r: E3 t) w% F3 t# _% d. Z1 g
7 ?2 i" Q+ t6 D) L! u2 p+ _$ ^- char *dmabufsrc1 = NULL;
+ @; g# u v4 H! h- y( F6 q - char *dmabufsrc2 = NULL;' p: y `4 ]- K) P% K; v
- char *dmabufdest1 = NULL;
8 M# a4 W& E- i5 U( j - char *dmabufdest2 = NULL;! k [. Z" X' J" i9 Y
- $ X0 Z+ p$ _' t
- static int acnt = 512;- u: e* X* ~0 n1 [
- static int bcnt = 8;( y& `! C% ^4 q- E. ~7 N
- static int ccnt = 8;6 n: p2 S" J" L
, W0 L3 i! y2 h; ]# X- module_param(acnt, int, S_IRUGO);
$ X5 r' E; _/ H+ N - module_param(bcnt, int, S_IRUGO);( Y8 L6 Z$ _; b
- module_param(ccnt, int, S_IRUGO);
复制代码 6 j9 U Z* \8 N5 u8 _
# W0 r. Q$ d7 @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 ~' ~% r2 l. `1 x! }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 i+ P/ Y$ P/ b7 E# f6 D, Q4 r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! x" u8 H$ C# Z% h9 L
6 \0 ^* i/ T( {! X' f; N0 {3 N) t* h. S
|
|