|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% A3 S* e1 A% {* D, K( Q- [code]EDMA sample test application$ r' s& \4 }5 ~# `" a1 }0 G
- /*1 Z1 X5 H/ u- ?$ q1 U8 ^
- * edma_test.c% {+ ]' V% Q0 M( a) h
- *
( d f k3 W- W: l - * brief EDMA3 Test Application% p" f4 O% ?" z5 b5 H# ?
- ** H5 H+ w' c' N( |8 N7 U9 [
- * This file contains EDMA3 Test code.
: U* D& z5 `, Q$ ]) P - * k J$ C& i$ b$ g* h$ m$ f7 B2 C8 [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) \/ {; U: S) q; n8 k. J3 `' O+ z. g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT h9 D' e, P9 P5 c7 O
- * TO CHANGE.% M$ M4 _2 |! n
- *# ?3 _2 Z5 \2 J* ^* j: n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: K2 q! I/ s) N6 _) _4 w" s" y
- *. C; I& H8 M4 |
- * This program is free software; you can redistribute it and/or( `% f* }/ f! l, p8 M: v0 x
- * modify it under the terms of the GNU General Public License as8 ]/ c' X# O: B! A
- * published by the Free Software Foundation version 2." P1 H# }7 g$ g) j
- *% }, K4 @0 K6 E7 b' {$ ~! B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* j) V+ } N9 z" U3 s4 f% @ - * kind, whether express or implied; without even the implied warranty
" ^. W1 h; X* Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ i( ?' D8 G. n
- * GNU General Public License for more details.
7 }4 r' y! t* F1 w3 }$ h) A - */
9 h9 p( H, ]) G9 e+ J- \$ p. Y; H7 J
/ t, i0 c% w2 v4 u' m/ C& r( t- #include <linux/module.h>
7 j- O t5 u/ o, Y- { - #include <linux/init.h> X' C4 p: b. V) d3 k) d
- #include <linux/errno.h>5 [ D. e6 W% `6 @% i' Z
- #include <linux/types.h>
2 I$ ^) ~+ h. K- E0 g - #include <linux/interrupt.h>* s! c& C/ C6 h# u# _( i
- #include <asm/io.h>3 T0 y; X' K! F% ~ {! g
- #include <linux/moduleparam.h>
5 r* _7 l- r) o# r0 x" p - #include <linux/sysctl.h>- Z8 P7 V/ A1 j1 W& Q" F
- #include <linux/mm.h>' J3 D! u, Q K; T* e, m( Y- ^
- #include <linux/dma-mapping.h>! U7 Z$ x; R' P" K& e3 F. ~( a
- 3 e& [2 f1 @' S+ M( ]/ A* @
- #include <mach/memory.h>
) R. m7 F3 _3 F9 U6 S - #include <mach/hardware.h>
9 Q( j6 G! P* k- p - #include <mach/irqs.h>& {% a. }) W7 f
- #include <asm/hardware/edma.h>$ u& x# n, p5 H/ z9 z
- 2 a5 ~2 }" g% {1 u6 [
- #undef EDMA3_DEBUG
0 }8 q7 P5 A$ i/ j9 J - /*#define EDMA3_DEBUG*/
( B6 x0 k6 U' V" [" P - 1 m9 g$ K R$ I2 i6 t% M" a
- #ifdef EDMA3_DEBUG
4 q/ Q% Z0 }% Q' j# G% L2 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: [0 W5 G* H( m5 m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
b# @% ^4 n+ e5 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ \/ l. [1 l6 {; x* w5 }% P+ X3 q
- #else6 `0 J' o. G H
- #define DMA_PRINTK( x... )+ l) f+ Z5 c1 x v. B% j7 j/ A
- #define DMA_FN_IN
* R% U! E& L& p* s' m4 Z - #define DMA_FN_OUT
- D( G% f& q f! |, H9 E - #endif
7 L" D" Y/ U7 Z& o7 y9 |
" V' I% h9 ^) }9 t4 ^4 {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, [ r2 k9 J0 _/ [, d- ]7 e - #define STATIC_SHIFT 3
9 F. Y6 U$ Z1 A' T6 { - #define TCINTEN_SHIFT 20) i! f4 O) k9 z
- #define ITCINTEN_SHIFT 214 e, }7 u" L% b) c
- #define TCCHEN_SHIFT 22
6 O4 r& z) Y! G2 G: \ - #define ITCCHEN_SHIFT 23
) H5 f( v$ U6 B: g5 | - 1 ^+ ^; Q3 \+ A
- static volatile int irqraised1 = 0;
7 O3 k9 J! v/ [4 e9 j# Z - static volatile int irqraised2 = 0;$ l- o$ _4 R) B+ l( Z- S
4 A: M' U: H& H& D5 y p* ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ P6 M5 S3 A- D6 p" g. { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, W! k0 a3 F- y% C- ]) `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Y( D: S. W) F. E" V. f' {
8 O3 h1 A- E0 l$ o1 `! g; n- dma_addr_t dmaphyssrc1 = 0;2 g1 |5 h7 i6 N; R
- dma_addr_t dmaphyssrc2 = 0; h0 h2 ?/ G# @, @
- dma_addr_t dmaphysdest1 = 0;9 _, p1 E- X1 ~+ J, |
- dma_addr_t dmaphysdest2 = 0;" n# Y' S' J0 z) L* A
- + ?4 X, O$ y7 J/ i, H; }# h
- char *dmabufsrc1 = NULL;
: s! u% z w; G - char *dmabufsrc2 = NULL;
6 I2 _4 Y9 \: |, s1 N7 y - char *dmabufdest1 = NULL;
" ^9 M" P' h2 ~$ [ - char *dmabufdest2 = NULL;6 a1 s( x: _$ d4 S
- 4 C! }. e2 L4 I8 a
- static int acnt = 512;
& W5 a- _( j4 I1 j$ L - static int bcnt = 8;
# u5 j0 ?( Q# N# P q- G4 q9 y, w - static int ccnt = 8;, s9 X1 ]; [# I) ~) m& p0 b
- 5 c3 H$ X! r. L
- module_param(acnt, int, S_IRUGO);& Q8 ^: p# Q9 H
- module_param(bcnt, int, S_IRUGO);
# x" A9 ^7 y' E0 U: T! \ - module_param(ccnt, int, S_IRUGO);
复制代码 7 ]1 P8 `" c4 A/ b7 `- w, V. M
. t' h! Z [0 K$ ?$ s# e' U Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% ]4 z$ S6 l7 P5 d. R& a9 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 f y* d7 N" Z p5 n8 W& z, w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, E3 v- [2 d2 s0 x$ x5 h
, x3 H/ Y4 D8 C' j! A) q
1 s+ H4 h2 z9 H) z/ h+ Z& ? |
|