|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ y$ K9 d2 G1 ^. u5 C- [code]EDMA sample test application# x. J' U8 @; L$ i
- /*
, C5 W5 G* Y! g @. K& D, K! E! J - * edma_test.c! G, e0 e4 X/ g2 |1 n
- *
" u1 i. W: w$ g F6 B; H - * brief EDMA3 Test Application' S; P! Q: `* ]1 \/ }7 g3 q
- *
4 S& A- n. g* ~ Q4 q% X$ N( T - * This file contains EDMA3 Test code.
, O/ E" s$ ?& Y' \ - *$ A3 r+ o- i1 ], s$ |% o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' t Y3 j9 k6 c- o: N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# W: p/ ?7 o {, `) S
- * TO CHANGE.5 ~ r; h D9 c+ s% m! t2 U
- *
3 C" T8 j3 I3 y8 [& `$ V4 ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ?0 H1 j- }! Q: ~
- *7 g* [& w; i- }9 M! r4 U
- * This program is free software; you can redistribute it and/or
/ {" J$ P1 K+ O1 G- C# {: S - * modify it under the terms of the GNU General Public License as" M$ O2 C/ W' U8 [
- * published by the Free Software Foundation version 2.4 J8 o3 X4 Y" t8 g& X* q
- *+ K( g% g& ?. M9 \0 b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' `) z4 }( J4 k0 Z' R, W$ E - * kind, whether express or implied; without even the implied warranty6 O! ]0 x: e" v% s q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ e- q3 A$ K2 d+ g6 C8 ]& k* q
- * GNU General Public License for more details.
+ X' B# N1 }. I+ g - */+ f$ L0 j1 m3 s& `0 f
- , a% |. _2 ?; p4 q; Z
- #include <linux/module.h>
% v% O, b$ w' b; d+ u- m - #include <linux/init.h>
' E/ G& M. m3 u9 o- z/ u - #include <linux/errno.h>
- t4 t q6 |7 ~2 ^5 }% K - #include <linux/types.h>& K- x& V }5 n; P: M
- #include <linux/interrupt.h>; ]" b1 \9 p. } G
- #include <asm/io.h>
1 Z' @7 k: n% `8 _% A - #include <linux/moduleparam.h>6 h/ p4 l* Y5 E
- #include <linux/sysctl.h>1 V2 u' k7 ^2 r! n% }' _" f
- #include <linux/mm.h>8 z! }: |: L! \5 }- M1 Q
- #include <linux/dma-mapping.h># B& d6 f1 n Q- U1 l* n# l- f
% k) H2 w5 j1 |/ c6 M- #include <mach/memory.h>5 W) _# v& Q4 w; Z# a
- #include <mach/hardware.h>
+ i% i1 F% Y5 h0 q - #include <mach/irqs.h>
! L( E4 A4 o6 L. H0 G7 ~# _7 r - #include <asm/hardware/edma.h># \3 ]! w ^7 S Q5 m1 L
- ( B- }$ Z4 L- f, ~ `: p- P; G4 P
- #undef EDMA3_DEBUG
& c# r3 t) g$ B! Z - /*#define EDMA3_DEBUG*/
) ?- _4 {4 n) Q# E' b; ?
4 T# Z! C$ P9 n# m- #ifdef EDMA3_DEBUG C' d1 C2 q8 v0 Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 _! |; S9 k7 r! J! y1 |& T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' U$ c) Z1 _7 h6 w) v" y. z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 p3 t( m# e8 b1 {2 ~6 G - #else
% K8 e) J) G0 J/ U# P! y6 o - #define DMA_PRINTK( x... )
8 a1 y1 I( M; g Z) e - #define DMA_FN_IN% i" \8 P. m9 ^* [, L
- #define DMA_FN_OUT) A: H2 w+ W9 P+ ?$ D* E
- #endif4 C" m! u6 E; W3 H# o: A6 I
0 \* c2 L; |/ u9 L, f, s2 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 N9 d1 M6 N5 U8 F - #define STATIC_SHIFT 3
0 y6 Q: o# L4 Z1 E8 O! }! K - #define TCINTEN_SHIFT 20
# M; S" ^7 s7 C$ b$ }! g. Z - #define ITCINTEN_SHIFT 21/ I' Z4 [# B; M. c) P8 B
- #define TCCHEN_SHIFT 22
# Q& r6 l! p* _3 O: _2 C7 Z ?6 A( f - #define ITCCHEN_SHIFT 236 [! h- l+ ~3 T x2 U, S
- 9 G0 T7 r6 a7 i, o2 ^6 n5 z6 P
- static volatile int irqraised1 = 0;) @! L; V- S) W: [+ G% B
- static volatile int irqraised2 = 0;& g I1 F7 W+ I' {7 M- K: a
) X. a- O; M$ r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. M( R+ C& T; `- z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Y& H: \, B; Z2 Z S5 ~& m% v2 p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& k' _2 \, w8 \+ K1 M - 3 [) P j H3 ^9 m3 G
- dma_addr_t dmaphyssrc1 = 0;# i# g! r- g0 S0 K
- dma_addr_t dmaphyssrc2 = 0;
% L: r- Z' T$ H5 }5 I% w - dma_addr_t dmaphysdest1 = 0;
% K3 w. p; C6 q - dma_addr_t dmaphysdest2 = 0;
! D" t# Z& i) F! ]+ M8 o, y" b
! e2 U2 v; J6 l' w: i7 [8 @- char *dmabufsrc1 = NULL;5 E( M. J% g- s, Z" ]$ b
- char *dmabufsrc2 = NULL;
7 q) Q8 a: K# t9 X# l% I, q - char *dmabufdest1 = NULL;
) O% L3 n' O1 o5 c( V, T2 D - char *dmabufdest2 = NULL;0 c4 @, K# h q" w" j$ i
- 5 P t- M: c; |' ]2 A5 V" p
- static int acnt = 512;2 l* K1 _% a% O8 ~* o( u3 z
- static int bcnt = 8;
9 Z$ d9 i0 _3 {9 ?/ Q* c& t - static int ccnt = 8;$ a U/ q+ F/ G3 L' X2 ~% |
4 {$ f8 E. }8 N7 w f- module_param(acnt, int, S_IRUGO);6 v+ f8 c1 e1 W Q0 c* |
- module_param(bcnt, int, S_IRUGO);: l1 p* O# Q, T2 z7 H4 e4 W
- module_param(ccnt, int, S_IRUGO);
复制代码 * G/ _: K' f4 \! g6 h
" t5 }: X i S6 u/ Y7 h# @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 o: Y( M# a) j% n5 _# ?& Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' B* P) @# {1 E, D; `: w2 K9 e; W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ F8 e6 I$ v" G( C! t% D7 {
8 ]0 C: t& S* s3 U/ R' r
4 f# Z w/ F- P: b+ t2 o& w X |
|