|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ~! u7 Y: L+ t4 ^* W2 [, b2 T0 N- [code]EDMA sample test application [: {. _( F y# N! M
- /*5 C* c0 g6 ? L! U
- * edma_test.c. b0 { e; c- u1 p
- *
; x9 C5 @6 @* W( N" |. o6 K - * brief EDMA3 Test Application
# s, W" S5 o0 @" Y9 C - *
9 f% u7 _3 p' h; g - * This file contains EDMA3 Test code.! p2 ]& e/ U! y7 {) O
- *, A2 u2 G g2 A I, B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" z" Y- |/ u. I V8 C' ^8 O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- |) p# g% U8 V6 t
- * TO CHANGE., a3 R3 [. c, f9 q. \3 {
- *
1 M- \ `* E' H+ g4 j/ {$ n( b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, G' y. b# b! Z$ l
- *
4 c2 }8 Z- c ^# r( P+ L - * This program is free software; you can redistribute it and/or* H& ~0 Q' [: t. d/ j5 g
- * modify it under the terms of the GNU General Public License as
* g9 z: G3 n/ b( t5 ^4 J - * published by the Free Software Foundation version 2.
' ?0 A1 _& U+ S( r$ I! p - *
6 F+ g) @3 s- w1 q: K' F" [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" o2 f1 W! ?; C( Z) n: V - * kind, whether express or implied; without even the implied warranty
. s6 V$ X C4 m/ n+ @, p% _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! G" B( ]: n/ H
- * GNU General Public License for more details., G% {" y9 J* ]5 X" }6 p. X
- */0 m( [ R4 _& Z
- % D2 ? A7 f: S% M3 @
- #include <linux/module.h>: i5 A9 r; m3 O1 O. l1 j
- #include <linux/init.h>
( \+ q6 d$ g. W/ s+ D - #include <linux/errno.h>
, O' r9 M- d1 E* k- q" U$ j - #include <linux/types.h>9 D0 D8 M4 ` ?$ m
- #include <linux/interrupt.h>
$ [9 A, [# B8 O* s: @ - #include <asm/io.h>
7 d3 `- ^; O! g; {4 C B B - #include <linux/moduleparam.h>
$ L. V3 B, `7 X0 |; O$ _ - #include <linux/sysctl.h>- E' J/ X2 g% I6 `" ?
- #include <linux/mm.h>
* c. @3 V8 Q( D# \9 p3 \4 Z - #include <linux/dma-mapping.h>
, L6 [: a. r" E+ d9 A. a - , G2 \, L4 ?1 M$ B0 V: }- b& H& ?
- #include <mach/memory.h>
* @9 H! M# _- _) Q6 E, i* s( _ - #include <mach/hardware.h>
5 E. ?, ^/ X8 M0 p1 J3 ` - #include <mach/irqs.h>
3 J) L1 c9 }' W* n9 |% W - #include <asm/hardware/edma.h>9 c8 d( |: G8 j; W9 f
- ; [ q* b) i) d3 |8 R( e. a0 j
- #undef EDMA3_DEBUG: `5 R) g4 U& k3 w" _4 c
- /*#define EDMA3_DEBUG*/
4 U, I. z/ h0 G - 9 X* h3 D$ Y2 ?) P3 e _3 T
- #ifdef EDMA3_DEBUG
* f8 ^3 s. J* A9 Z# g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- @$ H) [" ]' K4 F% o6 K: ~2 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 b. h( R3 c4 r! m/ s% j4 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 P1 |1 I. Z; M. n* |& \( D
- #else
5 [0 E9 g! U% i6 I4 m+ ~" H9 c, } - #define DMA_PRINTK( x... )# M& Y9 j* A- v6 ?; U
- #define DMA_FN_IN; m8 p6 V+ C0 ?: }* k1 U9 y9 _% a
- #define DMA_FN_OUT2 C8 L7 S U* o, U" L5 @
- #endif
" }$ z* Z+ m+ R7 P. _
" r) n+ U1 V3 a9 v5 ~7 B- m5 U/ Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 _6 L. R1 ?& \) P ~' y# x4 l
- #define STATIC_SHIFT 39 H1 v. q" k, y/ T
- #define TCINTEN_SHIFT 208 }0 y; q7 V. X
- #define ITCINTEN_SHIFT 210 a+ \5 b$ R- S4 K
- #define TCCHEN_SHIFT 22! p% V) ?$ h8 {5 ~9 _( |, W
- #define ITCCHEN_SHIFT 23& r, M+ N b& ^) R5 ^2 ~; x* p
6 _, L" o+ K; W0 A7 J) y% |- static volatile int irqraised1 = 0;# y% p) F' s# B% O2 f; r; v- |
- static volatile int irqraised2 = 0;6 }- y7 i: x9 v& P8 s
- u& i1 G& m* a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' v2 [; E6 X; K4 p, D5 E# s& N5 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- a: V& {+ n8 y& x. X! ]( d8 V) { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Z$ S8 r# Z; D7 g+ l; c- h! t
: i& V8 F: B5 o+ X( h- dma_addr_t dmaphyssrc1 = 0;
: b0 Z! J2 r; r3 ^3 z# k" o' a - dma_addr_t dmaphyssrc2 = 0;' Q1 q8 ]+ C0 C3 G( a9 z
- dma_addr_t dmaphysdest1 = 0;; Q( w1 I7 i3 }1 u& A/ o
- dma_addr_t dmaphysdest2 = 0;
. L$ D$ F/ G$ w! j' m- ^* h) c
; O0 b% I" ^8 j$ y- char *dmabufsrc1 = NULL;& z9 G$ o+ [ N) r) Q
- char *dmabufsrc2 = NULL;! l( c" d) `5 G, h) U: ?
- char *dmabufdest1 = NULL;( u. M4 N9 s. d2 n
- char *dmabufdest2 = NULL;) d5 ] C ^ E) T! D5 R
- 1 C' ?' _, W/ C' C
- static int acnt = 512;
; Z8 H0 M" u9 T3 H4 F3 b# u - static int bcnt = 8;
4 E( h6 @* J, ` - static int ccnt = 8;: l6 v' X+ b+ `
- : f: _2 @$ A) R" A
- module_param(acnt, int, S_IRUGO);3 F! b! G* R: m8 z0 J4 d2 \
- module_param(bcnt, int, S_IRUGO);
$ k6 ^- B: F/ g: j* f! c: i - module_param(ccnt, int, S_IRUGO);
复制代码 0 G' F0 w" J1 R4 p
/ \" p( S/ m0 k, S/ T( L% U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 T9 w6 N; W( c1 }+ X9 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" V' V# @8 {7 Q! t Z: S: y6 V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& x# f- Q7 Y0 F. ]1 o% {6 `# v) v* v, A# `. M# K1 v/ o
8 b0 s) ~) x7 z# A |
|