|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 }# [ W0 J+ Y9 ^3 O, l! h- [code]EDMA sample test application& V9 b* l6 Z" Y" D, \
- /*3 e# f; ?' k0 S! o; a
- * edma_test.c( r8 h' D% B+ b6 P- U
- *; b2 h6 N$ _! n. Z
- * brief EDMA3 Test Application+ ^ B: g0 n' h" o+ M( b
- *
; a. R2 Y* T; M) D) C, r1 | - * This file contains EDMA3 Test code.4 Z, n# r6 d* Y
- *. J! E& G, d3 ^! R( g1 H o2 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" O0 o. l1 }3 C) `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ {5 E! k" t4 O& w7 w# G& y - * TO CHANGE.
* ~5 I0 Y# ]2 M- r5 t - *
1 a0 d4 i- M; Y+ F# K6 l1 o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, w8 P6 N: f2 ~
- *
1 e' |5 G) J. d. T/ f' ~7 A7 p6 M - * This program is free software; you can redistribute it and/or! h5 }" y; s& V: |5 ~
- * modify it under the terms of the GNU General Public License as
6 w$ [0 F4 B: {% E$ M/ q( T - * published by the Free Software Foundation version 2.
; V" U" Z8 H/ n3 a. I - *5 M& W7 H+ \" s v$ n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 K1 b5 i* w& `9 ]. a5 V - * kind, whether express or implied; without even the implied warranty1 c) l3 u. a, h+ B/ F- l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 `: K4 A" z3 Q' a - * GNU General Public License for more details.% a, B7 l2 L+ D3 l4 y9 P
- */
0 ^: q. @: u/ F9 A5 M - 1 d6 I9 d# G# p0 K* X/ [8 D
- #include <linux/module.h>
& e2 d' k: @/ s - #include <linux/init.h>
& X: O3 l) P3 y - #include <linux/errno.h>
3 N) O# ]1 Z, |- f3 T - #include <linux/types.h>( [3 d# W8 `+ W2 n' m) ]
- #include <linux/interrupt.h>+ e8 n' ?2 g1 F& k% m: C, w4 Y
- #include <asm/io.h>4 s) c6 P3 H+ L
- #include <linux/moduleparam.h>0 S" N$ P! @/ K8 D4 A3 q9 ]
- #include <linux/sysctl.h>
9 K, z( {9 ? V$ D; G - #include <linux/mm.h>: Z4 d, ~: y; K6 }8 j- O0 p9 o
- #include <linux/dma-mapping.h>. y2 l% }- w8 I, P
- 1 m% S: B3 \. |3 X* I- e6 f
- #include <mach/memory.h>' y7 n. ]* s( s6 f5 I' ]
- #include <mach/hardware.h>0 r7 R4 w, |7 {) w" ]
- #include <mach/irqs.h>
' x& E$ B- L0 C) n8 L* K/ p - #include <asm/hardware/edma.h>! Z; N0 O1 r: M2 O) k! |
- * w$ v' V1 Q# z6 Q
- #undef EDMA3_DEBUG+ q5 u: I0 b2 z8 w
- /*#define EDMA3_DEBUG*/
6 r1 {0 g: h( u8 X% a
# ~3 P) v( r8 f n: v- #ifdef EDMA3_DEBUG- d/ |& S$ t7 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 l5 Z: D) Z8 T* C9 F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 k6 r" ~5 Y/ J* L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* n, X0 O# n$ b8 F' [
- #else+ C" R" V( P8 P& ?* T; ^
- #define DMA_PRINTK( x... )
) q% r% G, M% n: b - #define DMA_FN_IN
4 ^' h' ?! Z( [" I1 ] - #define DMA_FN_OUT: `, Y! t! G# s9 R
- #endif; ^, ?9 Y/ s6 V9 j& ^" g' M% o8 Z
3 g F+ L) W [, V; b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 ^ _; a* z5 x) h- I
- #define STATIC_SHIFT 3
* E c# q. f6 d# R9 S - #define TCINTEN_SHIFT 20
/ c: W; Z0 `9 R# c - #define ITCINTEN_SHIFT 21
@. }" k' ~# c$ Y7 B4 I0 A3 o - #define TCCHEN_SHIFT 22
" |+ B7 M4 M4 @& @1 @6 ` - #define ITCCHEN_SHIFT 23
H' {/ c& h1 t1 m# q: b0 H7 U9 l - - g% b3 [+ M2 O+ Y/ p! [
- static volatile int irqraised1 = 0;: i1 o) \$ C8 y+ Z# B
- static volatile int irqraised2 = 0;
9 k; W9 Y8 y5 r$ m: i/ I, \
7 |: J$ m! J; o) f D2 |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 e* N i5 F% d0 E V& K3 u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 [' d& Y9 L* M1 ] `& b& O- u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- I# `% L2 o$ _5 O Q( F6 [
- + c9 O' p5 R3 `" a
- dma_addr_t dmaphyssrc1 = 0;
( s+ T) e% `' K7 ^+ O - dma_addr_t dmaphyssrc2 = 0;5 b+ w; Q$ Y& ?7 ^& `
- dma_addr_t dmaphysdest1 = 0;
) X2 F! _' @' [5 P) I - dma_addr_t dmaphysdest2 = 0;: U+ a7 J7 J; Q) p
' v) p% j, j; O! m- char *dmabufsrc1 = NULL;* H9 R. n' }9 ]+ X- o
- char *dmabufsrc2 = NULL;% L" Z0 C8 _6 Q3 O/ b% z# }5 Z5 p' H
- char *dmabufdest1 = NULL;- X+ Z, l) X9 E& U1 t$ r1 i
- char *dmabufdest2 = NULL;
: ?* ?( A/ A& A) Q" a
" A7 A" t; W) V, K; j$ T$ V0 D G6 X- static int acnt = 512;: E, m, k& j7 ?" {9 l
- static int bcnt = 8;
9 a, Q m7 i$ b - static int ccnt = 8;8 k$ b8 Z; p" _6 O9 _! R$ \ W) Y5 }
- / r7 r0 t6 y8 u) n) R2 g# h
- module_param(acnt, int, S_IRUGO);
# e ]: R! I3 B" v9 B - module_param(bcnt, int, S_IRUGO);; e6 G* t) a5 J# a: p2 F' H
- module_param(ccnt, int, S_IRUGO);
复制代码
) G6 |3 Z. m2 [. D" R- B4 k( g, _- u4 J; O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 K% `. i0 V' g2 G- [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ m" }! Z: m' ]; y; R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 H7 P/ y$ c3 S2 z K
9 |. \, `7 O! \/ S+ J2 O, m8 N9 k& G: C- v7 ~, [1 o
|
|