|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 d8 n0 i) n8 ?- [code]EDMA sample test application
9 a/ A2 s' s2 U! n" K - /*
( Y) t! x. \8 `) [( D$ m+ D" ]1 `3 [ - * edma_test.c4 [9 \; q, M- F4 b- S3 v' f
- *$ F3 f1 G$ M5 a( X
- * brief EDMA3 Test Application
' O0 {6 I* P( ~+ O& s1 O1 w - *7 ~1 f( i( O" w1 R9 U
- * This file contains EDMA3 Test code.3 `8 X% z J T8 |. [5 Y
- *
6 X) k) q- y9 K1 }3 R& t8 | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ~& X* A1 H7 s3 L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 D. K- W& a3 I8 q5 Q k# y - * TO CHANGE., {. Y* J M6 E8 D# ]8 O
- *( {7 o' R, k) i+ [) B1 y$ d/ y# ~' m. @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 \3 p9 p% ]8 l l y3 S: |% H s
- *
# c. e1 e. A# l' e1 V - * This program is free software; you can redistribute it and/or
3 k0 K, h$ q& x6 ?1 Q: ^ - * modify it under the terms of the GNU General Public License as
" X: p+ a& Z6 X, b- { - * published by the Free Software Foundation version 2.
8 F, G2 G9 W3 U Z ~( W - *+ i: X8 x5 b# |; y! c e- S7 T% i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, `/ ~. I- U6 n* @
- * kind, whether express or implied; without even the implied warranty# N0 j+ J5 p8 H; z2 _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: R3 W9 |6 }. ~! p! i/ ^% B6 b
- * GNU General Public License for more details.3 a6 @! l; K4 T" j! F
- */
! r! J5 G5 B5 J9 e6 k0 u* v8 T
9 y9 M- |& X8 U# s' r9 i5 v, i- #include <linux/module.h>; X4 v' J- t" U4 I
- #include <linux/init.h>
$ b' h1 e5 B+ W% [& k9 { - #include <linux/errno.h>; l8 c7 F6 v+ ? v- P" d. \4 ^0 u) f
- #include <linux/types.h>
" i7 |7 q( _; |; q. [ - #include <linux/interrupt.h>
% V. Y x" u! y4 i: D4 Q - #include <asm/io.h>: M; d* J* |2 t4 \' q2 s5 S/ o
- #include <linux/moduleparam.h>
; I6 F' j) D9 I$ L - #include <linux/sysctl.h>% B" |/ Y C9 h2 d6 U- B
- #include <linux/mm.h>
1 h+ _. `5 X- x; x: `( D - #include <linux/dma-mapping.h>% N& M7 {2 e' n) g
- 5 B- _2 q; v6 C y* s% I- e) P
- #include <mach/memory.h>
! d1 w. w. z* r - #include <mach/hardware.h># g$ c4 Y- }5 G# B' `+ t
- #include <mach/irqs.h>$ b+ C/ h# k. m, [; a
- #include <asm/hardware/edma.h>: h! t$ G! \; }
; p8 _* j6 J, B! [! s6 a- #undef EDMA3_DEBUG
* C3 o" X4 d4 D/ B - /*#define EDMA3_DEBUG*/8 G7 g+ u& v) R! G$ H9 T. d
% n0 B4 C' Q9 m9 M& p7 w% Z6 x- #ifdef EDMA3_DEBUG
6 F3 t$ E# x% `5 ]" c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) L: i( w3 ^* Y! n3 Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# ^6 n4 y" O& T3 o7 J0 N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 _! R: S% Q% D. G
- #else
4 A# ^" @( Q) m1 O3 _/ E" W - #define DMA_PRINTK( x... )
; _0 E$ f# b6 @6 Z- H; n - #define DMA_FN_IN
, Y; e+ l1 r* V - #define DMA_FN_OUT
5 s3 ^! K& A% A5 ] - #endif: M. Y) G+ a' J+ \4 K
: P, d+ z5 X1 m, C0 |2 [3 ?; I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: w- p |1 d- M# F w - #define STATIC_SHIFT 3 W7 ]. b' j3 `) {# Z
- #define TCINTEN_SHIFT 20
/ S# |. h! E: ^* R% m, E - #define ITCINTEN_SHIFT 21
7 m+ w' j, v! E: E6 x% A - #define TCCHEN_SHIFT 22" Q$ [& ~+ e! N# N" d
- #define ITCCHEN_SHIFT 23
! ~ T( M: U0 y& V1 C/ G
r( Y; }- o& {' r- static volatile int irqraised1 = 0;8 Q* T) Q' [6 ?' w
- static volatile int irqraised2 = 0;4 f# C: H# Y5 Z
- 9 |' Y! }+ y- e; T0 n& x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' L4 y/ ]- J. r; h: Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! u" m, B, H* L$ @- J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ~) a% \: \2 G- @! g% h, o3 \
9 ~. R1 [9 z' [2 K- dma_addr_t dmaphyssrc1 = 0;# Y& i4 Y- U: w
- dma_addr_t dmaphyssrc2 = 0;% |! X, ~7 R. i$ y2 Y- \2 C
- dma_addr_t dmaphysdest1 = 0;" j9 \9 r7 h% {1 f5 ~
- dma_addr_t dmaphysdest2 = 0;9 O2 j5 a0 i% I+ M( W9 \# }
( C: L7 S) }6 j' Q- \/ j- char *dmabufsrc1 = NULL;# | o. C# b9 f2 ^
- char *dmabufsrc2 = NULL;# N3 [" Q {) G- A; B; G( z# `% I$ M
- char *dmabufdest1 = NULL;, m. z5 |4 s3 o; _& t
- char *dmabufdest2 = NULL;9 M0 _& s, A+ a; E8 b I& p
- & x3 ^9 N) t/ T0 G5 ^) M
- static int acnt = 512;# i, e8 l" M7 t! o5 P6 W
- static int bcnt = 8;
/ Y9 [: v* O- L% x - static int ccnt = 8;
3 s" x7 I) Q! ^' O p! o - 6 b7 I8 {) r6 i3 }1 `6 I
- module_param(acnt, int, S_IRUGO);# y# S4 b" ?" |) V H" v
- module_param(bcnt, int, S_IRUGO);, x5 i9 M6 U$ q: X
- module_param(ccnt, int, S_IRUGO);
复制代码
9 g, y) n! A7 h( c
, w0 _5 u+ i& _2 A/ D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. ?5 T; S5 Z8 y2 ]& Q8 y0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( e( g: ^3 r0 `5 _0 S3 X* M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 j$ J9 |7 J8 }# S6 e+ a
% u. p# F% `6 |
$ O, I6 E6 F$ [5 e6 n$ D+ o$ p |
|