|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 ?* P2 ?7 Q# Y! g3 B7 m/ c6 K/ L/ [
- [code]EDMA sample test application
5 u7 g4 w, L# P8 d) j( _ - /*6 I4 g( k* `7 b' Z1 ]
- * edma_test.c" K9 u# `8 @, ]9 s
- *
8 W1 j4 p! H# t* s! A I. m - * brief EDMA3 Test Application3 I t" l+ e2 W8 C1 ^
- *6 F9 C% |! f8 U# U
- * This file contains EDMA3 Test code.6 s2 {0 H( \! o U$ ]$ I% [( j% F) Q
- *5 w P- `* w: }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- [4 y I5 h; A3 h9 i Y5 C* X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 {8 O: {& k3 {& e" t
- * TO CHANGE.8 S5 Z+ k' s5 j! i! J( {
- *$ B: v( E2 y% l/ }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 d0 V" t5 W Z4 F8 H( f% [
- *+ g E7 K. @" ]% [% n9 a
- * This program is free software; you can redistribute it and/or
) c2 R# w) T2 `2 S4 Y - * modify it under the terms of the GNU General Public License as7 f2 H+ G1 ]1 O% g
- * published by the Free Software Foundation version 2.' x' ~9 M% ?) K2 e5 Q" i
- *3 j5 \7 k: j) i7 W* T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" n% K$ b+ ?: V- w' v" @7 Y7 b
- * kind, whether express or implied; without even the implied warranty* s% U3 R" n5 C# `# Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* X) s. G+ c; b& R$ L0 h1 y - * GNU General Public License for more details.
8 R: a6 S' I6 r! M) S. F - */
8 l2 g1 ~5 {$ z3 O7 i
1 ` C J+ }; x6 k# ] [ a. I* l' w- #include <linux/module.h>6 g% T( w& R5 k2 R9 u
- #include <linux/init.h>7 l8 U, W8 k9 z+ T5 \; {8 T
- #include <linux/errno.h>
# U) c% Y) N) ]. k9 W' O - #include <linux/types.h>
% v$ R3 d5 l/ H4 N$ \ - #include <linux/interrupt.h>
7 l) J) B: b8 v/ }" s6 @7 P - #include <asm/io.h>% h/ W9 G; U# l* |
- #include <linux/moduleparam.h>
5 d7 X- k# w7 U. @3 c( S - #include <linux/sysctl.h>
( q* U6 P$ H6 i! ~" o8 O - #include <linux/mm.h>
7 p$ U2 O. W' H$ _5 h* E* j0 D - #include <linux/dma-mapping.h>
. ?( U6 {* _% r+ b& Y8 J* w - 2 J( h4 o: h% V$ c6 J- w% t7 S
- #include <mach/memory.h>0 O) R: O7 C5 X( M& W5 g" U* |! \
- #include <mach/hardware.h># W5 Y" \0 b3 W" d' w
- #include <mach/irqs.h>/ R+ J3 ~& P. |* b0 _" _
- #include <asm/hardware/edma.h>( l/ e1 P: Q; W$ v3 z% ], _; T' `( T
- , j) i3 Y" m' y( f; X
- #undef EDMA3_DEBUG8 {$ y( O- B, [- |( S. V
- /*#define EDMA3_DEBUG*/1 w2 P( V/ p6 t$ ^2 T8 V# q; I
# h2 ?1 }4 X) [" ~7 o* X' a: \1 r* L- #ifdef EDMA3_DEBUG+ A. u, L% f/ z' w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! ~4 s0 y3 F) X3 t" x% X3 u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) Q; h0 j8 f. V# _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) f" \1 K, g/ n, A' R( c' B
- #else
& h7 A' C$ _5 s- L) P0 _2 f - #define DMA_PRINTK( x... )
& Z/ p4 ]( I/ |) f - #define DMA_FN_IN1 V1 {& {( p/ r* D$ j5 U9 ~4 M& |. z- `
- #define DMA_FN_OUT
( i1 {/ k, W+ i6 j2 | - #endif
5 J, }1 p7 C7 Y. J# Z0 b
? r/ W' Z# i/ d" j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" C7 E2 e8 e- C3 S6 Z0 s1 N
- #define STATIC_SHIFT 3! k8 n$ c: M( J, l' y
- #define TCINTEN_SHIFT 20/ V- }* l' c$ V$ _4 h
- #define ITCINTEN_SHIFT 214 i# }& G- U: o
- #define TCCHEN_SHIFT 22 M Q& j( N- a' u1 u
- #define ITCCHEN_SHIFT 23) z. U; B/ b+ M
1 m+ ]. {- z& ?* o) A- static volatile int irqraised1 = 0;& [# j+ b7 b9 F% M3 z3 q
- static volatile int irqraised2 = 0;; `' F4 e! |% |) s, }7 N
- 4 J) \9 p4 e2 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 J7 t! X/ K0 f* H, \5 D. B* B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. M& p7 t5 G( w) ~ ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 p% o! K3 f" [. X- M+ n% [
0 M$ y. @9 ]& b% Z& p" ~( T. y- dma_addr_t dmaphyssrc1 = 0;- k& Z3 D7 G7 _7 p
- dma_addr_t dmaphyssrc2 = 0;! [1 N! v4 T' l- d8 R$ q
- dma_addr_t dmaphysdest1 = 0;
7 l+ V+ p% C# O6 s - dma_addr_t dmaphysdest2 = 0;
3 @- y; c$ R' c, P6 m1 D; T. | - * ~- z2 u" U+ U- k+ j1 n
- char *dmabufsrc1 = NULL;* C9 H) l E- Z7 U5 J. ]
- char *dmabufsrc2 = NULL;4 g1 K3 M- z8 ~4 a. _
- char *dmabufdest1 = NULL;, p' v0 \" d1 ?- K* }( E, }
- char *dmabufdest2 = NULL;
2 b: e1 Z* ^; H5 ]* I' u& H; e$ E
3 U& a, g1 f+ {* p9 o% E. T* b& W- static int acnt = 512;( B' O/ W3 Z j1 z/ X
- static int bcnt = 8;6 `; Z* t( }5 e
- static int ccnt = 8;
& z" {! j* F# X4 s1 X3 D
/ J' M2 P2 V6 F: k! V- module_param(acnt, int, S_IRUGO);
j: J) D2 s/ m: e+ r! Z - module_param(bcnt, int, S_IRUGO);
i. z2 e3 A3 g8 g. Z - module_param(ccnt, int, S_IRUGO);
复制代码 5 n3 K% ?; o( [1 _9 n4 y
9 R+ x' H3 @# a* K$ O. r1 {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ _2 E$ i# E3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 v1 _: ?+ Y Q9 `2 E2 T0 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 ], _$ S; s- g1 q! y5 v7 B2 ?3 l; v7 m; n
+ |% ~( R) D1 Y( v0 k |
|