|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 f$ H2 N6 E: D* \. R# t- [code]EDMA sample test application6 ~+ p# a" g' h* F: L+ U. G
- /*+ W) A7 \7 m' |0 f! m
- * edma_test.c$ R+ ~/ A# ?/ f
- *$ \' F J$ m: ]4 r; ]- o3 E
- * brief EDMA3 Test Application' k' x% O1 Q9 w+ H
- *( t7 O/ a% z& F/ N: u G7 W3 K
- * This file contains EDMA3 Test code.
0 s: o# X1 J8 @# o o" o! Z f2 y - *
' o0 ~& u3 ^/ T9 f& J4 r: D( a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE R1 B; P( U& v2 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT U7 B; u- k/ H6 V. a2 r: y
- * TO CHANGE.3 c5 P; a* V8 Q( D f% p' `
- *0 I4 {9 p( [: u% c6 J+ k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ s' i8 O' B" @) T' I# @0 B+ C( W8 V& B Y
- *7 \' V: i" J. c# w# G* v
- * This program is free software; you can redistribute it and/or
7 r. X4 G$ w; i2 w4 G - * modify it under the terms of the GNU General Public License as
( q' @7 a& f+ x1 J; E: |. W - * published by the Free Software Foundation version 2.
" w5 C0 U3 C! p' X) ]2 q' [ - *9 d P, t' i) w- V( \! i8 s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 [& R. W* l/ u# N" y - * kind, whether express or implied; without even the implied warranty; h* D/ b5 f5 @) J# p- R, N1 I* U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ l1 v0 A+ J% }; Y1 L! F) y - * GNU General Public License for more details.* B& f8 V$ T/ ^4 o+ K9 k
- */
: u( N" e8 c L8 @8 o9 E: c - # J& d2 f! U5 _1 M/ v
- #include <linux/module.h>
2 ^% r& t/ x# z - #include <linux/init.h>
5 L0 B% j+ `$ ~, ^0 m( S6 c - #include <linux/errno.h>
+ {2 \/ C5 H# D2 f. c - #include <linux/types.h>$ V2 D3 j! A! \5 M/ V/ k/ a! M+ g
- #include <linux/interrupt.h>
% A+ I- D- m% [1 F; }# D - #include <asm/io.h>$ ^0 D. T* O9 n
- #include <linux/moduleparam.h>
5 [ |/ M- {5 p" l9 V. ~ - #include <linux/sysctl.h>
, b6 A- {% u& L) b - #include <linux/mm.h>
0 e D6 d/ r" |+ y& ` - #include <linux/dma-mapping.h>
( j$ \6 `+ }+ n' c: ? - ; N! D) D# z7 s+ u; {# H
- #include <mach/memory.h>0 R; S9 k) x/ k/ Q" ?
- #include <mach/hardware.h>
) M, v& o+ W, P0 P9 Z - #include <mach/irqs.h>& ]) u+ D3 h4 J' u( s
- #include <asm/hardware/edma.h>( C: g" h; j5 }: ?! Q3 j# B z
- + o% u- M' l2 a# @+ t
- #undef EDMA3_DEBUG# ?2 Z" P9 Q' s. G) Q- }
- /*#define EDMA3_DEBUG*/7 S( \) ?2 N- B) _% x: C
- 8 _2 y5 G$ l1 m
- #ifdef EDMA3_DEBUG, W3 i6 e! k: G5 h: ?7 s0 J% D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 c. N4 U. |; { e0 U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 @# b# {& p" h/ l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 Y( G$ T9 o" U - #else9 d7 A& V, ~7 I# c
- #define DMA_PRINTK( x... )# Z8 t8 }5 o# G, p) s
- #define DMA_FN_IN
2 [) M( j/ E: z! c - #define DMA_FN_OUT* P4 U5 Q3 [+ D( e& X& b
- #endif
& W* ?+ q: U- }( X* w+ \5 x" w - ) z8 V* A/ I, m0 i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, z) a; {$ B% v4 ?8 Z6 Q& o - #define STATIC_SHIFT 3/ z" _4 g3 d7 f2 K8 a2 J. }" c0 C" w
- #define TCINTEN_SHIFT 20
$ I8 I6 B0 j# W% h3 y3 U+ { - #define ITCINTEN_SHIFT 21
$ y! E c- f$ ]7 \7 N/ ~$ p' C! j - #define TCCHEN_SHIFT 22
/ ^* ]# U! d$ W - #define ITCCHEN_SHIFT 23
4 E; S/ D: u, @ - $ t& @2 t: s9 {' n
- static volatile int irqraised1 = 0;
1 O5 C7 ^- x2 } - static volatile int irqraised2 = 0;% d/ _& \/ n; o, H2 e
- # N4 Y5 P# r4 `3 t7 [% o: A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% S3 f( W, s$ U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 _ o) c" M% P5 s0 R, ~0 e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) M8 R+ X W" l
- 3 Q& _; V Q2 e) h3 u" B7 Z
- dma_addr_t dmaphyssrc1 = 0;& q& i( Z2 C3 Z$ M q- z
- dma_addr_t dmaphyssrc2 = 0;
+ O' C! Q Y! j; ~ - dma_addr_t dmaphysdest1 = 0;
+ _# @& i: }. Y4 M# j& z! X - dma_addr_t dmaphysdest2 = 0;1 \- l. z. [+ i/ g, s; m
- & u# t" ^% \4 J( P4 ^
- char *dmabufsrc1 = NULL;
& v+ r. M& g) N" N' O- N - char *dmabufsrc2 = NULL;: r; @( P8 l0 `0 q
- char *dmabufdest1 = NULL;# V: S% b6 ^6 u, T
- char *dmabufdest2 = NULL;
7 d" V3 h f9 i! o" `
; x7 @( U" t$ h# T8 J6 p- static int acnt = 512;
7 @/ @, l4 H, W - static int bcnt = 8;
! {/ S1 T/ X6 Z& D+ L. ]: ~ - static int ccnt = 8;1 s% U5 z7 P, Z' [$ ?
- % L# y& f; f' ^
- module_param(acnt, int, S_IRUGO);# L4 s2 T9 A9 m: j
- module_param(bcnt, int, S_IRUGO);: p+ H6 e3 |0 D4 W" r1 x* ?' n9 E( h
- module_param(ccnt, int, S_IRUGO);
复制代码
/ O4 j% i3 Y, T% N/ Q8 I _1 y4 F L: A; `5 _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 t" s2 Y) _! h+ U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# q+ l. w, E7 C& |+ r+ A' v, ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ o5 B" z. T% r1 r% B6 t# ?9 R2 Q3 d/ Q/ c6 n
5 @$ c, U. [+ d- Z$ s, s |
|