|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * K- ^- d2 e/ A% m! A; S1 w- p+ \
- [code]EDMA sample test application
) t" O4 d. O: h& b7 p - /*
0 ?1 w3 x2 M. V2 P; d( | - * edma_test.c- s7 ~+ p2 W& e9 t) s+ t1 h, v% j
- *! w Z+ j* N7 p2 Z* y1 u
- * brief EDMA3 Test Application% M5 ~5 X$ U, o3 @6 m- ?9 k
- *
$ F8 N- H3 R1 m/ M' _( U4 S# U - * This file contains EDMA3 Test code.. [3 a/ M# `- u3 D! B
- *
& S3 G/ {- J% E* o8 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ~3 X6 {1 a0 p6 S1 e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* J4 j1 |' R- `+ g - * TO CHANGE.
0 k9 P. }2 T" ?' c/ ~, X - *
9 [6 [ M- p# F7 k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! O" M! E, Y) p: [
- *# h: \1 k. c, v
- * This program is free software; you can redistribute it and/or5 Z( a/ N& m8 j
- * modify it under the terms of the GNU General Public License as
3 ]9 l* g% i* }+ w& B - * published by the Free Software Foundation version 2.
7 _: \& |1 S4 { - *6 X% l; @" i1 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; \7 j1 I" f$ X/ y4 ~ - * kind, whether express or implied; without even the implied warranty
2 f! V- Z8 z* K$ H# x7 f' d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( d" Q, S3 z1 |; |. ~ - * GNU General Public License for more details.3 z0 z8 Z5 E6 T t! `
- */1 S0 B. b, A( [7 t8 ?5 K
- % N4 k0 M" `: c
- #include <linux/module.h>. o) R+ O4 F3 C4 }: }) |, j
- #include <linux/init.h>
5 Q8 C! @' O, k - #include <linux/errno.h>2 @. b+ J; M$ S. T
- #include <linux/types.h>0 ~4 b2 y& A) L" v& j* O
- #include <linux/interrupt.h>2 X9 ^% z0 ?1 Z8 y& J' f
- #include <asm/io.h>
; x% V+ t2 l; V ] - #include <linux/moduleparam.h>
; w, g/ F: i; T3 q. x - #include <linux/sysctl.h>& E `- A% U: I2 v' f0 I. C, w
- #include <linux/mm.h>1 X3 J$ g/ f. o
- #include <linux/dma-mapping.h>) ]7 A5 @& Y+ Z* s
- 6 w0 p- f6 P! q3 Z8 m; H
- #include <mach/memory.h>
) |3 p' J1 z% f$ N' ?- v - #include <mach/hardware.h>& q: D* `3 `3 |" M% e" Z3 ^8 u
- #include <mach/irqs.h>
4 S5 O. c6 A+ z. A8 [ - #include <asm/hardware/edma.h>4 i* @4 E7 Q" l: f7 R G+ p
8 T) W' s1 l' o8 O. d- #undef EDMA3_DEBUG8 H: D* D' Y5 T
- /*#define EDMA3_DEBUG*/: p7 _! `3 q+ p0 Q2 Y% c
- % g! M* S" z( l! ?& U; V' ^' p
- #ifdef EDMA3_DEBUG, d' T7 |3 o7 [* b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 t% R+ T8 b: p5 W0 `6 @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ E& P1 H* |2 {9 \& m1 E; T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 Z) F% S5 R2 V' | - #else
7 i4 i# Z) r8 k f" B9 o" n! q: E0 w0 } - #define DMA_PRINTK( x... )
. j' O/ \6 o) D D# O2 p - #define DMA_FN_IN2 D, [7 i6 X! Y# i v
- #define DMA_FN_OUT
6 ?" g0 c. p2 J6 U7 _ - #endif
* o- h% V9 ?+ t+ V5 _ - 2 `+ o1 ], Z2 H H4 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. j' P" t( V* @& h" a - #define STATIC_SHIFT 3
) v6 b( M2 U/ s& r- R. } - #define TCINTEN_SHIFT 208 _: l& q& z: P3 P; F F
- #define ITCINTEN_SHIFT 21
) J7 F( y; z* Y: V - #define TCCHEN_SHIFT 22
4 W F! E, o- D. a* ^" p- V - #define ITCCHEN_SHIFT 233 z/ T4 u! ]) s5 \
- 9 M5 d, }$ k' E( u! F% C' a6 w- Y
- static volatile int irqraised1 = 0;
3 F* U+ X1 D, a2 [- {1 t6 c) h - static volatile int irqraised2 = 0; l$ d& Q9 D: d3 c# ^# p! y* z
- & J8 M5 i5 w1 _- a, |+ U. c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" o/ [* Y% I7 f2 x, G$ e. Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! s( N8 n6 v8 A0 n8 R( f$ v" I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 H, p6 \, t& F L( H& F+ V1 e
- , f5 k0 E8 r0 U+ T" M6 b, Q* m
- dma_addr_t dmaphyssrc1 = 0;) M7 l9 r6 F; t' _) B& a |$ C
- dma_addr_t dmaphyssrc2 = 0;
0 d/ p4 ^- z/ o" q - dma_addr_t dmaphysdest1 = 0;
: l- g) ~3 ? ^' G - dma_addr_t dmaphysdest2 = 0;
& v! r# Z, s& t+ W' e! K
# A7 t3 W8 F2 ~/ B) W- char *dmabufsrc1 = NULL;
1 a1 J8 {0 G2 ^7 Z1 h1 r$ e* ^ - char *dmabufsrc2 = NULL;1 Q: ~: [. W! y$ \
- char *dmabufdest1 = NULL;
1 g; X" ~$ l: z - char *dmabufdest2 = NULL;7 Q! F+ U. ~- l
6 x9 c* _ l: c. B9 P* S+ @- static int acnt = 512;
! Z8 i, G$ t) j; a) d9 F U _7 f - static int bcnt = 8;
d. @7 R& o. x" T - static int ccnt = 8;0 M1 [ g: w9 x! ?- D V
4 D" L5 A) c; I0 P2 ~9 r2 q. t- module_param(acnt, int, S_IRUGO);
- C0 j/ V8 J2 S5 g9 |, a - module_param(bcnt, int, S_IRUGO);
8 @, F" J- \4 m3 D, w' Z - module_param(ccnt, int, S_IRUGO);
复制代码
/ ?- B3 I, ~& t; A) w& ~
" Q! F% F( L, o; E6 O" n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 O& s i5 t- D% Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 [, K, J" j# |, _0 W5 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, s$ |2 D. v4 b2 Q) Z: s9 x. Q4 C
" P; Q5 h- Y+ p3 R) H q; R/ |8 |
|
|