|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' Z+ G; N' t9 B1 f! |0 m4 J
- [code]EDMA sample test application# D! S' }$ l( \ y: j) y
- /*6 a1 W. T- H" H# J7 e& N
- * edma_test.c7 J: G2 ^% M8 A* L" v
- * W/ ^& q1 u/ S/ h6 g! h. P
- * brief EDMA3 Test Application' a' y* y0 [) L: o! B3 ? t
- *) @$ ?9 b' w. y3 p- u
- * This file contains EDMA3 Test code.. O8 y" L, q X
- *: a& H" p9 g* k/ J/ Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 {/ H2 [% Y: f* ^' d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 U, X9 i7 W" A8 N' Z. ]' U - * TO CHANGE.+ e' z1 \* O& l; B2 H- ]: i& z4 ^' Y
- */ N. Y Y# w" l7 M9 W2 ?# |& j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" \4 f% Z7 \# T, r - *, y% g2 u4 I9 r2 x J9 }
- * This program is free software; you can redistribute it and/or
4 }. _4 p7 }1 N8 s( i* e - * modify it under the terms of the GNU General Public License as
+ i8 |% y& y( x7 D' C* k5 Q) R+ N) K - * published by the Free Software Foundation version 2.) f) ~5 `4 o$ k" g$ z' ?7 ?5 P
- *" P. T$ [3 K- W4 r0 X# L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 Q% Y* Y5 _9 ]2 u, P7 t( n - * kind, whether express or implied; without even the implied warranty
- q. {% A5 `) v( \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' w1 c! C( b1 K
- * GNU General Public License for more details.. a% g: Q/ Z: \$ s# F/ f
- */
) j2 s" A8 [" B( s3 T: d' ?3 p4 b - 8 L8 D" E+ H. L& X5 C
- #include <linux/module.h>9 }6 V! V: ?0 m) C( v, @: O f% e
- #include <linux/init.h>
- Q1 K2 W+ @- N. M2 b' Y- | - #include <linux/errno.h>( U2 K' s9 t+ z' {
- #include <linux/types.h>0 l8 |) e9 t1 ^0 j' l, l \5 q% I7 L
- #include <linux/interrupt.h>
" D' p. q3 u9 w0 T. G; J - #include <asm/io.h># D6 n! B0 `! ^0 |
- #include <linux/moduleparam.h>
) G3 F' H5 l, q+ r, c) c* M - #include <linux/sysctl.h>
! h- C7 _$ @4 d( l3 T$ L9 m - #include <linux/mm.h>
! U2 \! _0 U) ~. H; u1 l2 J - #include <linux/dma-mapping.h>
' G$ w$ X6 S& q9 ?& X& J
# f' A* Z5 P3 w/ u& D1 @- #include <mach/memory.h>
% \5 X. A# y6 ?. B" ^ - #include <mach/hardware.h>+ Q# v0 y) ~, a6 G
- #include <mach/irqs.h>
- _" b- r" C' N2 o - #include <asm/hardware/edma.h>
# _/ D' {+ c# h/ g1 J/ [9 { - 2 v4 n$ W c* S
- #undef EDMA3_DEBUG
$ {5 P! i2 @: x. D: s% \ w - /*#define EDMA3_DEBUG*/
$ x$ B. n9 q9 E! S
2 H) l3 D3 b9 o0 ]& e- #ifdef EDMA3_DEBUG
' w5 }* \% Z. B h7 @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 v& }& X% N% x' z. v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 G5 _. v8 I' ]9 D4 l( j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ B0 G+ |# l, k0 E2 n2 d& q- m+ |
- #else% ^! V& P. i' ^2 }9 y4 L: `
- #define DMA_PRINTK( x... )" s# N8 V3 r( @7 X4 \+ f2 u
- #define DMA_FN_IN
% v: m2 ?4 r( T' ? - #define DMA_FN_OUT4 s( k$ X' i8 a* c8 I9 w @* F
- #endif
& f, J2 \1 |7 q' t+ T8 P3 S7 `6 g - ; U3 Z( t" {; l4 R& @! `* |; ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 ]+ C1 `% E! O5 D1 k) \% w# C - #define STATIC_SHIFT 3
2 ~$ y' v- k+ b4 M - #define TCINTEN_SHIFT 200 i7 [3 h) o% j* f! t
- #define ITCINTEN_SHIFT 21
$ a! r J. Q$ v% w0 J& Q# @ - #define TCCHEN_SHIFT 22
# ^ v* L: `% q7 d - #define ITCCHEN_SHIFT 236 g+ E* z2 \7 Q( f
- - l3 W* c A5 z6 ?
- static volatile int irqraised1 = 0;1 p+ s! T2 y8 H9 p4 o
- static volatile int irqraised2 = 0;
# |% ^0 G" [3 [( R! a9 I# c& x
& S+ S- W; o: A* \; X) }& l: R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 }9 ]- q4 ?( i& {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 j e8 b; d* l* Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ R- R/ [) x: D2 I$ i, O
- / B7 h* M; S% B& S, D+ u) i
- dma_addr_t dmaphyssrc1 = 0;) X. r4 e+ n h( e. ]
- dma_addr_t dmaphyssrc2 = 0;4 A% Z5 L+ o6 {
- dma_addr_t dmaphysdest1 = 0;9 A. e V$ T8 ~- C
- dma_addr_t dmaphysdest2 = 0;- A6 M# `5 Y+ f
- ! N4 z1 p/ I% @$ i1 y# j3 Q
- char *dmabufsrc1 = NULL;
$ ^% P% R! T: ^6 g/ e9 L; v - char *dmabufsrc2 = NULL;$ e g+ k! ?" O, G2 M& t$ W& P
- char *dmabufdest1 = NULL;* s4 _$ D, d3 A
- char *dmabufdest2 = NULL;
4 e2 \1 w" h5 M. l5 W1 Q. z - . Y9 E. a( |" m" }3 S
- static int acnt = 512;
9 h" p5 X+ g; t ]; F - static int bcnt = 8;. F* a& e E4 `1 q: d5 W; S
- static int ccnt = 8;% f( S& G$ `( V, C$ |* j8 V2 F
- ! G% M& B5 r s! a9 i- R& j
- module_param(acnt, int, S_IRUGO);- I) X5 O' O2 c0 F/ E
- module_param(bcnt, int, S_IRUGO);4 [' |: e. D J* m# p/ L
- module_param(ccnt, int, S_IRUGO);
复制代码
$ S, q' Z8 L P0 l
; L4 \5 o! }' T% `) _- n% X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 j, L2 O9 B0 F3 q- `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 w8 ?8 D. X9 |* A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 C6 B4 U/ t' n, i, ~ G5 e
& n+ N0 l2 r, g3 b
. ?+ N- ^/ g/ V4 O |
|