|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% J9 B& I- t/ z9 A- [code]EDMA sample test application
! ~; O1 H J; P0 r - /*
7 a: _8 R* c+ Y# [, K - * edma_test.c
, V) Y; y g2 ?/ R/ m8 c - *( S; L, d0 B/ x% u# O# ]; V" Y
- * brief EDMA3 Test Application
; Q0 h8 ~! S9 r% P2 g2 d - *4 C& s8 o) [* Q7 L+ T6 {& @
- * This file contains EDMA3 Test code.
+ I5 }" v8 H9 k - *: d: I1 M/ V) @# U+ w( j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 ^7 `( Q) {* ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 [4 q' ~# k) [2 S% m! L5 b - * TO CHANGE.
) T0 x. m, J8 H$ ?7 Q$ A - *
: p- X" U' l6 z. T6 g* U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' }* c, w/ w* z - *
9 M& I h s# }9 f9 D* W - * This program is free software; you can redistribute it and/or+ E$ k7 e9 K- _' R6 `' e
- * modify it under the terms of the GNU General Public License as
" E& x- Z) `( c$ h - * published by the Free Software Foundation version 2., y4 f( z% C. X, e" z; g' O
- * ^4 t% G1 P. @% E) P! m" A4 m% F8 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. C. R. R& b0 M/ h7 m, s - * kind, whether express or implied; without even the implied warranty2 @2 W* r$ Y" ?; y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
W4 E/ @5 i, ~; i6 b - * GNU General Public License for more details.' u9 o6 U" [, E: O
- */" @4 o; M2 ~% X8 ]% u1 t
8 F( D$ M; ]; A4 o, ]$ V. z$ M- n- #include <linux/module.h>
N! Z9 a. l6 l7 k - #include <linux/init.h>
7 G+ G7 g4 d5 |; X9 _( u - #include <linux/errno.h>
5 T! |8 Y4 N. F/ e' H! x! v) f9 Y - #include <linux/types.h>
# s1 g4 H/ e$ `, a8 e - #include <linux/interrupt.h>
* g2 [. |$ z& a# P# h* p/ W g4 a/ r - #include <asm/io.h> {! x7 Y! [, q9 H
- #include <linux/moduleparam.h>
" Z. e, n) Y4 D2 ?# p - #include <linux/sysctl.h>) A( Q: B' v+ I# W! A( Y
- #include <linux/mm.h>
2 ^. F0 ?2 X! Q( r+ X r - #include <linux/dma-mapping.h>
$ n: s( j1 H+ u" D9 S - 6 a) a$ M; q- O1 ]$ @
- #include <mach/memory.h>) y: D: B" Y2 ?3 h
- #include <mach/hardware.h>
" A& \5 r/ S% ` - #include <mach/irqs.h>! b9 T+ O& E7 `$ D
- #include <asm/hardware/edma.h>
0 v- w. g4 a) h: P - 3 C b* f! t ]2 @8 ` z4 J
- #undef EDMA3_DEBUG- b' q% A2 M1 w. W4 v8 [
- /*#define EDMA3_DEBUG*/
: K, X+ K& |% `- p: A
. a0 N+ G" I! R9 F P, J- #ifdef EDMA3_DEBUG! y& `# X, @9 R1 h- o: j+ a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" t# {! D# S5 L3 \2 H! y4 Y) ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ M4 D+ @2 ~5 X' N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% ^) S: J9 i7 `4 h - #else
+ v, p2 {7 `; M: |7 c0 N - #define DMA_PRINTK( x... )
3 W" W7 ]8 j& l$ a: E% @+ o - #define DMA_FN_IN
% M# }- V6 q7 @* p) C. B. O - #define DMA_FN_OUT
9 s- }6 H( z; e s( K0 N - #endif
( @& |( l3 \8 G - / k. [ M4 D/ J$ Z6 d* P5 m6 a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ }( t. [0 Y( K* x+ G* ~ - #define STATIC_SHIFT 3
+ ]$ e5 T- F# e3 ^ - #define TCINTEN_SHIFT 20
# o5 P! g8 `$ n - #define ITCINTEN_SHIFT 21' A6 n! ]0 }! G/ X* o$ j8 }1 _
- #define TCCHEN_SHIFT 22
3 _# U- P: c& m* r! t - #define ITCCHEN_SHIFT 237 \4 Y! `# U, Y5 B3 e, \
- * n' s. E! g9 a
- static volatile int irqraised1 = 0;
1 [% |9 N- }, D0 z! \3 w9 L - static volatile int irqraised2 = 0;! D2 f) ]8 |4 N0 h, I1 u' o! r7 p
$ M7 N. Q; D& V% T& ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. Q8 f) U! e& _1 r0 P- E! a5 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 Q" K; U. b" p; a# a3 C% z i! } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 j; A1 h! F" U; [* U
% \/ k& p8 z# M5 W% N0 w$ J- dma_addr_t dmaphyssrc1 = 0;
, Y' f9 b0 _$ t! d0 S, I - dma_addr_t dmaphyssrc2 = 0;* A" V5 h) f% F, j" U, Q
- dma_addr_t dmaphysdest1 = 0;
% Z; J$ k: Q: `/ F6 C3 ^ - dma_addr_t dmaphysdest2 = 0;
0 R6 |) I" k* ^4 ~6 W& X
* C. e5 r Y0 i2 B& k; N- ]8 E- char *dmabufsrc1 = NULL;
- F: N4 `6 {6 g/ E/ d - char *dmabufsrc2 = NULL; r5 S6 O% d+ p* u) d* e$ W
- char *dmabufdest1 = NULL;
8 _2 T( t4 ?/ X5 L - char *dmabufdest2 = NULL;
+ L8 {$ }- C- s. S - + p4 e# A1 c0 c V: b& |% }) z$ u# }
- static int acnt = 512;* X& ^: G) H" X0 \, o
- static int bcnt = 8;" f) g! p/ l- ~: ]# w4 n. I
- static int ccnt = 8;
2 D9 b2 p z. |# e: b
; d) x8 y) E1 B5 _0 t- module_param(acnt, int, S_IRUGO);; z4 e7 L( x! A8 B5 v
- module_param(bcnt, int, S_IRUGO);
! e y. P$ y0 \, N! b - module_param(ccnt, int, S_IRUGO);
复制代码
( n" J( `; m! P" p0 B+ R, e0 V. D" Q6 X O6 W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ m, B! K6 L; m4 U2 r% S* harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 r) o7 o F. U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ?& g- S' L; W% G5 p
# l3 J9 P9 a- ^ K3 z1 n( S2 C, [4 y3 p5 u0 L1 T
|
|