|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( {# h0 x" s; F6 u* J- [code]EDMA sample test application1 F4 n$ b% C8 ]4 Y7 U$ Z+ P
- /*
}" C+ b6 E, n) m$ O; U - * edma_test.c
! ]5 a* O( \. ] n# }- b4 X O - *
& e" I \; C9 ^ D8 T4 C - * brief EDMA3 Test Application/ F7 |# O6 `7 y# b4 t/ V. W" l
- * E4 |7 o1 ]: `+ W* G7 {' D
- * This file contains EDMA3 Test code.' V( J1 x: e6 N; A) C/ G. y7 z
- *5 f! W; n$ @. n. S1 M0 a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* r; F, m5 ]* Z# X2 X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 W( g: D# m' ]# ]: S
- * TO CHANGE.. s$ u d8 U! t. j$ j c) U
- *1 ~7 h; r7 E2 t% D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ ^+ d4 L/ |" _# C - *( P$ F6 z* b+ M3 ~6 K" a+ p' V2 e3 B! `
- * This program is free software; you can redistribute it and/or
6 _) f7 i+ x% z - * modify it under the terms of the GNU General Public License as
- J7 V6 U) J' D& m - * published by the Free Software Foundation version 2.! p! F! k" U/ _6 C* F2 G
- *6 q3 [8 [) E8 p2 N9 w0 j3 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 E/ s( | H. q7 @ - * kind, whether express or implied; without even the implied warranty3 O9 h3 y0 b# _+ M! C" n. `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 b) v6 k* F& Z6 M" S - * GNU General Public License for more details.: s7 G7 I" I* a# O, k) O1 G
- */
. ^4 \8 }, _2 n% X- y' B - % ^+ n4 D8 A; Q5 k$ y2 O
- #include <linux/module.h>
. j5 y- f0 H' k, N. j; Y' M3 J2 s( S; s - #include <linux/init.h>' D& b1 c$ G1 x8 l2 L N
- #include <linux/errno.h>7 O/ @( M# J6 L W c: o! H% @
- #include <linux/types.h>! p3 Q$ G0 I1 Q! T P
- #include <linux/interrupt.h>
% E1 l4 _. U X1 w2 P8 {9 P% [ - #include <asm/io.h>5 J6 @* E8 G5 o: R
- #include <linux/moduleparam.h>
/ N/ ]. t, S+ Z2 D1 f* \ - #include <linux/sysctl.h>
: z9 M [1 a+ P1 _. _( l$ }4 h - #include <linux/mm.h>. ]3 ~% g$ ?6 A7 b; G# H+ r u
- #include <linux/dma-mapping.h>3 S& U) K" _" F+ R, B; L2 F
- - ^0 u$ J" g. g8 b0 O- Y( d( r- L9 X
- #include <mach/memory.h>) ~( x& S: m b$ @/ t
- #include <mach/hardware.h>
' T$ B0 V- p( @/ V+ }- l* F - #include <mach/irqs.h>
+ d5 V8 H5 J+ \+ i# x6 g/ Z' g4 l - #include <asm/hardware/edma.h>7 ?. G! }1 c6 w( L
- ) `3 T/ B* @' R, w; s
- #undef EDMA3_DEBUG% v o6 K- ?( K
- /*#define EDMA3_DEBUG*/
1 h0 Q5 J' H* o; `
) }8 C3 Y& n' I" h7 M: @. s! C4 P! |- #ifdef EDMA3_DEBUG, g' x8 K- d8 v- O4 |0 u* e0 n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- t; ]. P7 f+ r q E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 ?! D: y9 L0 \3 \. d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); }6 ^% l! B n0 k% o1 `
- #else
2 \$ b5 N4 a' [7 |& t/ T - #define DMA_PRINTK( x... )
1 J) q& M/ G7 _0 m - #define DMA_FN_IN
7 e, f2 y- D* _& x7 X - #define DMA_FN_OUT
: S( {4 z( e) ~/ v% Y - #endif2 E/ ], ]! i0 w+ i- j
- ( X! X: r# Q: ?# R3 ^3 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ u9 y0 V$ R6 V& q5 ^ - #define STATIC_SHIFT 3
7 L5 Q% v) j. Y7 M; J9 Y4 o - #define TCINTEN_SHIFT 20% |0 b5 f/ Q3 r3 D* H
- #define ITCINTEN_SHIFT 21+ p* D2 ]3 H2 Q5 k- I$ T# @9 X
- #define TCCHEN_SHIFT 22; N& v7 L, Y% n
- #define ITCCHEN_SHIFT 23
1 }$ [4 Y0 @$ X* w9 C) `6 W( M
3 g9 Q/ T$ ^; Z0 R' ?: a+ e4 \ X+ \- static volatile int irqraised1 = 0;
0 v9 l2 t# S" v9 }: S, \ - static volatile int irqraised2 = 0;- [1 K. r) r+ X* [! k3 d. |4 b
4 z, Y% T% W3 G7 i K: n/ O' H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 M7 l2 g4 D6 k* H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. e& S5 } s+ i) z$ }9 x. n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 a. d2 e+ F6 P" ]" G
2 j+ V: }+ K& V5 H, v( e- dma_addr_t dmaphyssrc1 = 0;
1 O& O% X+ R, S - dma_addr_t dmaphyssrc2 = 0;
* E& |6 Y5 _+ b% m+ J" M y - dma_addr_t dmaphysdest1 = 0;. w1 s# B H( w; B c
- dma_addr_t dmaphysdest2 = 0;" m9 J, ?+ z8 W: g
- ; a2 u6 O/ j$ {5 r/ `
- char *dmabufsrc1 = NULL;/ ]" }: G; P, G* R
- char *dmabufsrc2 = NULL;
. i, S7 V1 S. I# P4 M/ ` - char *dmabufdest1 = NULL;- B" \! W( T+ D5 o, b4 r4 l8 |
- char *dmabufdest2 = NULL;$ v- ]" E. H3 V2 j2 S
- 0 {% n# P; v% n& M
- static int acnt = 512;1 m4 S% B2 m/ {
- static int bcnt = 8;4 N; [$ E! T$ E# h* S0 ?2 o
- static int ccnt = 8;* P4 {3 X3 J7 y6 S
- 6 b1 _* {( P; t T6 b, _6 J5 b
- module_param(acnt, int, S_IRUGO);6 I, |$ h7 K; q0 y! }
- module_param(bcnt, int, S_IRUGO);" p- F0 O! [6 A9 @; N
- module_param(ccnt, int, S_IRUGO);
复制代码
, B4 c- P) X6 r
$ F) g9 v& l6 e8 {5 D5 M' Q' e1 o3 Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 D, I9 W5 S+ [% {. y `! qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) l; G3 ]4 r- n. M9 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ I$ E% j/ _+ ?- ~
. E! v) x [7 o/ o8 ^6 A* I& g
; @4 {: _1 Q- G |
|