|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! W, e+ I( p% t
- [code]EDMA sample test application
' v- ?% [ \7 Q6 H( y* h - /*7 v! S/ c' S6 M4 o4 [& o
- * edma_test.c7 q4 l% i' U6 y1 L3 F7 |- i! y
- *
, S0 W# t. C0 I4 e - * brief EDMA3 Test Application
. u6 H( ~' h, {! A1 I - *
1 s2 ?+ T/ O8 s5 p1 @* r+ }; ` - * This file contains EDMA3 Test code.5 o1 T0 j4 _" u: V/ @: }/ p
- *
7 w: O t1 ~( l+ G/ u3 I$ ]! h- O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, U& d* y! V$ A0 [4 S$ t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ F3 X; \7 G( C - * TO CHANGE.
; Z7 Q- `7 M w4 Q - *
( y3 z5 |: J) Z0 i, X5 J( x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 X+ D9 o4 k8 d
- *# k4 x/ y6 q) M( h% e. B3 S
- * This program is free software; you can redistribute it and/or
1 B3 q, B1 y5 h( K/ b# X - * modify it under the terms of the GNU General Public License as
; O6 p t+ S3 c- h& d- w( L - * published by the Free Software Foundation version 2.
/ x3 n. z4 n9 p/ y6 O# U0 j7 k1 t% e - *( X' L, L. Z, |2 ?4 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( v/ y3 |' t6 l& r& `# m" H
- * kind, whether express or implied; without even the implied warranty
; M) B" q" }4 n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 ?/ j2 ]; c: S1 k% q; b) U W$ Z - * GNU General Public License for more details.1 p7 b$ z; E7 d8 D; j5 h3 D9 Y
- */
4 M) f: ]6 T6 N - H8 A" V+ k, i5 U4 ]; H
- #include <linux/module.h>+ b3 [! @# w3 {
- #include <linux/init.h>- ]. J! K/ m2 q6 i d3 S. G
- #include <linux/errno.h>. L1 O! C/ I4 r4 ?, g* b
- #include <linux/types.h>
. Z2 q8 {. _5 p, U - #include <linux/interrupt.h>+ I+ Y8 l# z/ G9 [6 I: X
- #include <asm/io.h>
2 w% _- h. d- B6 a7 b. Z- X: ?3 r" Z - #include <linux/moduleparam.h>
- S( u! }9 a, s. E - #include <linux/sysctl.h>
# f* {5 h* y/ r d0 w1 } - #include <linux/mm.h>
! l' \5 J; w& X% Q' v - #include <linux/dma-mapping.h>2 s2 M4 ~$ q3 t$ C+ K: l: l
! g( b- c1 g) v/ P% d4 i- #include <mach/memory.h>- Z8 c6 M" A4 E' W: A
- #include <mach/hardware.h>
6 g$ \& O% L8 X$ U - #include <mach/irqs.h>
; B/ c, Q7 b+ ?7 L: k - #include <asm/hardware/edma.h>
. U- h3 v- g/ X& i7 X( ]: ^
: j$ b' k' x' A$ t, l- #undef EDMA3_DEBUG7 Z+ \9 v# I# x; V0 v$ @5 q, [
- /*#define EDMA3_DEBUG*/; |4 ?$ @2 e. o- M1 x
- 5 e0 _3 v- G0 }6 t$ O9 f% T6 R
- #ifdef EDMA3_DEBUG
5 V+ p( f! R/ l6 d$ D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) {, A$ c. H4 Y! D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 |: [2 a; K7 e( }4 r* Q0 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ M) c: z, X8 y
- #else1 J1 w1 h1 p! u
- #define DMA_PRINTK( x... )
: W, x# s: |, ]# Q @2 y1 v - #define DMA_FN_IN9 |0 P; N! a! ~) B `8 n, ^
- #define DMA_FN_OUT! g6 N6 @: f: q3 c$ ^# E3 `8 y
- #endif3 q7 \2 s0 C4 {* H
& X; A( t' e h6 G; r5 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" h! a( b4 {0 y4 g5 u& M
- #define STATIC_SHIFT 3
4 _+ u; {, P5 c3 r6 E9 K - #define TCINTEN_SHIFT 20$ r! a2 u' P1 W' M3 m2 N) _, z, I
- #define ITCINTEN_SHIFT 21
* _8 G" p1 l: N, E" J3 M - #define TCCHEN_SHIFT 22' Y9 G; s% _+ i" i+ p/ t& G& M0 |. }
- #define ITCCHEN_SHIFT 23
1 G3 }+ u0 ]* J3 N) w3 _ - $ }3 N/ a; B: {
- static volatile int irqraised1 = 0;
, G* i( s: B, g' {* [6 ?3 J. I: [ - static volatile int irqraised2 = 0;
; E+ _. u" f3 g9 |, f+ G* S - & E' R* O- b0 @% s1 e) i/ w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) v5 I! M- I1 ^+ D. k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) O8 i; ?5 V& N, A) U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' n( b+ R6 w/ ` - & m! N' q7 ~. Y3 _6 p( ^
- dma_addr_t dmaphyssrc1 = 0;* Q, q& d* D. g* @- Q; r" N
- dma_addr_t dmaphyssrc2 = 0;
3 F1 z- x% s7 ~4 u0 H - dma_addr_t dmaphysdest1 = 0;+ o7 W$ c! u- n5 f/ _
- dma_addr_t dmaphysdest2 = 0;3 w# K" X' D5 ~. \. s: `
- 2 b9 x+ B+ f8 ?5 t0 _
- char *dmabufsrc1 = NULL;2 _5 V1 J7 }' q2 h; @/ y* ~
- char *dmabufsrc2 = NULL;
& ?' m0 Q7 g6 P) i$ H - char *dmabufdest1 = NULL;! T% m1 l5 U* y2 z2 p' Z
- char *dmabufdest2 = NULL;
+ a" ~0 t/ H# @/ z1 U
. s6 F4 a m" Q5 p- L, m- static int acnt = 512;
# t1 C- U* m, p' G/ u, W' B - static int bcnt = 8;
6 r7 E" g h0 ?$ B7 b - static int ccnt = 8;1 b, O4 o: L; `& o
3 I4 U+ H( |; L& F5 V5 v! W- module_param(acnt, int, S_IRUGO);- s" I' p7 [3 @; h
- module_param(bcnt, int, S_IRUGO);
8 K$ E# K: P+ I1 }5 }5 o) K - module_param(ccnt, int, S_IRUGO);
复制代码
- L2 G. e( i7 x; a: B6 \$ J7 d5 H; {* x* H% N1 w# V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- I- B, R+ k& u6 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% u E9 O- G% s0 }/ t' F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 i* `/ f1 B8 s* G* r$ l' ]: l
; R, j" h3 C5 `9 V' \
4 ]" I* s) ]5 j x) f6 A% R& C |
|