|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 s/ D3 l- R: q8 `- [code]EDMA sample test application$ s9 n* W/ O! V4 h2 ~
- /*
! h1 c% V$ I+ c9 x - * edma_test.c+ K) X8 _0 E5 {' l6 A. b6 S
- *" i+ ]9 f5 f- B+ i9 m; F
- * brief EDMA3 Test Application
% h6 `. Z8 o- |& r& w3 H - *
3 e3 Q3 J: g! J0 v - * This file contains EDMA3 Test code.
$ T9 ~# O2 r! R: G. e! S6 y: R# u% i - *- a- f* n/ L; Q5 J* u& W+ u3 v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" l( t# M" s5 t! s; q. c8 p- q& d" b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 n; b( @0 _9 d- T0 q2 J+ d+ L/ Z
- * TO CHANGE.& }' p* L' p8 U# [& ]
- *
( F$ S& S1 Q* | a( p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* ~, h, ]: \4 F8 G+ N( Z - *
) q. F/ b( s- S - * This program is free software; you can redistribute it and/or
) ~& K# B# Q* y6 L - * modify it under the terms of the GNU General Public License as6 m8 c1 \% {5 b2 u0 p: u/ P
- * published by the Free Software Foundation version 2.
/ @% m, K/ W4 Z- r0 j - *1 M) [, Q- @9 l$ l: Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ P% ], Z/ d2 s0 | - * kind, whether express or implied; without even the implied warranty; a- E$ z2 p: n7 _' d* F' b. }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 N) z+ z( ?+ |6 o( w! N8 ` - * GNU General Public License for more details.! z% r8 w2 o- z) z2 d
- */
( L \' R7 i9 ?, y! a1 C! \
: }( j2 B" O' O' m% o- #include <linux/module.h>0 ~+ I$ A+ ^/ m. y. _: ]3 X1 i* ~/ p
- #include <linux/init.h>
1 r3 |8 J) ~' l1 G* B: i6 }1 J6 ? - #include <linux/errno.h>
; ]% B7 R' a h: M - #include <linux/types.h>
- [$ u3 w" W/ K i- Q5 I - #include <linux/interrupt.h>- e, Y2 |1 W+ F# @$ ^+ r( P
- #include <asm/io.h>' T) q2 a1 Q# c1 ]9 p
- #include <linux/moduleparam.h>" A. W/ F* P3 g" P% ^/ A
- #include <linux/sysctl.h>7 w" u7 S, v+ N- L$ }7 k
- #include <linux/mm.h>6 i: @1 V* @ S2 \
- #include <linux/dma-mapping.h>
# P( f& w: C( \# \ - . P6 z' \5 S9 l8 ?, H% I# q
- #include <mach/memory.h>
* b! j `! z, @3 i* ^' V# j - #include <mach/hardware.h>
7 Z8 A: Z4 J) Z# y/ E - #include <mach/irqs.h>+ m1 j) E2 h# ~/ T" b9 S+ }
- #include <asm/hardware/edma.h>' N0 L1 H- ]6 U1 \6 [! d6 n
# |* ?6 u: q& k9 y7 a; i/ P- #undef EDMA3_DEBUG
6 \1 [: @7 E% m - /*#define EDMA3_DEBUG*/$ c- Y! G7 |! g) z) t* r( C
! [; n) g0 s$ t5 g- #ifdef EDMA3_DEBUG
+ R3 o; E) n. B) U" o3 [9 F, T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- ~/ s0 p! [0 U) t3 f; { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 r; f8 ?( j: \: u- d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- h( ^, k. N2 H p: {+ A9 J7 p - #else
4 H9 a6 t/ {. Z; u - #define DMA_PRINTK( x... ): ~! Y% h" O- o& S4 N" @0 [
- #define DMA_FN_IN5 {5 T7 M/ U; b! h+ f# F: I# u$ D1 ~
- #define DMA_FN_OUT
# h" [6 R$ B/ Q9 V8 l/ ^ - #endif
. Z+ E1 } e! O; h" d' S U/ W
9 _( N+ P" c: y1 s1 M W$ F. W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' M# z" l d4 o+ i6 q2 J
- #define STATIC_SHIFT 3
X& ~$ g6 Z: ?; H$ ?% J - #define TCINTEN_SHIFT 20" O, S2 F/ W- [
- #define ITCINTEN_SHIFT 215 O( @- [" k# d8 S1 r' ^
- #define TCCHEN_SHIFT 22
4 n, O8 O9 A# A$ U& b - #define ITCCHEN_SHIFT 23
' Y/ M! M' F$ A- [ - 1 w& V! Z% `& m) o
- static volatile int irqraised1 = 0;
1 {9 H* |0 y3 b" A$ m5 V - static volatile int irqraised2 = 0;
, j- r8 E' J; [; o$ u - , s5 `" k g! z5 O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( o4 K( L" [/ v$ g q4 C5 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 s' z: x* Q& X3 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! _7 Y) m. K( w - $ j8 U( j7 |$ H# ~- L0 L: r
- dma_addr_t dmaphyssrc1 = 0;" u+ B j6 P6 u* z. K9 a2 t
- dma_addr_t dmaphyssrc2 = 0;
& {- r }8 p6 F# R6 g. @$ ^4 v4 K - dma_addr_t dmaphysdest1 = 0;
+ \7 W2 u1 @) z7 ]8 } I' Q - dma_addr_t dmaphysdest2 = 0;' P9 ]+ D" K$ q* C( D8 u) G
9 x, G, j5 J, u$ q' [/ o8 R! s- char *dmabufsrc1 = NULL;( d, H1 [8 s, j0 H9 U8 j2 Z
- char *dmabufsrc2 = NULL;$ s {+ w+ E$ ?
- char *dmabufdest1 = NULL;/ R0 e- J2 Z* T2 v: n" C( R+ ~
- char *dmabufdest2 = NULL;5 D/ T2 D" B! d2 D7 f4 w$ d
, s; N% O1 r7 S! Q& s7 Q+ X: Y- static int acnt = 512;
" a! [9 i/ A: o! k8 u - static int bcnt = 8;6 ?9 H1 V" N, l4 I; \# G8 x
- static int ccnt = 8;
4 _# @) E, k7 m4 Z2 i2 E
3 @4 x5 [* D6 i+ _- module_param(acnt, int, S_IRUGO);+ p5 M* |6 l& C9 r" y8 B, Z' D
- module_param(bcnt, int, S_IRUGO);& q. F# C0 X# I9 Q' }
- module_param(ccnt, int, S_IRUGO);
复制代码 # j' { z2 ]2 q, s7 I
) W. e+ v3 w# r! V6 j+ X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 h7 _( `: ?9 ~! r4 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 o* M0 {9 w. U j$ t6 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ R2 i1 z3 @6 L/ i8 `2 ]- u5 t) W( b
& ^0 ~6 D+ u% w' Y |
|