|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : j/ i- p) I* b2 w( r' r2 K, M, u
- [code]EDMA sample test application( e1 t# B& { M6 U: [8 J
- /*
# n# N3 \1 Q" P" B. F! l - * edma_test.c) ^3 n! _6 s5 P% d% E, S& f# G8 q4 h
- *8 ^) \# T: x8 j
- * brief EDMA3 Test Application
7 E8 C8 {7 E/ |$ ]( U0 {7 U0 ~ - *% w' U3 \: k! t* c% P
- * This file contains EDMA3 Test code.( z( X5 d- e" G! T" F! e( H5 r! a" H
- *
" h- B9 S7 u" `- _0 v' K: [- C& e9 A; b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 I8 \/ u7 c) Z1 ~* O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
o+ q D' P5 x g# V' ~6 S - * TO CHANGE.
9 }' J3 G+ O9 r) i' y/ r% _ - *$ D" f, o4 G* t; X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" Q4 R4 f, x- A - *
2 u; n h- S* @5 F9 i8 u - * This program is free software; you can redistribute it and/or$ i. }4 J9 o9 i) i( H. o- b
- * modify it under the terms of the GNU General Public License as5 ?: C$ n& l$ I
- * published by the Free Software Foundation version 2.
c0 R0 _0 M' a# M0 H5 k - *
' H9 f( a0 o! @) I- `9 I& m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) M5 P6 u1 q" E# u - * kind, whether express or implied; without even the implied warranty
) `+ F- N- i& e9 f/ c" Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, S. ?4 r- Z! J' l2 J5 Z - * GNU General Public License for more details.
; ]8 B/ u$ P" A. V7 n - */
0 H8 i4 Y( ~3 i/ e! D" Y& E - $ e; S6 T6 W' Y1 i/ p
- #include <linux/module.h>/ Q# Z3 ^, v1 z6 ~7 V5 P4 g
- #include <linux/init.h>
- e* {( |) f% j- j3 Y8 g) k* T - #include <linux/errno.h>
( d" R& K7 X0 O( Z, W - #include <linux/types.h>* y) f; {2 q! q6 v3 n
- #include <linux/interrupt.h>
! C9 ^9 k5 _4 j$ n1 b) M0 W0 m0 O - #include <asm/io.h>/ o$ E: R" k! N0 H
- #include <linux/moduleparam.h>; |' ]2 L* h% L% p; [. V' q! o5 T& ^
- #include <linux/sysctl.h>( w( A- A3 |: K1 Y \* [/ @
- #include <linux/mm.h>* m& k E( v1 [. {
- #include <linux/dma-mapping.h>7 q0 d4 W* S6 R9 P- Z' {0 H3 E+ \
- ) ]. K1 i% [) M
- #include <mach/memory.h>- C% F( @: c% v; f; K1 M
- #include <mach/hardware.h>
2 G! Y' \7 K! H" r5 l! ? - #include <mach/irqs.h>
" `5 z+ ?5 `/ u3 r, h - #include <asm/hardware/edma.h>* ~3 L; o a6 N$ L/ x) A/ X+ g
/ l: t0 @) u4 h8 J, Q3 y4 g8 k- #undef EDMA3_DEBUG
* d; m, f6 |) z7 [* K9 l `9 } - /*#define EDMA3_DEBUG*/! ?1 y+ {# d- L
; x" X. F% s. K9 B" J- #ifdef EDMA3_DEBUG' i8 D/ y+ k* ~0 |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 a! A( x( R8 M/ `/ l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ r* S. q) e9 m [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 k3 M# W+ H& w" J( e$ M. P. s
- #else' x- [- n; ]1 p) y7 A
- #define DMA_PRINTK( x... )1 ^; |+ q9 T$ S M9 m
- #define DMA_FN_IN7 f5 ^& `, s9 x" R2 `" h/ ~8 H
- #define DMA_FN_OUT' x: F4 N- }, I8 z ~# ^+ Y
- #endif
9 s8 x; ^4 t+ z$ F - 4 l! S V7 ]' H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' H1 l: `7 A) N9 Q3 V7 B
- #define STATIC_SHIFT 3
. e! E* f2 b0 \1 r) }/ K2 T) A - #define TCINTEN_SHIFT 20
+ a$ l* @5 e3 b: `, \( H9 x5 Y+ ~ - #define ITCINTEN_SHIFT 21
# A' Q+ D5 C5 _6 @ - #define TCCHEN_SHIFT 22( X7 \! u' Y$ h/ T$ |
- #define ITCCHEN_SHIFT 23
, \+ ]0 M! B- y
9 {- O% C' a5 R M- static volatile int irqraised1 = 0;/ @" ^3 x: s8 R7 |% R, u. p+ R
- static volatile int irqraised2 = 0;; q9 s* K- r n+ Y
- 9 D, s2 n2 M7 M8 K% U% V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 n5 M) \6 M8 E9 s' O" I; |' Q4 h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 g0 Y+ ~. T3 n' Q _* b' e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! |' t7 y" N) h' s* ` - 9 ^, y% h$ A- @9 \ N, g
- dma_addr_t dmaphyssrc1 = 0;- V% q2 w6 M+ K7 w
- dma_addr_t dmaphyssrc2 = 0;
0 P5 e# k1 q r( S/ @ - dma_addr_t dmaphysdest1 = 0;
1 v1 |9 L/ K# c- z# q - dma_addr_t dmaphysdest2 = 0; Y" r4 l. |) m+ }5 u8 s" Y9 l
2 i1 J, H8 D( j* _/ s% W! o. m0 U- char *dmabufsrc1 = NULL;5 U4 w p/ p# J6 X
- char *dmabufsrc2 = NULL;, z1 E6 o- z: K% L3 O6 B
- char *dmabufdest1 = NULL;
6 i5 F! a8 r& A6 i - char *dmabufdest2 = NULL;0 d6 o. D& W: Y
- 3 v8 S; Z$ u3 p" f8 G' F
- static int acnt = 512;
9 s) F% j# s( ~) d - static int bcnt = 8;9 q: E- f. }$ |( ^
- static int ccnt = 8;" z4 m* t/ T V4 S
- 8 I' O5 }- g# E5 _
- module_param(acnt, int, S_IRUGO);
# E( K+ g9 s3 y/ t8 O' r+ e; W0 s - module_param(bcnt, int, S_IRUGO);+ C1 d3 I3 ]) X
- module_param(ccnt, int, S_IRUGO);
复制代码
% _! D% T# T5 @, V
5 l& C5 m0 X9 p/ V$ q \9 d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 i$ l3 P! y2 m5 H. H$ T( v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& W+ G7 S& ?. R; G0 H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 g& ^/ t: V9 {0 M) g, B9 ?+ ]6 V& T( }' V3 p
- A" |' Q& |( N8 ]# y% p* ~
|
|