|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
V! g- [) r+ d7 `- [code]EDMA sample test application! y& i- ]$ |2 z3 C2 j
- /*4 A9 N$ \- s7 T" k6 P
- * edma_test.c
. D% B9 _3 x0 ~* _# S! [, W - *3 J, \5 _! `0 Q$ Y
- * brief EDMA3 Test Application
9 s) m/ }' |0 m( d - *# c. C# j6 O, P
- * This file contains EDMA3 Test code.% k9 A7 q4 `' }5 K$ n
- *$ G" l" t4 g( Y w2 f9 q) g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 h( G2 _. v6 k& D' H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" o1 j$ e: ?1 ~" X0 [ - * TO CHANGE.
$ }# v5 q |1 r; e - *; L9 x4 }7 @% ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, U7 K$ B! J" M( z+ W$ N; s4 E8 w( J; G
- *+ G2 w- ]( D# y- [
- * This program is free software; you can redistribute it and/or! ^ M! ]) C7 L4 P9 A6 X' M6 t0 y1 U
- * modify it under the terms of the GNU General Public License as) D" C- Z% ], c6 k, t" K4 D* `
- * published by the Free Software Foundation version 2.
) _9 D+ w/ h) \1 F& [: r' @ - *( |$ |' [7 p, s1 Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% q- N, f8 |* `
- * kind, whether express or implied; without even the implied warranty( G9 I/ Q+ S* z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 d+ ~( a& Y) U% k9 r ^ - * GNU General Public License for more details.1 J& h8 j4 G D5 c! L$ O* f
- */, _, S" Z8 o( F3 _! `0 E# I
- $ y9 {3 I2 ]* E/ j& {
- #include <linux/module.h>$ t, t0 R& q3 d
- #include <linux/init.h>
# o+ z: o. s- k& x. k - #include <linux/errno.h>
% Z1 c# Z6 ~2 `- c& k, l, }! D - #include <linux/types.h>. v# S* i: f. X! j, u& a5 U! R
- #include <linux/interrupt.h>8 p! y# D- @! u
- #include <asm/io.h>5 L/ d1 o2 p4 j9 s
- #include <linux/moduleparam.h>; r" z* ?4 N7 b: T
- #include <linux/sysctl.h>$ H, K7 W+ e$ F- G2 @* q1 U. z ~4 m3 }
- #include <linux/mm.h>
: L, ~- Z8 @$ p1 ^) Q - #include <linux/dma-mapping.h>
" b5 _3 e3 D! _8 I$ i5 G
; ]$ w( n" M$ V9 z" r+ n- x- #include <mach/memory.h>
& x m* U' u, e* R: N, ~- V5 V - #include <mach/hardware.h>: V. R; [2 {# ~
- #include <mach/irqs.h>% |" X! a" F% E+ V, R
- #include <asm/hardware/edma.h>2 v# W& [$ ?& @' P! `2 C! h( Q
- ) Q6 k' `3 C+ p8 c. u4 V( `/ J
- #undef EDMA3_DEBUG! V3 c5 b$ `1 D, d6 K
- /*#define EDMA3_DEBUG*/8 Q! m: |8 ~7 q: X
- 9 j) y, q3 k9 l8 O; @1 b
- #ifdef EDMA3_DEBUG
# s* m( |0 }6 h) G2 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' f$ p& F; M( V6 `% m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 V- C+ T* N" }1 \- |7 N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' ]& M( i3 @7 e9 E. r+ s8 T0 M - #else
: T; w; t1 O- _; {: _- Q- B9 H - #define DMA_PRINTK( x... )2 Z P) g* ^/ D8 f
- #define DMA_FN_IN4 {$ }2 _$ t1 z2 d$ v
- #define DMA_FN_OUT
; d- k) T' Q) s - #endif0 ] S! L B; Z4 k( X5 y
' O" h5 \1 `6 u4 h' N- f/ o- O- #define MAX_DMA_TRANSFER_IN_BYTES (32768). u' O% d# X7 Y% l8 o
- #define STATIC_SHIFT 3& I6 L- k' m" r) v* R) C! C; N& f
- #define TCINTEN_SHIFT 20$ m& C4 w& ~. v" M4 r) W6 N6 ~3 I
- #define ITCINTEN_SHIFT 21
) ]0 _6 F K! r5 V4 x* i - #define TCCHEN_SHIFT 22* T% h' Q* m- E, A# M
- #define ITCCHEN_SHIFT 23) Q+ ~6 }3 y; ?- \
- 4 a4 w$ s9 H {$ |- t
- static volatile int irqraised1 = 0;
: b9 {, @. v" R0 [+ f - static volatile int irqraised2 = 0;' `# x+ j* o, k+ ?7 ?+ ` ^
- : o/ Q7 K& f. f; E6 y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Z+ f' t/ z/ ^. N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 m4 u7 l y' X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- f% d8 B1 ]* t S
( g: J1 \$ d: Q4 F- dma_addr_t dmaphyssrc1 = 0;+ @* s" N# U. U' T
- dma_addr_t dmaphyssrc2 = 0;
; n9 Q( H) Z! X" f& j V. I& F - dma_addr_t dmaphysdest1 = 0;2 [* C. V. g" W5 k! L! z8 l5 [
- dma_addr_t dmaphysdest2 = 0;
& _- d: Q$ Q! P. m7 c% U" I - + `& N2 K+ Z* {; w" x8 V
- char *dmabufsrc1 = NULL;
9 K! q5 Z+ ?( r/ l0 d1 U - char *dmabufsrc2 = NULL;- C) W+ e/ R2 ?; D% M e# h
- char *dmabufdest1 = NULL;) |: S' B/ @$ I. L- f, w t* Z
- char *dmabufdest2 = NULL;# b- H# }2 v) `# I8 S6 d3 c
8 G& P4 H+ r' H- static int acnt = 512;
1 Y. ]9 D5 }4 c2 c; W2 m; R2 s/ X - static int bcnt = 8;
" ~ V7 p3 d( H1 q - static int ccnt = 8;' z, E( a% x) s( A
- ( K6 h8 [9 O1 |7 l8 S
- module_param(acnt, int, S_IRUGO);
& Z( w& X, a) T6 m1 ?. i - module_param(bcnt, int, S_IRUGO);
1 W$ z1 K3 k2 t0 E! L" Q - module_param(ccnt, int, S_IRUGO);
复制代码 0 B% T1 ~( ]- T$ v% a" N
8 }+ m6 Q8 g$ U$ F4 q! t: \7 { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 h! D; ^, H7 L0 F: D, u3 [ B8 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ ~, e9 g: P% v3 P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 F, j Q' X: t; [2 G/ J5 g2 p3 w0 E% _% [9 N$ Q8 M
% }9 N: x9 m. S& p8 }1 ~ |
|