|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! `) ^9 G) q& C) B- [code]EDMA sample test application5 u( C! r- R' [2 q5 P* g h$ T
- /*
- z$ N! e$ @6 L8 r - * edma_test.c
8 z- w5 U- z" y5 H9 o0 ~4 u' I - *
# T1 H2 M7 k5 A2 q. c7 q5 {8 ] - * brief EDMA3 Test Application
: ^9 N2 C( {. I% R# _ - *
5 i( k- f9 [2 l& i* s - * This file contains EDMA3 Test code.
: [' S& \# r7 t2 N6 Y. v - *& v4 ]# S' f* Z* e! ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( k" a+ t! @; e% i- `0 O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& N5 Z. {2 c. c( z6 e* p, J - * TO CHANGE.
) {( e7 @/ f @- @ - *% u1 | ]5 p+ V0 B C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* h7 X5 v6 i9 U! y) ~5 l
- *
6 B1 O7 q% h0 W; D5 Z' w - * This program is free software; you can redistribute it and/or7 V0 H4 N- ^( z5 i
- * modify it under the terms of the GNU General Public License as, U' J) h$ T% y# W7 L4 A
- * published by the Free Software Foundation version 2.! r& Q$ O2 u2 M- }# D
- *$ u+ E3 f% C! P' @! z8 v8 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 f3 ~- ^2 d4 ]& q0 ^7 z# ? - * kind, whether express or implied; without even the implied warranty( c3 m8 n- ~) }! `& r; q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" z/ r& w# Q2 j! ~4 |5 k+ B9 V7 Q0 ^
- * GNU General Public License for more details., K0 s% P: T9 i* G( {+ v' `
- */
9 v% u% l3 Q) W, N+ V - " w! t/ v( C6 t( I
- #include <linux/module.h>
* |0 l9 v: n) s - #include <linux/init.h> x3 z% H, v7 y( _$ u# u8 |* o
- #include <linux/errno.h>7 ~0 z. U: T, X6 r" J6 x
- #include <linux/types.h>/ b, U; x4 }/ A# m h" U4 n
- #include <linux/interrupt.h># `! l- H2 V& u+ p) L3 R
- #include <asm/io.h>
. L, ~, n" N/ @1 a: ~) P0 | - #include <linux/moduleparam.h>. d/ }! O4 g! v: k. e( C+ h: X9 K
- #include <linux/sysctl.h>
J9 | l* p9 i/ a8 o/ O/ n6 D& [ - #include <linux/mm.h>
: h0 a9 ~& P3 ~* G$ @3 X. a - #include <linux/dma-mapping.h>
3 y6 ]+ Z$ ~* D$ v
v: H. C8 K2 |$ ~- #include <mach/memory.h>' F5 t0 e' m3 H' p+ z
- #include <mach/hardware.h># r7 Z% u/ X( `: r# m' c+ I
- #include <mach/irqs.h>2 N- W+ M. F$ b, m/ B
- #include <asm/hardware/edma.h>
5 ]3 v9 ^5 p" c! I+ f
' \% y' w/ T7 ]! d- #undef EDMA3_DEBUG1 |" z( M/ T% h
- /*#define EDMA3_DEBUG*/
2 k, R( B4 \- N2 \7 \9 S0 l - - t3 Y7 F! _( Y0 _) p1 D& q
- #ifdef EDMA3_DEBUG2 E4 L2 z! T% P) X; [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 ?; r; ]" w q2 g% v: p) _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& P1 D5 p7 p& ?9 s' E! C- Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 J: r; }' ]$ r - #else% l" z! D/ _+ z2 C* @! q0 G
- #define DMA_PRINTK( x... )
- V# C$ V& x. }- k! O - #define DMA_FN_IN4 C; a: ]/ \& K, A+ _' l9 C
- #define DMA_FN_OUT7 T# l1 R7 F. @7 U
- #endif1 t* D. l* ~* l! f! F# M+ W$ Q
- $ A. N" ^) g) [( T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. r+ i- { D9 [7 d$ @! A - #define STATIC_SHIFT 3; J& d/ ]6 F8 R3 K" a
- #define TCINTEN_SHIFT 20( \! y2 _3 z9 z' C. Q2 e6 F
- #define ITCINTEN_SHIFT 217 J% ]7 A( z; q
- #define TCCHEN_SHIFT 22
5 n+ b' j* e% E0 S4 @) K - #define ITCCHEN_SHIFT 23" E& h3 m! H& a9 _5 i8 e% t
- 2 G2 t6 Y8 L" H) D4 m v
- static volatile int irqraised1 = 0;
6 u' O0 m" U# Q: g4 y; D1 l - static volatile int irqraised2 = 0;6 {2 d9 f3 }4 S/ V" g7 R' X
- $ Q( \, O8 D5 d9 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ R5 L/ C; S. r7 @7 ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Y2 I; v1 q' T! p# j2 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# N; c1 i3 q t* K* C, u0 ?
% ?7 Q- k' S3 ~% i- dma_addr_t dmaphyssrc1 = 0;: i$ ]6 G2 l8 c* T, W) L
- dma_addr_t dmaphyssrc2 = 0;& H" {3 U' I1 v5 O% \! E% F
- dma_addr_t dmaphysdest1 = 0;% T' Z6 w4 Q7 P( a! g! H
- dma_addr_t dmaphysdest2 = 0;
' ~" A9 c7 E8 A$ R9 w
8 ]2 w$ I. h, e% F- char *dmabufsrc1 = NULL;7 a/ F; i; A& |7 f
- char *dmabufsrc2 = NULL;; I9 e% f/ R g9 q2 e6 {6 [
- char *dmabufdest1 = NULL;' T' T4 V1 F c* x6 n' `; [6 C+ d
- char *dmabufdest2 = NULL;
( r" ]& \; A! }5 i
; ^2 d9 ^. Z9 B' R" d9 s4 z1 e- static int acnt = 512;* |+ @& j! N, `6 c! I1 ~0 g% U8 `
- static int bcnt = 8;
7 h: S, `4 G7 Z2 _ - static int ccnt = 8;5 T( V3 T5 ?0 H+ J- D
- 1 x: g/ `4 i; _! s4 S6 z
- module_param(acnt, int, S_IRUGO);. f3 q. Y7 x$ F" W& s
- module_param(bcnt, int, S_IRUGO);
+ }$ L. ]. U( n5 i - module_param(ccnt, int, S_IRUGO);
复制代码 8 J' N, l1 G7 n% q$ L
4 q# q& S2 [% T7 K. g, c6 y5 @5 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, H/ `, F+ B$ Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
t# S- r% }, x. B! r3 B @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" Z& G% R6 @1 M" y. h; p
4 V1 g5 \; C3 U4 M$ t* s& g
$ o+ g, ~. B6 b) p |
|