|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 _; E- Z" M# ^! a6 u" i( P
- [code]EDMA sample test application
' o- A/ d- J1 k9 e0 i$ Z( o3 u5 N - /*/ _* y* d! I6 a# r
- * edma_test.c
5 H9 {' D% ?) Z3 ^# c6 M7 T1 A - *" S: N1 B) ^9 p; Y7 B- F
- * brief EDMA3 Test Application5 t. M* g6 R( F' H/ e
- */ d8 |- s5 D; L, A* W
- * This file contains EDMA3 Test code.) U1 A. |; z1 u, {4 P; d# h) M
- *
9 x5 k" }# Z. [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 B8 x) i* I/ r* U6 S3 W$ m# L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& k& E, f& ~/ ?" _6 i
- * TO CHANGE.# b* V$ e1 `" l# l9 l/ f; {
- *$ }& }6 B3 m& n, U; I- S* b! g# f. U. U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, h% D ?/ z, {& d1 K' J, T' A" Y
- *& W8 e5 o! C& e2 v$ n! Y
- * This program is free software; you can redistribute it and/or6 @; A1 Z3 a, C* P' P
- * modify it under the terms of the GNU General Public License as1 ?) k+ D# j( ~+ [2 w( c1 b* I
- * published by the Free Software Foundation version 2.
* S7 V" B- L5 C - *: ^, a5 C } `) G- ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any j5 k0 i7 v4 K! H* x! e3 }
- * kind, whether express or implied; without even the implied warranty
( K6 X- g' D: W5 C% K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, h7 [& [9 y+ I' T
- * GNU General Public License for more details.6 s9 o. D: a( B/ q$ f6 a: ]5 I
- */
- M: ~. \* M% q - 4 B& e7 X6 K T3 l1 ]4 c) r0 V, G1 [
- #include <linux/module.h>* R( q; G8 r5 i& |$ U
- #include <linux/init.h>
1 o9 {+ _3 q) u% |# q( b& Z - #include <linux/errno.h>
2 `- M" H! u: B: j - #include <linux/types.h>
! q: {# @% a2 O/ U - #include <linux/interrupt.h>
; t' P0 n3 g! |9 E! B - #include <asm/io.h>
# A9 @) D( q4 v5 i5 |2 c - #include <linux/moduleparam.h>
; [# p A! y3 R& Z& L% _ - #include <linux/sysctl.h>
/ c9 X3 Z7 p2 H+ W5 v - #include <linux/mm.h>6 w+ c' m; A% l% D+ P
- #include <linux/dma-mapping.h>3 p4 N8 Y+ H( k7 J% X, }
- 5 \* \3 \4 |! V7 Y9 B% [
- #include <mach/memory.h>
3 r" C3 v9 s8 I - #include <mach/hardware.h>
/ ?* i. y- P+ ~/ [! R# A7 A - #include <mach/irqs.h>
* x: O0 d; l' D! Q# I - #include <asm/hardware/edma.h>
7 v+ y8 D' M! Q( c: b
- N+ g/ J' z/ ? ?5 D' y- #undef EDMA3_DEBUG
; [/ z% h$ ~; t7 z$ J" _ - /*#define EDMA3_DEBUG*/# _" Y- \/ b2 A- h7 z
- 8 X: U$ Z8 K: V* T4 e+ l; G9 A' J
- #ifdef EDMA3_DEBUG3 Y6 [2 ~. [/ Q9 u* ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 j0 W5 `" n+ \% ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! ?4 f2 `0 X6 x/ U8 V/ y s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ [/ X3 e$ D7 D
- #else
* F* Q3 p- e$ v" c$ g) h - #define DMA_PRINTK( x... )" _( u: g; v/ }, l/ P
- #define DMA_FN_IN
7 E2 e! n+ j! [& L$ y, ^ - #define DMA_FN_OUT, P% ]. V* l, y
- #endif
2 D4 a- i; M4 l& h: ?' ^ - 5 d5 U v' b* |, o- K/ h- Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! }. a2 B* _6 J/ p6 C8 ^ - #define STATIC_SHIFT 3
( O I! O. m, U* K - #define TCINTEN_SHIFT 20
7 G( @% L& h, Z* Z - #define ITCINTEN_SHIFT 21! Z# f/ A% G7 ~2 t
- #define TCCHEN_SHIFT 22' M# u" R, H) Q. g
- #define ITCCHEN_SHIFT 23
! s7 Y( s7 [+ S1 o* ]# q6 R8 J - ( i/ f5 Z" ^% t; o& S
- static volatile int irqraised1 = 0;! t8 A, B5 T2 d/ G1 t% I* c& ^
- static volatile int irqraised2 = 0;
' y1 W7 J9 X+ k6 z7 o3 Q. v. h7 H3 Y - 5 x5 t5 a* I$ g7 o5 |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% f% E" v9 `% i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" _- s. s1 L& ^! f! ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" c8 W8 R/ j# L1 J0 h
- & h' z, {: K- }8 @" _2 @+ B
- dma_addr_t dmaphyssrc1 = 0;, C3 G! I0 d) P$ A2 A
- dma_addr_t dmaphyssrc2 = 0;
% ~+ w$ e6 |! m- N- \! j - dma_addr_t dmaphysdest1 = 0;
3 Q! Q' d. [& L$ s0 a6 R/ n - dma_addr_t dmaphysdest2 = 0;
4 G" I g1 H8 u% |
# P- s* n8 V0 ?7 ]' W- char *dmabufsrc1 = NULL;+ _7 C0 G/ A. l4 w" |
- char *dmabufsrc2 = NULL;# s- G' p: ~& ]! ^
- char *dmabufdest1 = NULL;
1 C/ `1 E4 U/ O - char *dmabufdest2 = NULL;% x! L {" `: k x' k! \9 m
* j; m+ _" T! v7 O6 ^% Z/ ?9 f" A: D- static int acnt = 512;
/ u0 J' n1 N/ C - static int bcnt = 8;+ W( J& ^' t( r/ b8 {
- static int ccnt = 8;9 [" {! B& q* Y8 O5 o
. K- m: y, I8 j- module_param(acnt, int, S_IRUGO);* l# x3 _: [" @* u% q) R$ D
- module_param(bcnt, int, S_IRUGO);
8 U1 O7 g y, B! X( f: Y2 s' y* { - module_param(ccnt, int, S_IRUGO);
复制代码
! V' K& T9 N. m/ I- ^1 r1 d6 K, G; e# o" o( ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 Z( h# u7 w. w) Z. y2 {! h0 m# P' oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; p1 a- K9 @" ?" U! B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& T+ e: N5 B+ @- ?+ J' K6 A9 p0 A% W4 v: I& E6 `. u q
" F5 l0 l8 O- Q ~$ ~ |
|