|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
J: f2 m4 H5 I/ C' J" {" j3 q5 s5 K- [code]EDMA sample test application
4 ~1 n0 C" S+ Z) B: N& @$ [ - /*, J0 `' I; L. s! }: y
- * edma_test.c4 J8 ^. J- `; g3 p, F
- *, g- a. j. d+ I. A0 P+ y& |( n+ C
- * brief EDMA3 Test Application1 \! G2 J/ {0 e9 n$ e9 x0 O" F
- *
; O6 O7 A( @. J8 Z6 W( t - * This file contains EDMA3 Test code.
q; l( Z3 J- ^* P u0 t/ u9 l- d - */ n2 Z1 @! F3 i; C* j' L$ e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) y5 D; [6 a! d" Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 A; \. S. Z$ F* l5 p
- * TO CHANGE.3 w7 Z8 H1 u( | ]
- *
( f0 M. k2 \; H O' D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" o$ l% n1 j8 f/ C |* X - *# M5 R u: s$ T# W% _8 t, |
- * This program is free software; you can redistribute it and/or5 M/ b' l# X7 }# Y5 s3 ^ `3 p3 p' J8 b9 G; L
- * modify it under the terms of the GNU General Public License as
6 N( ^! q4 g8 c }0 {) `4 Y - * published by the Free Software Foundation version 2.
, H( e! B" H7 |% b; a x; \ - *. M. w& s ]) y; w, x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 b# x2 i; U4 u - * kind, whether express or implied; without even the implied warranty
0 p; p- Z+ O$ q0 o+ Q( i& O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* y$ T2 J& z3 f: W
- * GNU General Public License for more details.
7 E& [2 x, U( E/ T. ]& w - */
1 o. {) r$ r/ G; K" |3 k
% b$ u1 V) F7 A! h* E- #include <linux/module.h>) K$ Y# v, s& z. d
- #include <linux/init.h>
% |$ \( @9 W# V) Y - #include <linux/errno.h>
. Y, U7 O& k$ P0 o$ ] - #include <linux/types.h>
1 K! A0 ?2 t% R5 \2 B - #include <linux/interrupt.h>
6 D# }4 s/ d& S6 g! q, w+ u% @9 w- J - #include <asm/io.h>
$ P1 @0 j8 s0 p: n4 ?' l$ V' }4 O - #include <linux/moduleparam.h>
+ H/ c- w% \5 }9 ]) `# | - #include <linux/sysctl.h>8 p6 M! i* a$ m- f# B* i
- #include <linux/mm.h>
8 N* G0 f2 b0 q% g5 R" H8 Y - #include <linux/dma-mapping.h># V* w$ X! j5 C Z* u
+ \/ s6 s% l9 y- #include <mach/memory.h>
) {& C/ B: d0 B8 p2 D* d - #include <mach/hardware.h>
8 I' |: e) D; M7 H - #include <mach/irqs.h>4 T* C) c( A) X. m9 N
- #include <asm/hardware/edma.h>
+ @. z! O1 o/ G
4 p2 D5 b/ @3 ?- #undef EDMA3_DEBUG4 n1 H p7 `4 j9 t
- /*#define EDMA3_DEBUG*/
$ j r1 z+ H* q* _
; M8 B- T' m3 |) r- #ifdef EDMA3_DEBUG: S6 O) r' q) p0 H1 m9 q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) L. w6 Q9 d# z4 ^# ^( d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( U% t* [: [: ~" V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% |2 d" ], J4 n) S - #else# b/ m4 V! R* X* R0 y# T! V, i3 x
- #define DMA_PRINTK( x... )
& Y5 J x( @$ T; Y - #define DMA_FN_IN; J9 L z( |1 t f
- #define DMA_FN_OUT7 B* i+ F ^2 f
- #endif
3 [- K2 O4 w* v! r2 _' H" u2 i; S! F
2 }5 I3 U q8 a/ i7 i! n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 n2 e9 A, H1 B9 L* F9 R& H
- #define STATIC_SHIFT 3
0 p' }- U4 q) v6 q1 V$ f - #define TCINTEN_SHIFT 20+ | T4 j+ N5 V) O% P- C. F! s
- #define ITCINTEN_SHIFT 21' D* `5 t9 h4 f+ v# @
- #define TCCHEN_SHIFT 22
7 ~$ {+ i- q- L5 a5 z - #define ITCCHEN_SHIFT 23
, Y( F; r3 m+ o! ~
4 a5 u6 Y8 k9 o2 e) b- static volatile int irqraised1 = 0;
5 C% z. }& ~. K+ B5 N - static volatile int irqraised2 = 0;
. ]* W, p; t5 I: F. | - * j* s! u7 z T( {. E; C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! g' ?9 S3 o- P L$ W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# @8 X9 j- d O$ P0 B& F! f6 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# j5 F8 s$ L; O2 ?, ]
: R8 @" M8 ]% O; w% H- dma_addr_t dmaphyssrc1 = 0;
; C; K4 [) D B( a8 E - dma_addr_t dmaphyssrc2 = 0;
' i4 H; B& f0 o7 Y - dma_addr_t dmaphysdest1 = 0;
/ U: J( w9 |: R( m9 } - dma_addr_t dmaphysdest2 = 0;6 J O6 i3 A3 B% Y! _$ {
! e" _# u. H! s. n! i: {- char *dmabufsrc1 = NULL;
3 n W/ |$ G3 Q, v' ]. T- I - char *dmabufsrc2 = NULL;
6 h; M3 L0 {* S, ^3 ]' j - char *dmabufdest1 = NULL;
9 P' ~- |, I7 ~& T! O - char *dmabufdest2 = NULL;* R- {. R6 b9 J% \' S
6 J( g+ x: v" o- static int acnt = 512;
# w% E ]4 ]6 |% C5 o6 X - static int bcnt = 8;7 s5 c' b6 j: C/ L* \: @) r, }
- static int ccnt = 8;
' W O. U1 {( F d4 ~0 Q1 [
' o7 q5 ^% N9 v0 \- module_param(acnt, int, S_IRUGO);
# g/ Q3 U1 S1 ?7 g! O - module_param(bcnt, int, S_IRUGO);* b( Z5 ~& v2 w
- module_param(ccnt, int, S_IRUGO);
复制代码 , K( ]) S- [) L0 q) w; U0 Z
2 C4 c- K- ]6 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 T7 H ~/ [* j: G& G9 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 ~3 J# |8 A) I0 o: w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 w- G! Z0 ?1 r; B N" t
" E2 O% [) Z4 v& S
1 o/ ~! m( x' x( X: Y& q7 Y# q- E |
|