|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 \6 c7 n5 V) d
- [code]EDMA sample test application
" S7 V) V R. W) \. ` - /*
7 A2 G% F A5 f& A9 ^3 r- F! y - * edma_test.c- f* ?! K! [/ q9 k, m. x$ L- F0 ^
- *
# V* f$ W }5 l2 Y4 L! i - * brief EDMA3 Test Application
: c' ~2 q, f) ?; Z4 I9 h - *
0 O1 Z: s4 r* @8 J" y) Q! Q - * This file contains EDMA3 Test code.6 O g. \7 h+ Z$ Z7 _
- *
9 c* B" Z& s" x$ c8 @( R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 |9 v/ |5 G" i/ ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 E& U# D d0 s& a - * TO CHANGE.
5 s8 W3 P5 A: V. g9 D, n. N/ ]/ ? - *
; V. c9 _8 C( [9 n, H/ y- Z X+ T) [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' b0 ~7 ~+ R- o. u0 J$ e& I
- *5 a$ b. B/ s! o) S# E* k9 X$ u
- * This program is free software; you can redistribute it and/or
+ w0 A2 A& r4 K6 o - * modify it under the terms of the GNU General Public License as
" j, S) h- z! Z3 s h7 B7 G - * published by the Free Software Foundation version 2.6 T, U: {, P6 Q2 @
- *( C$ g4 C% [' ]8 }1 X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- S: F7 {, x/ ?7 g, @4 h: C - * kind, whether express or implied; without even the implied warranty+ m/ H4 S" ] X5 L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) O! {3 R9 B& K# j) V - * GNU General Public License for more details.
3 h8 A7 n i4 u - */( L3 Z9 r$ z" U6 x
$ H" a/ P0 m$ S6 a- #include <linux/module.h>0 O4 V5 m+ m8 v: r! z7 `- }- S
- #include <linux/init.h>
1 \9 @5 f% s0 z& X/ \( i% O& x - #include <linux/errno.h>
7 Z1 d2 \& w/ ?& e' O8 Z - #include <linux/types.h>
4 Z1 I. y5 h8 G# X6 f - #include <linux/interrupt.h>" L5 [. Q5 B8 N0 z0 n2 {8 p2 G
- #include <asm/io.h>
# |8 h# y' ^* {& |) d - #include <linux/moduleparam.h>, f- c. d3 [ M1 N+ q; s
- #include <linux/sysctl.h>
B, T7 N7 |/ ^% L( z0 ^ - #include <linux/mm.h>
4 f8 [9 f2 o! e9 H& R/ m; n - #include <linux/dma-mapping.h>9 q) W3 X) J" k9 z: l$ H
- ' N& f7 f, v2 w7 a
- #include <mach/memory.h>
5 D8 d {8 p l; G F$ E - #include <mach/hardware.h>
" k. m- `5 K: H. e/ ]$ D H - #include <mach/irqs.h># n, C7 {3 E2 I- s( {
- #include <asm/hardware/edma.h>* |- E- A6 }/ r( q" F
- % W7 K4 a+ s& J* Q2 L
- #undef EDMA3_DEBUG; Y: h; H% _! Y& r- X
- /*#define EDMA3_DEBUG*/
j* q+ q8 l2 ?7 V r
, ^; T! E% L1 j- #ifdef EDMA3_DEBUG' n, I" j3 Q9 h0 I3 x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 f; f9 C& W8 U- [8 H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); u. [" L( u2 s( m4 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( Q1 x* ^3 k: _+ a6 L# {, j' O - #else' ]$ e i1 r. e
- #define DMA_PRINTK( x... )2 }5 `0 |" K* J
- #define DMA_FN_IN, |( N P" z- e6 ~* G$ F5 E/ I
- #define DMA_FN_OUT7 w1 w* b8 p/ X/ e
- #endif
7 V- C' k" D7 ]; s) M) a; n
+ M' D y. M, I4 `0 G- #define MAX_DMA_TRANSFER_IN_BYTES (32768) Q) Y8 e/ h& P: \% c
- #define STATIC_SHIFT 3
% _9 i$ a& X8 I( z0 d. n% [8 _ - #define TCINTEN_SHIFT 20
1 [6 M5 a( I2 q - #define ITCINTEN_SHIFT 21 x! {( q7 l+ z7 k9 E9 ^) c6 {
- #define TCCHEN_SHIFT 220 |6 h- _% ]; j; l4 M o
- #define ITCCHEN_SHIFT 235 ]9 h/ d, L$ E- x9 M2 l- p0 U% c/ W" p
- / J6 i b4 c Y# H' d
- static volatile int irqraised1 = 0;; c6 e+ s* Z) m3 v- @8 c3 ~! g
- static volatile int irqraised2 = 0;
5 [/ G3 g: a1 F7 V' @ - 9 l2 b. [- }( O& S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 j3 e k* h: O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% P" a; W! q9 c, ~' V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 A( g7 ?" g! i6 C
$ f. n% W- Q8 s$ t* v0 M- dma_addr_t dmaphyssrc1 = 0;
$ ?# S; C+ w. O - dma_addr_t dmaphyssrc2 = 0;
8 _+ V9 p' i: S8 R* g4 K p2 p7 t - dma_addr_t dmaphysdest1 = 0;
1 h; ]/ V* u2 F: x - dma_addr_t dmaphysdest2 = 0; u e2 A+ M6 n% [& B1 u/ O4 r0 S
- " F p) l; ^) J5 `) l: ?; [
- char *dmabufsrc1 = NULL;# R9 u( R8 O, w0 y7 [; F
- char *dmabufsrc2 = NULL;
- T2 `- k: i( I - char *dmabufdest1 = NULL; k( D; p" V% e2 n6 `' K" s, [
- char *dmabufdest2 = NULL;
7 V4 J/ q4 G- X/ K$ G: [ - - j7 ^ m& _ v" V7 c
- static int acnt = 512;% H2 E x% |/ ~3 t
- static int bcnt = 8;& z6 B- o! X* n4 R6 J# |: V: F
- static int ccnt = 8;
- c/ v' s1 d. Z* r7 d$ B! D. K - * |6 ~( K, H- V6 a; J
- module_param(acnt, int, S_IRUGO);
. N. B- N* i& x) A - module_param(bcnt, int, S_IRUGO);$ l# D6 i6 {8 c! L
- module_param(ccnt, int, S_IRUGO);
复制代码
* i; D* U( S7 O, Y
3 ?, s" d& q% ?7 E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# \! s" v c. ]* M. L, q' B+ H* rarm-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 p, A: \) q( r7 L1 ^- a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 ~$ q# Q M8 ], q2 X
* k: ]! G2 s5 X, O$ D8 Y) x8 ~' ]* X* k8 V5 u# j* e
|
|