|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 j9 v* V4 w: \. c
- [code]EDMA sample test application
! ]- q( g% x0 V2 o+ { - /*
% T: @9 P' W% y' E S1 A, A - * edma_test.c( h; J4 D! c2 A! b: ]
- *
! [# V, _# r& Y3 J - * brief EDMA3 Test Application4 e# q9 h9 }) u. K5 j! l" w& p
- *
7 b! C5 k0 g6 |* p - * This file contains EDMA3 Test code.
# ~- R- A5 e/ {" R3 g5 ]; P1 i - *: Q) a, n" T; G# n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& w% I( n3 [9 g5 V3 h& ~" l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 [# ]/ [. q, D6 F3 r# _* B) t
- * TO CHANGE.3 R) D2 X/ f7 i2 X7 U' h
- *
3 R" p- o$ j0 H9 }5 R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( T1 e: g4 A* d- Q8 h6 K - *9 B9 j' b/ t. U. h4 @; |5 X
- * This program is free software; you can redistribute it and/or
: g/ Z$ n! I/ [/ }1 B1 N1 D3 P# P - * modify it under the terms of the GNU General Public License as' P$ a3 z6 d# y2 j1 D; }
- * published by the Free Software Foundation version 2. Z& b/ g3 B$ Q$ B5 Z( _$ ^
- *9 T% H& z: }& y& f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 i% Q7 j7 V. i4 A, M( x, P* m - * kind, whether express or implied; without even the implied warranty/ y. S2 h( Q( Y/ k: i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& V2 u8 x1 t, {
- * GNU General Public License for more details./ j3 E7 l/ T9 A" M4 n3 c: \
- */7 U& s% W& e' \ Z+ G
- * q1 U* U3 Z6 }9 s' X
- #include <linux/module.h>
, Q4 l$ C; v- \ t9 e0 K& b% c - #include <linux/init.h>
# S5 a1 Z$ v o" D. M3 G) P- Z - #include <linux/errno.h>
7 r$ z1 c$ M# p3 U' z - #include <linux/types.h>3 C v# [4 g+ {0 G8 ]! k
- #include <linux/interrupt.h>( D. `( d6 M3 U0 c+ e
- #include <asm/io.h>( S8 T) o, X* l6 P& ~$ l* I
- #include <linux/moduleparam.h># b3 l$ x( K) V2 F# S. e- z+ l3 a( a
- #include <linux/sysctl.h>
8 {7 Y) W$ e: R; n& l* d$ w1 Z - #include <linux/mm.h>8 h: N; \# U; P1 F: [& B) D5 r
- #include <linux/dma-mapping.h>
8 y& k& c6 X% Q* ] - 2 y, `2 }) [: [
- #include <mach/memory.h>) m) U5 k7 K9 T8 Q
- #include <mach/hardware.h>
/ d8 L* t( d! |% B2 G - #include <mach/irqs.h>
6 t+ ^( p/ w+ b& k - #include <asm/hardware/edma.h>
& |: A" s1 x: E; M$ L - + ]1 {1 A+ ^, J. S
- #undef EDMA3_DEBUG
6 Q( |+ X7 [& y; m0 b$ E - /*#define EDMA3_DEBUG*/, H" m, o/ y o: n1 n6 k4 l: O$ a
- , o+ }$ g6 e* o0 O* u8 G
- #ifdef EDMA3_DEBUG
: {% p7 `) ]' \ W# W$ z) k5 r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 @, }8 Z/ W$ j* y5 E9 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" `% p) |1 N+ \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! ]# g6 d) `7 l% X1 r
- #else
. [; h, y) Y4 u( T) }! V - #define DMA_PRINTK( x... )
7 w4 }. o( O' W. M2 H - #define DMA_FN_IN
- N1 S- r2 N$ d- n. Z+ Y - #define DMA_FN_OUT
4 K$ ?8 e+ J% l+ A1 \8 v4 z% L - #endif
& z4 |6 n' r- m1 d' q7 Q - 9 x; J; a2 N5 @. O& |1 m1 q* f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& J( h: h* z3 I1 s - #define STATIC_SHIFT 3: q L3 [4 b0 E1 k! v! h
- #define TCINTEN_SHIFT 20
$ N: p7 X0 Y7 I1 `! z - #define ITCINTEN_SHIFT 218 G( K% N7 i$ [! B; [. t1 Y$ v5 p
- #define TCCHEN_SHIFT 22/ S1 i. D: m+ d* _" j' S+ q: ^& |
- #define ITCCHEN_SHIFT 23% c. O7 b) ?: r' D% p7 x, L& j
5 S4 @9 m; Y/ [/ L4 Y- static volatile int irqraised1 = 0;8 ?. A4 @& i) }0 T/ h
- static volatile int irqraised2 = 0;
' a0 W3 p; P8 Z' l2 p3 o [& V - 0 ~ `# b; [2 G7 P4 y+ S# H5 z v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 _ `$ {- k$ L2 N) U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# u) X% Z' p9 @$ Z. e4 Y. U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ~/ E$ Y( [6 r: z3 X! |% G - , O' x2 B' a T2 B6 D9 y
- dma_addr_t dmaphyssrc1 = 0;# e6 h1 A {2 \
- dma_addr_t dmaphyssrc2 = 0;7 s, [: M. q5 E s8 Y3 }
- dma_addr_t dmaphysdest1 = 0;
, E* \) i% l( Y+ k, W: B - dma_addr_t dmaphysdest2 = 0;( f2 L C0 s# y. H( w" W
1 s5 p1 t5 U/ m |6 d- char *dmabufsrc1 = NULL;
( R Z) R( @7 O0 J$ a4 Y - char *dmabufsrc2 = NULL;
8 h( Q; e2 s0 u& Q) s - char *dmabufdest1 = NULL;6 y5 l `9 g/ Y3 @, [) Q/ A; m
- char *dmabufdest2 = NULL;
% P% @2 _) q$ ?' ] - 0 S; O* T2 ^$ b
- static int acnt = 512;' z% ^/ `( t- \ T3 B- _
- static int bcnt = 8;- E5 A% H, Y. J9 T p( \
- static int ccnt = 8;& k" C8 X. B) X( h* q
- 2 C3 O2 I# Z. P
- module_param(acnt, int, S_IRUGO);# |; {* _! O. e5 r
- module_param(bcnt, int, S_IRUGO);
: ]* G* j8 L+ e% ^ - module_param(ccnt, int, S_IRUGO);
复制代码
+ p% `! M3 \, i. C; w! B+ }9 X) i+ B9 h/ a* P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) f& F* z% L2 p- |# B/ @: a w- ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( w3 I! V. s& m; m9 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 v+ S6 m& z( ~- `8 \
* u, ?- H6 k0 E1 \) ]( q$ {4 [6 I: T& h' S# q1 ]
|
|