|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 v [4 J2 E/ V W4 }, A# i
- [code]EDMA sample test application: l; {- e3 m6 X/ W8 ]& U. D5 g6 T
- /*, ]' b1 @: P4 O7 \1 S
- * edma_test.c
1 G- k/ ^; |0 h. r* Y9 { - * ]2 E! z+ h* a/ Y* Q
- * brief EDMA3 Test Application
3 C- r& P. d$ W0 w - *
9 s8 {! X) O- R3 b - * This file contains EDMA3 Test code.7 o% ]1 Z% R- `! r) F
- *
5 z1 L9 R, N9 G! ?3 S" Q: I! t8 e- J, e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 u, ~4 w! U, }* p3 o9 p) q9 V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ w; Z. P8 S4 f( D, \ - * TO CHANGE.
- s0 g6 V4 J0 `8 M- a" ` - *' ^# H+ v/ S+ a3 P" E* K, d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- D5 S2 Q$ z: G
- *
" k1 \' u; ~( X- s6 a - * This program is free software; you can redistribute it and/or
( p! }1 `5 V* M4 @* W - * modify it under the terms of the GNU General Public License as' m8 p; l- T0 |1 C
- * published by the Free Software Foundation version 2.
) S9 t v) L6 z, f3 @, h) [ - *
0 |' c* a8 s6 K3 J7 S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 k- W( Y4 C1 F$ }3 D0 x
- * kind, whether express or implied; without even the implied warranty- h' f7 d' ]$ h! D6 W7 s1 S x6 p0 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [* T9 T& k6 ?1 a. I! h7 P4 S
- * GNU General Public License for more details.
; ~/ H' a8 A$ T/ V - */
& X- @8 T4 g2 J6 I c) ~8 e - % h1 X) o" [) m7 O* F4 @
- #include <linux/module.h>) J! [5 o: S6 v4 K: y; a: J5 P* q
- #include <linux/init.h>$ K: S. e% m D' }
- #include <linux/errno.h>, V7 T4 Y+ k" \. |" w5 }" X
- #include <linux/types.h>" u/ M. W' q% Q4 z
- #include <linux/interrupt.h>1 g; M/ D5 G9 C' k
- #include <asm/io.h> x" M2 z+ u. G
- #include <linux/moduleparam.h>/ U- U7 c2 v2 h+ D
- #include <linux/sysctl.h>
; H2 \) X2 ^2 k7 I. \! A - #include <linux/mm.h>2 e4 W7 @! c r, j# O
- #include <linux/dma-mapping.h>
& n* w0 B7 r7 \6 @) y9 t
- v# z: Z8 s* f, d( ?- #include <mach/memory.h>
0 J- a* {' W+ K# Z/ e1 p1 m - #include <mach/hardware.h>" a6 y# b) S4 J% N: B2 n
- #include <mach/irqs.h>4 N$ q& U0 M2 W& _3 r
- #include <asm/hardware/edma.h>
' Z, k3 V5 x" C2 M, V$ ^( d0 A* s( Q
- t) n+ ?8 Z2 f0 l# J- #undef EDMA3_DEBUG; B+ W) ? d, Y4 |5 K
- /*#define EDMA3_DEBUG*/
/ j, D* P" Z; Z - , p, h3 V E/ D: Z7 W. t
- #ifdef EDMA3_DEBUG2 F/ R* H" r/ @/ c$ ^! |% a- E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 s, J- ~% Z* G7 ]6 _4 @' h" k4 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& o8 h" s7 ]; @0 _& C7 } d& h* y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 l# l3 ?! I$ T+ R# |9 O
- #else
4 R6 B1 G& t' V- i# G- ~ - #define DMA_PRINTK( x... )$ {( s9 q" | G/ z9 Q$ |- r3 R
- #define DMA_FN_IN( o( e/ C7 ~+ Y
- #define DMA_FN_OUT# B' ]6 u; u& h) U
- #endif
6 Y4 R7 U8 _: K) v3 v$ [# P; a - 4 W" T- K* `7 ]3 g/ R' r; \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ U2 e1 V4 t: N1 i% R( }/ D9 {
- #define STATIC_SHIFT 3
- ^) `: G! z& f7 X7 y& G7 w" \, N - #define TCINTEN_SHIFT 203 L, D. x7 h2 X. E9 K, p
- #define ITCINTEN_SHIFT 21
) b* I& \7 x" a l: C: a - #define TCCHEN_SHIFT 22% n G0 p* t) A4 b
- #define ITCCHEN_SHIFT 23: ]# w4 b- L0 n
- - `/ m0 A( H: E+ i8 b# {4 h! |5 g; B
- static volatile int irqraised1 = 0;
& w& v# |& B% ^5 v) H- D - static volatile int irqraised2 = 0;( A. ?6 g# Q* }% K" I
- , k% z5 w0 r1 O' c8 f) f7 h5 y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 u, j# P$ a+ m- ^: s7 |: ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 l7 ]! _" H7 R* W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 W. q, T, R) B4 m" ~' B - - [5 g0 D" o! ]& a2 J4 d V
- dma_addr_t dmaphyssrc1 = 0;$ S2 l) H( b! [+ d
- dma_addr_t dmaphyssrc2 = 0;0 z& b2 A$ g+ n! r& U0 `6 q
- dma_addr_t dmaphysdest1 = 0;: N: W9 ^% ]( `9 |
- dma_addr_t dmaphysdest2 = 0;6 q4 `9 w- Y' I- V) ]; Y1 w
! B) ^4 m+ o1 ~0 g" K- char *dmabufsrc1 = NULL;2 w# f8 k. F2 L( m/ n% W/ T
- char *dmabufsrc2 = NULL;
, g3 I, q5 _! U2 O: z - char *dmabufdest1 = NULL;4 g( Q- S/ k% w$ n8 K! y
- char *dmabufdest2 = NULL;
" d& I! @, ]' C3 [+ Z - # K% s: ]8 E/ X h( f0 ~* K
- static int acnt = 512;
9 g. e' v+ z6 I7 y! h - static int bcnt = 8;
( {& N/ A% V, `. \1 d8 d - static int ccnt = 8;; K" a" z2 N; J ~# H5 M0 B
# c/ o7 w+ H% r6 R- module_param(acnt, int, S_IRUGO);7 Y% u! r, c7 H; w+ c( S6 t4 Z1 J
- module_param(bcnt, int, S_IRUGO);. L# }+ t3 b1 q. r* x
- module_param(ccnt, int, S_IRUGO);
复制代码
; I6 i* @; D& u
7 p0 e( a3 J) e1 h, ], u; f- R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 u! z0 v2 M$ w5 _* v9 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: Z% }- z D { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 K- i! G. b: G+ ^. `* j1 ? H0 ?
. d4 m+ p2 ?; I$ K6 N2 l5 X1 b. |# p7 C1 B0 |
|
|