|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' \$ q6 t* t+ E# e3 X5 l- [code]EDMA sample test application5 `" a8 _/ A& q$ B
- /*: T) S/ I& V3 ?' S% u& f
- * edma_test.c& C% C3 G$ |1 x$ n( b0 S4 o& Z
- *
8 W% h" z- o# y/ P: W - * brief EDMA3 Test Application
0 }3 u6 s5 ~ e$ ]' h, l/ d7 _ - *% q# ]# n! l: g' Q% a
- * This file contains EDMA3 Test code.1 y8 R; h! I. R( o0 n
- *1 _7 Q1 Y( ^8 h7 ^. A. k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 h% X1 h) L1 E% i! }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 N: d; T. V# B. |# r& U - * TO CHANGE.
! _3 D( t+ h" L7 a7 S# {) T - *2 f: s7 o2 N, Q( k4 u' E# d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 u/ B! n3 D% G X6 _# k M! B - *
U9 O1 o6 L1 [* @, s0 F3 J7 J - * This program is free software; you can redistribute it and/or5 l4 q) S0 m2 K: U/ Q2 o
- * modify it under the terms of the GNU General Public License as
) t3 T( w e: i8 ] - * published by the Free Software Foundation version 2.: _! [5 _8 V+ D7 ]& R4 s
- *. }* P! X3 a) }: u |, a+ V% x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, N. q3 G5 u, U0 Y1 ?0 |( D" } - * kind, whether express or implied; without even the implied warranty T1 x+ s6 d4 L" u) t7 e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 o0 o- D& @* U7 R - * GNU General Public License for more details.
: v9 P" j% Z7 y g$ ?. f7 B - */6 `3 B3 T" z# j4 \# |
- * |, s- i f, V$ s: S+ h3 G: Z- C
- #include <linux/module.h>9 q2 U* v) V5 d. ` h2 y+ f
- #include <linux/init.h>
4 N) H$ w# @' Y m' d& ~% v - #include <linux/errno.h>
, U; J* C7 }( E+ J7 I: g. o' u - #include <linux/types.h>1 a5 W1 \8 g( h" ?
- #include <linux/interrupt.h>9 I. _; y- r5 g
- #include <asm/io.h>6 R: I6 c( B8 o% n E7 D8 \) `
- #include <linux/moduleparam.h>4 C4 v5 N3 @, Q- N, j: }
- #include <linux/sysctl.h>3 R0 t" E, c( \
- #include <linux/mm.h>! U1 F" ^" S" Q8 I5 g
- #include <linux/dma-mapping.h>
9 v' Z2 [* m& Z& h. ]4 V4 J' u
9 }6 B! l G* Q: ^' V0 {- #include <mach/memory.h>9 {4 C) P4 Q. l! D3 M' k% ~3 i
- #include <mach/hardware.h>1 y4 p6 V4 i' i
- #include <mach/irqs.h>' p' V: q% t2 d
- #include <asm/hardware/edma.h>
0 p4 ^: H/ B, O. x$ a3 R - 5 c5 y1 B8 G5 v& ?7 }) R* F
- #undef EDMA3_DEBUG
) H3 G+ ?( X1 ^ - /*#define EDMA3_DEBUG*/0 v( S# X ]' e
- " f7 Q9 E* v# {) I9 t5 U+ K& d8 \, J
- #ifdef EDMA3_DEBUG. V5 ?7 P, n; u- g" G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! _) l' O, A, m% t( E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" I* i: n& Y+ q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ v4 A9 n9 b& J; l$ l9 s
- #else
) ?! ~4 z! a+ Y - #define DMA_PRINTK( x... )1 e' Q5 b/ h9 e' P- U+ f/ J
- #define DMA_FN_IN
4 z% T4 f T& S4 |3 f" D% q - #define DMA_FN_OUT
6 N5 i4 C1 s5 ^! e - #endif
8 B$ K& B3 U! v2 L N - 5 i$ p: A3 g5 a. X4 p# Y" t, F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ l6 B+ O' c4 o
- #define STATIC_SHIFT 38 p, ^- J0 `* F- M- K6 t, v# W
- #define TCINTEN_SHIFT 201 s+ W0 K K [1 s4 J. W
- #define ITCINTEN_SHIFT 21
/ X* g9 S' w4 t; C8 k* T3 } - #define TCCHEN_SHIFT 226 T. ~9 M2 u; S6 i. X
- #define ITCCHEN_SHIFT 230 {; v/ [& p; I8 x) t: H, A1 R8 l$ Q
6 j, F4 E4 r( n0 R4 z( V& U- static volatile int irqraised1 = 0;
: F# }0 y% t9 D Q9 H" h4 r) H; y - static volatile int irqraised2 = 0;
' J% N7 G# D( _% \/ }% H - . y9 Q3 V! s( _4 |3 j( ^4 ^! f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ]$ F9 h$ }/ D, m6 i6 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 t. v/ y$ F" H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ P- T1 h7 v/ q
; E: H W3 L8 C0 u; p8 Z4 h- dma_addr_t dmaphyssrc1 = 0;
' \7 I' ^3 R% o% i/ @( g( _. v: @ - dma_addr_t dmaphyssrc2 = 0;9 R& E% w/ z# g7 e5 J
- dma_addr_t dmaphysdest1 = 0;3 p# g; C5 F* g3 G, e M9 S
- dma_addr_t dmaphysdest2 = 0;& M' C4 q( R9 D* o; S
- 5 j/ |' F% w0 P2 b$ X
- char *dmabufsrc1 = NULL;
2 p0 o* @' @0 j; b2 L5 U - char *dmabufsrc2 = NULL;
& Q" a. p1 J; s! \1 N - char *dmabufdest1 = NULL;
; M) N/ @' G% Y - char *dmabufdest2 = NULL;. ~3 _$ V1 T; l1 L' V
- ! p. O0 v) A. Q9 P9 O9 w2 t( Z8 w9 T
- static int acnt = 512;& F) ~$ g7 K7 k6 r( u6 ~: }
- static int bcnt = 8;6 W4 j4 [" ^0 A7 W4 g0 @8 Z
- static int ccnt = 8;7 c) c& ~# @# O) f
- ; B2 P% D- H y, u* H
- module_param(acnt, int, S_IRUGO);
. x' _& H" a/ X+ Z9 q+ O - module_param(bcnt, int, S_IRUGO);4 \& D& a8 P! D; d0 t
- module_param(ccnt, int, S_IRUGO);
复制代码
7 j g) }- j \" k' u+ H& q. n) ^0 o0 U4 P3 J+ x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' V- A5 d* h4 r0 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( y+ X7 z D% T" u2 P7 D8 |& I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 l! G* O6 b9 [2 F- u
' r& [6 N. g5 Y. a* O
. f3 n. U& M; H& s2 b |
|