|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 N: p: f$ o. t, Q0 d" U, u6 w- [code]EDMA sample test application) C$ q3 Z8 A: C0 J& k
- /*: ^0 p% b. ~5 v. L8 N( m7 h: l
- * edma_test.c
W( o+ x: ~6 ^4 x - *
7 Z, ]4 ^% p4 A+ K' [) Q0 L) R - * brief EDMA3 Test Application
7 [# Q0 F/ @6 S+ w - *; J; N- `( z2 x' H: T. r" C) j$ {
- * This file contains EDMA3 Test code.
; n/ h9 ]. e/ `2 n* C - *
' e0 T3 J/ _. @6 o! Q3 n$ A8 l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# b+ o8 J) `' b: |/ ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; p4 D% N9 ^: [- `5 \ - * TO CHANGE.
3 _6 z) J; D" c0 l/ l% g( W - *. V$ A- M+ Z8 |# I# r5 u* A: G8 O4 z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 J* R) k* X' \ - *) y5 B9 v3 P6 o% K! g8 M8 w
- * This program is free software; you can redistribute it and/or
- j' K1 w) b$ p - * modify it under the terms of the GNU General Public License as
6 A$ f! X' v( U. n/ W* g' q - * published by the Free Software Foundation version 2.
- c9 q2 O8 l( _( f - *
1 \/ W. q( e& X; t! E2 g" L: E8 r+ U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 I1 [) r V" ~/ c. v9 N
- * kind, whether express or implied; without even the implied warranty
0 a9 H8 L6 x. r' @; h+ e9 Z$ h1 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 b8 q5 r4 e* w2 p3 Q5 A; H
- * GNU General Public License for more details.
- ]1 r z' F3 ]0 ~) T& s0 [ - */; q1 y% c0 D$ t: h/ ^3 Y: h U
! g5 ]: {9 i9 X) E( [! L- #include <linux/module.h>
2 {3 S4 U/ ?$ E3 d! F0 u+ Z* P$ j - #include <linux/init.h>
+ t/ U( N1 \2 c7 {. s1 g' y" ~! F+ ^+ Q - #include <linux/errno.h>
4 f8 {# p" d: s+ V& O- m - #include <linux/types.h>
3 E# s5 v5 @7 J/ `. J+ ^: Y& c1 I - #include <linux/interrupt.h> ]# ~* M; @: m
- #include <asm/io.h>
, s( g) K+ a% n0 B - #include <linux/moduleparam.h>
8 o+ A; J. |9 k$ n h* c! Q - #include <linux/sysctl.h>
. F# u$ L0 I- ] - #include <linux/mm.h>, i0 W) G, \4 A3 N$ v
- #include <linux/dma-mapping.h>& O$ Z5 U- P* M
- ( }5 h/ f& y. T. g
- #include <mach/memory.h>
& J+ j6 d3 O+ b* [* w - #include <mach/hardware.h>
4 k* v0 e7 D7 S; a - #include <mach/irqs.h>
0 j4 o% @) r; n& B* s2 T - #include <asm/hardware/edma.h>
7 f f r h9 M J3 v
8 m1 W6 R1 f- F2 b8 G; S* t; R- #undef EDMA3_DEBUG& I* I1 A" R& Y7 \- j5 q* _7 z
- /*#define EDMA3_DEBUG*/- h/ B6 k' T. V$ n& ^
- $ d9 r0 \3 V6 m/ J" i' Q
- #ifdef EDMA3_DEBUG
. Y u& ^; o$ _) \; G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. [1 D) ^( s0 z: I) x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; o: p+ J; X. O4 ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. [6 F5 @; d5 C$ x2 j" d5 |- K8 O - #else5 ~- c, p+ p" V' I4 |, Q
- #define DMA_PRINTK( x... )% C8 M! ?2 p; o0 k8 a! Y6 z
- #define DMA_FN_IN
) E: } _% r/ n2 B1 N" ?: i3 w, | - #define DMA_FN_OUT
) I* Z5 I% z8 q. {7 J- v& p - #endif
) _/ F) P$ k1 h9 q9 ~! W/ s. K1 D - / J" A5 e% ~- ~1 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 W" f; i# P, h! |5 }( u - #define STATIC_SHIFT 3
( {" F2 ]4 c/ |; {5 ^6 k% {3 R - #define TCINTEN_SHIFT 20
# h( S8 n: N1 q0 y - #define ITCINTEN_SHIFT 21 M8 }8 v0 p H4 q4 P* O3 T
- #define TCCHEN_SHIFT 22# j2 R% B5 C) c* Z
- #define ITCCHEN_SHIFT 239 v# a2 L; E) p; m: [( O
- / T$ l" g/ U; V9 K; T1 l( j
- static volatile int irqraised1 = 0;
# f; `: U( z# \& E - static volatile int irqraised2 = 0;
% U& i8 ^; G4 ^& I& m" P - % i* `# P& v" i, b+ x, A, c- R/ C! E6 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 w$ L I% }$ s2 C% F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 F Z; V+ E2 ^4 V! w0 \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; g2 I7 I- b/ B8 f6 N N( X/ E$ M
9 b7 a6 n! v; C7 ]6 p# Y6 }& U8 ^! S- dma_addr_t dmaphyssrc1 = 0;
: I7 q$ E. _9 F% H- f {, o - dma_addr_t dmaphyssrc2 = 0;
8 U7 g+ O% ]- [: m& K - dma_addr_t dmaphysdest1 = 0;$ ^4 ^/ v; f% ?( ?' J
- dma_addr_t dmaphysdest2 = 0;
2 ~( j+ w( j8 e% M* D3 T - 5 D3 ~* T8 s: o. r. [
- char *dmabufsrc1 = NULL; F- A2 f7 @0 F l0 a
- char *dmabufsrc2 = NULL;
' X8 m$ x0 q6 s; E7 o. f - char *dmabufdest1 = NULL;5 T4 J% f+ Z% w; k; t4 V: t2 n& K
- char *dmabufdest2 = NULL;. @5 } E3 x2 X8 u( D9 ~$ I
% N3 q8 M+ V9 u$ U- static int acnt = 512;
* J* m8 G' s, }- d$ X1 d4 i - static int bcnt = 8;& b6 w/ ~% b* |0 Q2 K
- static int ccnt = 8;
) S$ C+ B; u5 S. d - - v, I/ X! s' a- n9 [
- module_param(acnt, int, S_IRUGO);
8 C8 H4 l; p4 W- e - module_param(bcnt, int, S_IRUGO);: e- K* }; {4 o8 }( G/ ~' R7 o
- module_param(ccnt, int, S_IRUGO);
复制代码 " N9 G, Q; a; V% X! u
! `4 l( H8 N8 A9 d4 s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% u0 S5 [ R" d- O7 P# z7 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' f7 ?! r8 X b& P' W1 L5 y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 m# S q0 d2 E8 S
/ b# [/ I( u: J, k h0 a c% }8 T+ O/ I) ^' Q& ]+ B# w
|
|