|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
i) X1 v8 g4 k# ]/ @0 R; b, I; [- [code]EDMA sample test application
( B/ u. \2 k' Z, h3 U! V - /*, F6 x4 V) L$ q! E; d3 d+ E
- * edma_test.c
- [7 l% P& F9 Y: `5 M: Q - *& J4 v [- M2 ~" v& |% i
- * brief EDMA3 Test Application
2 ^4 N; Z/ k# H/ _: D0 |4 @ - *
( S8 F% a3 \/ a7 P0 \5 |( B0 V& k - * This file contains EDMA3 Test code.
) B" i2 X2 z5 L( P& ~( v' O/ I% G - *
; r; p' E, g5 J7 G; r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& ^- _& [8 g0 d" L2 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 Y3 M, b& d, ?6 Z. W
- * TO CHANGE.
; K# Y$ j; l3 E9 R0 T3 q! f& R/ K6 P - *
! f b' t* \$ Q( R0 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 K- e+ Y8 ` E( i3 R1 a
- *: y, Z8 \3 L5 j! M- m8 l4 N
- * This program is free software; you can redistribute it and/or6 a1 @$ t2 _, @9 w, Z0 L7 r! w
- * modify it under the terms of the GNU General Public License as+ O* V, X9 M Z, \8 l# d
- * published by the Free Software Foundation version 2.
) k: t' k# D# L! {& k - *
$ V( S) z( Y( ^* a ~( r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. F6 }% u/ E+ n' Z4 P
- * kind, whether express or implied; without even the implied warranty) W& n6 B( S8 ?0 C; }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. Q; Z; `! K* S7 o$ j
- * GNU General Public License for more details.0 I& C! t4 M" }7 @
- */7 Y+ q* @9 F/ S9 o
- 2 R8 x+ a& G6 f! l9 f2 q5 v
- #include <linux/module.h>
& k/ Q; M% L C' j) [ - #include <linux/init.h>
% v5 R! P6 E5 r1 v" K - #include <linux/errno.h>
* v2 ?8 ^3 J7 [2 s9 H) X4 P+ |- ?8 N - #include <linux/types.h>1 Q# {' J3 B5 Q, V0 p
- #include <linux/interrupt.h># h4 \7 I8 S t( t) P
- #include <asm/io.h>
0 c4 v- F: {+ U/ q% o# N6 ~/ Z - #include <linux/moduleparam.h>
- N$ l0 T- e. D - #include <linux/sysctl.h>$ X& n1 g' q7 i. I
- #include <linux/mm.h>4 P, f8 J3 {& X2 ^' f- k& i; C
- #include <linux/dma-mapping.h>
" b: y8 i6 H! _5 N5 b/ ~
2 p0 t0 _' n6 K+ l. m7 Q _- #include <mach/memory.h>
( i2 Y5 s5 M. U, x) ~* q" s" s( ] - #include <mach/hardware.h>
# @' ]' p7 O0 E - #include <mach/irqs.h>
$ Y9 p( i3 }. Q- [4 ^( x. O - #include <asm/hardware/edma.h>
4 Y _, [" |2 H, _/ O+ Q" F
2 u& x4 R$ v/ r- #undef EDMA3_DEBUG
2 J; _2 P( o) h; }, i% Q - /*#define EDMA3_DEBUG*/. _* F* f) l. z# @1 S2 {' F. H
- 8 ^6 M1 E+ f5 M1 d6 O- r; V# F
- #ifdef EDMA3_DEBUG5 ]0 h3 g+ O# s, k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) l$ i- A- ~; M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& Q9 d; \0 F% X0 m* L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" @: d* N3 v( t( M6 V! C" Y - #else
+ F) E: e% |6 N+ {4 g0 ?0 b5 t - #define DMA_PRINTK( x... )% D1 O2 p" T. Z5 e2 ?, l; [( U
- #define DMA_FN_IN
' s' }/ A- M) }, I' h - #define DMA_FN_OUT: P. F, Y+ I2 p2 X& s
- #endif
( P$ ? Q; a* _) h& i$ U4 @ - 1 t8 c( {) t7 j& U3 I% P8 J* x( y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 S( }0 t6 Z: j: v1 Q
- #define STATIC_SHIFT 3- B R6 w. S- h" C; ^; {3 G
- #define TCINTEN_SHIFT 20
, S8 M* Y. M4 p% q - #define ITCINTEN_SHIFT 21
6 Z! t- K, J% D. X! h2 ?8 u; ] - #define TCCHEN_SHIFT 22( Q: Q' T# O5 q2 t: I' J) |
- #define ITCCHEN_SHIFT 23! a7 O% D" d9 l. e% l" `
- & ?* t- x' N% C0 A! j7 q
- static volatile int irqraised1 = 0;
' f5 T2 I( }% c - static volatile int irqraised2 = 0;
8 \% Q5 ]0 V n# w/ J) E2 N# Q - ) c R8 k) Y. L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 r- d y, O, ]$ l" A) T6 |* F" U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 u0 J+ U: p; f" E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; O \7 Q4 S+ a7 d4 F
- 3 t c; B5 e q N+ P) H1 O
- dma_addr_t dmaphyssrc1 = 0;
3 Q- P: M; n9 p Q - dma_addr_t dmaphyssrc2 = 0;! b! V- a& m2 r; ]( Z/ u. G
- dma_addr_t dmaphysdest1 = 0;
7 }+ @# _- Q8 X# }. o - dma_addr_t dmaphysdest2 = 0;) F0 ~. ?5 r9 F" R8 c
4 `* `: `. n! ?" C) K- M+ [* ?- char *dmabufsrc1 = NULL;
) L: q( ~! J& q i( K0 Q4 c. e5 C. \ - char *dmabufsrc2 = NULL;
; K# U! B* ^- r/ {9 X - char *dmabufdest1 = NULL;
9 X" p/ q8 g7 D. k: @. l; u - char *dmabufdest2 = NULL;
* `' W; C* {, C, U3 D, _ - 6 k0 v4 X2 N! g$ t8 T
- static int acnt = 512;6 ]! \8 ^3 }5 K; Q; O9 z, h
- static int bcnt = 8;
8 i u4 U$ G, S$ X1 z& `9 X - static int ccnt = 8;
4 U9 m( [9 w" L3 ?: T - & L. O; Q+ m! c* a
- module_param(acnt, int, S_IRUGO);& y3 F( U: E/ A; T8 D2 Q O- I
- module_param(bcnt, int, S_IRUGO);
% z4 ^! L' t. k4 \% a3 e' u - module_param(ccnt, int, S_IRUGO);
复制代码
, l' p) D$ ~5 Y" O+ j) [3 \5 B7 z& T# e+ j$ X: s; L" }! V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 G2 [- c- R; Q- R8 j0 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" u7 b$ v6 I; ~+ k" H2 r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 p. Z/ A+ O' ~2 l) U! o
8 e6 t" h* s( v0 {" Z9 |2 H v4 j9 o. x1 m4 u2 ?3 k! T4 |
|
|