|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ g) c! x8 r- h; `
- [code]EDMA sample test application, \2 k; s2 V I, N0 M! k. A. }
- /*
& C1 L0 z( z3 K. L4 P - * edma_test.c
, h/ E+ z9 L3 A0 q) p9 t - *
7 Q* ]4 T/ c) r& [+ i7 N T4 x, } - * brief EDMA3 Test Application8 X" {% r, Z7 ?' j6 z. y
- *, A3 Y: Q# w! r; L
- * This file contains EDMA3 Test code.( x) f7 b3 E/ u9 M7 Q8 H) p- ~
- *
+ Y$ x2 q8 s0 g$ y6 S- t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ h6 p/ L# v8 ~# ^) N- W( s. l! ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) t2 y& \( @1 r. @ - * TO CHANGE.
2 p, p) I( L9 Z. O H - *3 f c/ y) C3 m S( ?, L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: S, V3 x5 D* q/ { - *) {1 H, O' W0 \9 X" E
- * This program is free software; you can redistribute it and/or7 {+ u6 G4 @, U$ V: N P
- * modify it under the terms of the GNU General Public License as
. W% S) F5 W8 L - * published by the Free Software Foundation version 2.
9 n7 n% P Z- ?5 d! H G/ c - *
; W! S# ? I$ C0 o5 w2 N0 I- Y1 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 r) z6 s' L/ M) E2 D. k0 R6 m - * kind, whether express or implied; without even the implied warranty
% J6 L. }* \8 l& F/ _) A# r, k- [% J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: U: ?, R, q* K
- * GNU General Public License for more details.
4 b/ z/ K! y- N* t: Q$ V - */ u3 \( q) Z9 `7 M l) x
- . R3 y1 M8 l, n' u
- #include <linux/module.h>5 D5 N, S/ ~) @' `
- #include <linux/init.h>* b$ G; a2 C8 ^1 P8 l
- #include <linux/errno.h>4 _% c# S# M9 ~* n9 l
- #include <linux/types.h>
1 P5 z, s, t! @ - #include <linux/interrupt.h>, `8 K# h1 L2 z: R
- #include <asm/io.h>
) E6 p d8 e, ^1 U# ?( [) E m; J - #include <linux/moduleparam.h>- J5 }6 C n# L D6 w) t8 o
- #include <linux/sysctl.h>
. G n9 @: `0 z( b% E& { - #include <linux/mm.h>5 {3 E* J/ Z* Y
- #include <linux/dma-mapping.h>
' h0 V% { R" Y. R' z5 ` - L+ ` l/ F0 M' {8 E6 h2 ?' I
- #include <mach/memory.h>* P5 d( [% c O& r
- #include <mach/hardware.h>& v4 F$ e& J+ f8 L% G1 @8 w
- #include <mach/irqs.h>: A$ Z- P- w( a3 P! A
- #include <asm/hardware/edma.h>8 m+ ?) F) y8 V% |* p J
- - ]* y3 e8 }1 s. v2 X- m
- #undef EDMA3_DEBUG
* B5 \3 m5 s( V - /*#define EDMA3_DEBUG*/
+ `$ Z/ K5 w! k/ {2 w; z. Y0 u
: G. L+ O% Y- C/ S9 ?- #ifdef EDMA3_DEBUG
- }% \: ]7 t" e" `9 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 c' O" J2 C2 s; W) B# i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 x0 X) M& C5 `* I, p5 k3 U% x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 E. w3 {) l. u, o, W0 x6 G
- #else
; w( w% }$ c4 [4 k: m! \ - #define DMA_PRINTK( x... )
* Z( t$ ?) D8 {/ \ z - #define DMA_FN_IN
, d6 r9 u4 O" w4 n, H8 ]. P, ?0 h1 c - #define DMA_FN_OUT
5 d5 ^* N1 V- x0 @8 x! {* x! J8 k - #endif
+ |( y: ^7 ^/ F/ f! ]: A8 H( Z
I" X) c9 k) R7 r0 u5 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# F* s$ _1 l& S# K
- #define STATIC_SHIFT 3
) Y8 F; N5 U% v1 @ - #define TCINTEN_SHIFT 20
: f# e% a3 S. J- j: F$ b+ C - #define ITCINTEN_SHIFT 21) D3 H I. Q" g- C+ h8 q( @
- #define TCCHEN_SHIFT 22( K- j) ]6 m: b% }8 y1 u
- #define ITCCHEN_SHIFT 23
! k; p9 Z" d; v1 K
/ `. [' E/ Z; e% N, s+ j- static volatile int irqraised1 = 0;7 O: o& l. W" u1 |5 t1 j3 ?2 k
- static volatile int irqraised2 = 0;
) ^/ D0 U! u9 u7 ~4 W/ f
" H4 }0 t/ J, L; v) B0 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; X1 G9 K. ]/ G; C$ F9 h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ^. h2 i+ d0 d4 u* v7 ~% E+ ^+ ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 x) }8 T7 ?9 j5 o8 K - 9 o) m/ K) b, k# Q$ ^! s
- dma_addr_t dmaphyssrc1 = 0;
( ^) i9 M7 B6 }5 ] - dma_addr_t dmaphyssrc2 = 0;
4 k* t1 X! h( C# e7 x0 o - dma_addr_t dmaphysdest1 = 0;6 L* {# @/ G* j- _( J& z* U
- dma_addr_t dmaphysdest2 = 0;
* o9 {# [0 S0 L$ H" K% J4 \
+ Z+ U6 U$ D8 u* R( T7 ]9 K0 U, x7 M- char *dmabufsrc1 = NULL;
/ I3 W, ]0 y, r - char *dmabufsrc2 = NULL;
2 O8 g# n! {; S; |1 e - char *dmabufdest1 = NULL;
5 W) ^! o' ^7 K) u \1 a( S- b - char *dmabufdest2 = NULL;& g% ? Z9 v$ c) i
- ( d! C5 \- c+ T
- static int acnt = 512;: t6 U" o1 m% D4 d) ] c' d
- static int bcnt = 8;
' z9 [$ j) i6 A5 p* j2 r - static int ccnt = 8;+ m2 s6 k. K; `& n9 c) k+ l" o
- ?# g) L7 O$ a7 {* R3 x- g
- module_param(acnt, int, S_IRUGO);6 {7 F+ G4 h, N ?. r0 R J% M
- module_param(bcnt, int, S_IRUGO);/ ^$ w# q8 |4 D7 c
- module_param(ccnt, int, S_IRUGO);
复制代码
: B4 [5 I* i( j/ N
3 `& N4 k- X0 h, _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- A+ ^' t$ R: k2 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: A2 b) ?4 x, A8 E* x+ d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ]. h/ v2 m4 } O m
) @; ~6 X" w) I: i
/ S) H/ C# f/ Z) b+ | |
|