|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - |; ]1 w* b+ R9 I0 L& b! R
- [code]EDMA sample test application6 V8 I, D2 L! F! w4 R1 c
- /*9 k6 D7 `" o. p- G' B2 H1 }; b2 @
- * edma_test.c5 v2 g! n5 d |% H6 F
- *3 i: f4 N& a' G
- * brief EDMA3 Test Application- ~1 S- Z' D" x& O K
- *) l! |: \3 ~. K3 l
- * This file contains EDMA3 Test code.; D- S" h. t; ] M* w! S
- *
9 k8 ~9 [/ M) Q/ Q" x, e, s/ A+ y5 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. p# u8 h# {8 x/ o! t# m! a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; Z6 l+ I7 ], z2 I - * TO CHANGE.
5 I+ u D" a |7 }( m - *
+ ]1 g2 G: G/ B$ R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. `9 ?$ z, N7 D0 L6 K - *
. s9 c. B7 A/ L/ Z9 U9 v - * This program is free software; you can redistribute it and/or
8 t" t' X4 n7 H - * modify it under the terms of the GNU General Public License as- V( \: f/ C! K& F ~" T! S
- * published by the Free Software Foundation version 2.
+ l! C' }/ v2 k/ w$ _ - *
$ C4 o) E3 W$ \( _# s, B1 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 f/ T& t9 O/ g( V$ y
- * kind, whether express or implied; without even the implied warranty7 ?2 m+ p+ m0 L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 {- @, u% U2 M5 ~, `# w) X - * GNU General Public License for more details.
$ v* r( t% Y U8 ] - */- _' Q+ u5 g* a0 e5 S5 \/ D% W- ]" c
- 4 U$ a7 }! c# n0 P3 @
- #include <linux/module.h>$ ^3 L0 H( {/ v$ O( _. r6 J: ^
- #include <linux/init.h>
& P+ p- |9 h1 \( A# W5 o/ L - #include <linux/errno.h>
3 u' |/ O/ W& m; p0 A - #include <linux/types.h>3 N" m7 Y( q4 q# i- l( K3 P& {
- #include <linux/interrupt.h>
' Q2 b L7 i4 B4 X& F8 }0 i - #include <asm/io.h>
. P' _2 B# ~9 f, L - #include <linux/moduleparam.h>6 b& m5 X, g+ n) \4 T8 |* f
- #include <linux/sysctl.h>; W6 Z! H2 q$ @: \6 U3 V/ S
- #include <linux/mm.h> U0 ^: v; [ Z) z; K3 H& b
- #include <linux/dma-mapping.h>
+ x# g1 A% j9 r# r8 H, R - & \$ S9 h4 A% k; H
- #include <mach/memory.h>; D* m+ `* L( @& N2 s
- #include <mach/hardware.h>
$ ^+ l7 F& c% J# V, a4 T - #include <mach/irqs.h>
. g" a9 b5 U0 `; j/ } w B - #include <asm/hardware/edma.h>, }& X. H! H6 [3 X
- $ a& _7 l' j5 I! N5 q8 g; R- p4 y
- #undef EDMA3_DEBUG/ [7 l# ?) U; a
- /*#define EDMA3_DEBUG*/
4 f5 t7 u* D, _) E W1 ~
l( ]1 \' p$ i* t9 \8 [- #ifdef EDMA3_DEBUG
0 ]3 ]( H8 s4 l v) d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! Y3 B( N3 a/ x$ w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 g0 u% X9 K Y$ _" M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# |( X$ ~1 \% `: q2 ~" ~ - #else
8 f) |" G1 j$ i* S4 H( {6 M. Q - #define DMA_PRINTK( x... ): |# ?; \1 }9 @/ c' {" K6 {
- #define DMA_FN_IN& f) l' ?: Y" P0 }3 @! x
- #define DMA_FN_OUT0 ?) v" e J5 A
- #endif
% E0 ~$ K- K% [+ _( \ - * K, G2 D# e, h+ E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). ?% v$ K- k, P$ M) u: s [
- #define STATIC_SHIFT 38 N. C! z9 n9 S; D" A
- #define TCINTEN_SHIFT 20* T$ {9 V1 A8 G, N# r3 k# K
- #define ITCINTEN_SHIFT 21
! f: |5 H, Z( A2 @) y6 ~ - #define TCCHEN_SHIFT 22
$ W1 B- O- c& R - #define ITCCHEN_SHIFT 23# @- }# K0 k. f) c0 B8 Q
- 1 [( Q4 e- T( s" f8 ?
- static volatile int irqraised1 = 0;9 t3 _0 k, f! j& v
- static volatile int irqraised2 = 0;+ x0 o7 v7 s& f+ K, ~
- 2 L/ h8 M5 p; f4 z1 X. j* o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- s6 B# t# H7 _# G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ A {& {$ c0 e$ a) { X! [: y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% f. c* o; K6 j% Y* ?
2 M; s7 R- x7 c _5 F- dma_addr_t dmaphyssrc1 = 0;
C: }: v1 Q; r. P- f - dma_addr_t dmaphyssrc2 = 0;
" D5 \0 j6 N3 G( P3 ?/ z6 L9 { - dma_addr_t dmaphysdest1 = 0;
7 Z2 v( \$ p7 ?, R - dma_addr_t dmaphysdest2 = 0;; s& M: }# T2 \! |7 r+ x6 V
+ l# Y" |+ U$ z; t2 d- char *dmabufsrc1 = NULL;# q! d3 a) y! ?' l7 [
- char *dmabufsrc2 = NULL;
! w% w5 \7 Z8 N% e1 x1 Z - char *dmabufdest1 = NULL;
4 j" `9 d5 `5 M0 y' @" O - char *dmabufdest2 = NULL;$ E- i7 I* i( A9 n9 `' h- W
! j- g& x% r5 j9 u- d- static int acnt = 512;
9 e' l$ F: v' T, l a - static int bcnt = 8;7 k+ p" V2 k+ `) v H% A
- static int ccnt = 8;' V5 c% h. I; O! l
- - P3 k/ S4 U; \2 Z+ B# f% _; y- \
- module_param(acnt, int, S_IRUGO);
4 }) ~0 O* a6 A+ L1 W - module_param(bcnt, int, S_IRUGO);
6 F6 t0 ?# v) }: X7 o+ D% ? - module_param(ccnt, int, S_IRUGO);
复制代码
6 K# T5 r& V, ]9 u d3 @" `: Z
; A: L$ q+ p; i7 o: ~) I1 H( G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% f' J* Y4 Z# L8 i6 u; k4 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
~' Z% |4 |7 z6 `+ y/ u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ r8 v& ?$ Q9 ?& y2 c& }' [1 u+ u0 K, K- w* o" y5 B2 p
$ i2 A* P7 h, _8 n5 h. H1 M9 O
|
|