|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 h5 O3 J! w3 Y
- [code]EDMA sample test application
_9 _1 b( H+ e - /*
- e2 A: [9 I% m- Y. S - * edma_test.c8 G% } |: C" |6 N2 x' n" x9 ^
- *! ?4 ^, |- p- G5 }' V" ?$ _3 d
- * brief EDMA3 Test Application
, ^8 f8 z5 K% K! d, O& | - *
/ o0 M/ I# D. ~2 V; t. S - * This file contains EDMA3 Test code.
! L* c* Z" ~. J& d4 G6 u' ?3 T - *
1 l/ K: X7 X6 M& S6 f: q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 y) A! r0 J9 T, ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 J2 ?" n" Y5 g: _/ N - * TO CHANGE.
) h6 u% x p0 L2 e - *( B6 [2 b& n9 e% i, A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 s* O2 s2 S- x: i! `; B
- */ S9 g$ A: V# C+ [* G2 g
- * This program is free software; you can redistribute it and/or2 o. g3 L! N! O
- * modify it under the terms of the GNU General Public License as# r9 V4 b0 R2 _0 S( ~
- * published by the Free Software Foundation version 2.) x" Y1 u$ ]. L- P! r' @, z: s& `
- *
( k: i2 n2 _; A [% }5 d x% ~- U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- i% ]3 U- r# A - * kind, whether express or implied; without even the implied warranty2 i* S0 c/ Z7 i+ y/ H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. o( L* U: F/ _5 ~! M$ H - * GNU General Public License for more details.# e3 ^% T+ w- D0 H9 K2 b2 v, A& z
- */" U# o' P: v0 _; v' r$ {4 W
9 Y3 J$ t' A2 Q& v- k" `6 C! ~/ k* P/ S- #include <linux/module.h>' ~: m& w. t) N5 A5 m. n
- #include <linux/init.h>8 h# p) t' W; y$ Q8 A J6 ?
- #include <linux/errno.h>8 K( L4 m- Q1 }4 L, [4 b
- #include <linux/types.h>
% A) @ x, g% W7 b1 x: y3 e - #include <linux/interrupt.h>0 d3 x! m* i7 g" ~
- #include <asm/io.h>+ I2 r \; T0 g+ v
- #include <linux/moduleparam.h>
, f) c2 V* k6 ], K; S - #include <linux/sysctl.h>
4 o$ l* r. e) U. Y: i# W1 q( H1 b- c - #include <linux/mm.h>* E) B" u1 t& x- p% @0 t. n
- #include <linux/dma-mapping.h>
6 w5 Y/ Y* v) C( ?5 e/ [; {; Z0 K
3 y. C' L, ^0 v' p* ]9 v! \- #include <mach/memory.h>* f' {) `3 |$ u2 g
- #include <mach/hardware.h>
7 L q, Z+ O: h6 }, j - #include <mach/irqs.h>! U* E c- |3 M: D# j
- #include <asm/hardware/edma.h>) C/ M5 |7 @3 q6 N! d
6 U) {: r0 O, m1 ^- #undef EDMA3_DEBUG
0 E7 _ b. L. j% [& K - /*#define EDMA3_DEBUG*/
1 j9 _+ K* }3 ?+ t2 i; M - I) f/ J8 j. v0 C1 k
- #ifdef EDMA3_DEBUG
" v a3 L8 F7 M' S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 _) x, o, h) w& p9 }0 T! @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 g- k4 |4 Y! [3 Z$ q! N* j' ~+ d% D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( v1 c4 {) `' z8 V# S9 r
- #else% U: W" [8 b* \3 M
- #define DMA_PRINTK( x... )
1 q: t" v! A4 p4 A2 M: x+ e - #define DMA_FN_IN- \ e& ~: ^" J5 }0 R
- #define DMA_FN_OUT
6 T, q" W; Q9 ?9 ]$ {/ _- I - #endif# Y0 [! g3 q/ d# `) s$ _
* j' ?, w' T' ^5 {3 ]% h4 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" h; J9 E& N& }# p- ^6 X2 Y- P2 i- A
- #define STATIC_SHIFT 3' T! P' F. R, ]; G
- #define TCINTEN_SHIFT 20& I7 u: o& Q$ D C- d, m
- #define ITCINTEN_SHIFT 21: n7 A, Q+ E& C) p& m
- #define TCCHEN_SHIFT 22
+ Z0 h- o( p- `/ k0 i) i3 B2 Q - #define ITCCHEN_SHIFT 23 H: \2 n0 F8 O7 e
- ) W0 T! T1 \1 N2 h# k: g; z
- static volatile int irqraised1 = 0;
- R9 d" Z: {6 W/ F - static volatile int irqraised2 = 0;# d: n/ m6 r K5 ?- s& A
c2 ~2 [. q f, `& W( e% C* x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' h6 P1 W# D" x. g& U1 O0 b% |7 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. |' m, U1 M( Q! Y7 d& X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% R5 N2 O0 A0 g
- 6 U/ W& e9 |5 a7 b
- dma_addr_t dmaphyssrc1 = 0;
" p" Q# F7 M1 N# O ]5 S/ ~( J# x& B - dma_addr_t dmaphyssrc2 = 0;! S- F: `! n4 |5 Z
- dma_addr_t dmaphysdest1 = 0;
$ P8 n2 [- ~1 ^/ Q - dma_addr_t dmaphysdest2 = 0;" |) n0 e' A' `. E+ s
- 7 v( b. ~3 |' d1 N6 b A
- char *dmabufsrc1 = NULL;8 s1 w$ s5 q8 `- i6 T
- char *dmabufsrc2 = NULL;
5 |* u* c% u; ?" D- [ - char *dmabufdest1 = NULL;
& g6 F( ]# R( e - char *dmabufdest2 = NULL; \0 B) I) u7 D& D8 U6 n
4 T1 @5 x; c" L9 v- static int acnt = 512;
$ H d, I) X& R7 ]) U5 c - static int bcnt = 8;( a c! l$ [6 X( A7 e
- static int ccnt = 8;3 P' Q$ U% ^ K: S( [
! U/ n! j& n) d) ~5 l, J: f+ R: Y6 p. G- module_param(acnt, int, S_IRUGO);. Z9 _0 ?( L# H' h( Z9 Z: q
- module_param(bcnt, int, S_IRUGO);' u1 d! v) `- I$ Q7 R
- module_param(ccnt, int, S_IRUGO);
复制代码 5 T. I! [/ ?; ^) H
: v! U9 K* h3 ?& n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ [0 C6 h$ v2 }7 ^- Q9 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
u5 `+ c6 L9 I ]# i* E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% V8 S5 O( T$ L! v8 H {
2 n# T5 i7 C, Q$ ]$ y9 ^" ]8 Y) j5 Q Q; p: O; |$ X
|
|