|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: V& V& w: e* z) S4 p* p- [code]EDMA sample test application2 O2 D9 }1 D( Y- {
- /*1 M$ Q( U" K% A* X$ ^9 n7 b
- * edma_test.c. v( D" J* n& P# _
- *5 F M0 o7 D" Z/ R
- * brief EDMA3 Test Application
. S' I2 b4 C/ c* e5 [4 Y9 n2 } - *
' W7 d' N2 ? p* l* s9 Y - * This file contains EDMA3 Test code.
! X H7 y/ G% M' e+ h - *
6 X' D1 N ^# k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 ]1 }! U1 r. \7 [- E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; j2 i4 w# O. Z7 v% u - * TO CHANGE.* Y3 `2 t, t. v& q4 Q5 o
- *
( {, s% S$ W# A; X6 p D2 K$ s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ _$ ^2 k# g/ S% f
- *
0 |2 A4 I3 v1 Z, i - * This program is free software; you can redistribute it and/or' d# ~) u/ _! v$ s0 M) i& ?, Z
- * modify it under the terms of the GNU General Public License as& T i) x: V7 Q) c! r* r x
- * published by the Free Software Foundation version 2." ^8 h5 j% @+ G. X. b5 w
- *$ i5 Y0 |3 K5 S8 Z- ^' k' H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& O: r' x. k( d8 z% b7 E% A) v - * kind, whether express or implied; without even the implied warranty
* _) d7 |- v) B; V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 z- `# g8 {% l: k - * GNU General Public License for more details.+ O' }+ l; l( S9 h* H: {' P9 ?6 c
- */- w& i' ~: G A a: g
) G% S8 ^6 K( g R& H; n3 D- #include <linux/module.h>$ s- M% C4 j8 u
- #include <linux/init.h>0 S4 D; G$ W! G- L+ f
- #include <linux/errno.h>6 p5 N+ B8 P+ B) U& B+ o; _
- #include <linux/types.h>- P/ S% V8 ]* _$ c$ y/ k. w9 g& j
- #include <linux/interrupt.h>
5 @) Y- I) X% a! W/ |1 [ - #include <asm/io.h>
6 W; h* Q+ R$ l - #include <linux/moduleparam.h>
4 [6 C( g2 b+ K0 m5 w- L: Y" r - #include <linux/sysctl.h>
0 ?3 Z4 b. p4 r1 O! Z3 {4 U - #include <linux/mm.h>, [- z$ [; Q) ]. `5 u* V
- #include <linux/dma-mapping.h>
! p! t3 }" ] g W6 b! \ - 2 N7 d( g5 z" q. h$ F# P7 v
- #include <mach/memory.h>: y4 k4 W, n' @& G5 ~5 d
- #include <mach/hardware.h>% E' C" Z8 h6 R o& `$ n
- #include <mach/irqs.h>2 {) _- y0 |4 w. c
- #include <asm/hardware/edma.h>
" T* l* T( ]9 W- i. Y
0 I2 X6 b8 J# Q' q- #undef EDMA3_DEBUG1 u: s, k: T* s3 d
- /*#define EDMA3_DEBUG*/
% F% u/ K7 F4 r. P
7 ~7 C4 H1 _% M* j. C5 ~- #ifdef EDMA3_DEBUG
7 M$ @" B: k% [: C# D0 ~( B8 x" I! ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ T. C1 ^! ?+ _/ c$ h( } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ r. H: B! z) M* G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 C+ Q! Y2 E, ~* F2 p0 A4 o9 D& g' k - #else; l! m% s% J* a7 U e; o
- #define DMA_PRINTK( x... )
+ l1 Y# c" U6 a5 `' F - #define DMA_FN_IN! c& h5 ^; V( V# B) F* `6 e
- #define DMA_FN_OUT
?. [; G3 p+ l1 s - #endif
) w+ u# d, y& U. O
+ O2 v9 k* X; V0 O6 u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( A7 Q- I. S) p# G, c1 S
- #define STATIC_SHIFT 3) ~% h& E' @" b! s" N O0 T% k
- #define TCINTEN_SHIFT 203 |0 p ~) ~2 _0 h& I" T0 ^
- #define ITCINTEN_SHIFT 21, f4 F) h& E6 s
- #define TCCHEN_SHIFT 22
, f/ }" `% K: w7 D% V2 V5 z. M - #define ITCCHEN_SHIFT 23
# C' x5 S( o2 Y0 `7 ] - + ]0 ^- q; O# a1 W5 K3 y# f
- static volatile int irqraised1 = 0;! z$ H: b1 z" Q4 @; W3 W X7 S
- static volatile int irqraised2 = 0;
5 x0 L) ?* B0 n9 R8 f9 E
3 h- A1 E% \1 ]; {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; T3 n) d# ~% w# o) R: T# S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' W5 o# `. {$ w8 \& f% R" x5 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ?5 u6 ^+ }8 X1 C - + T8 c. R6 C% q' d6 I4 C, M5 u
- dma_addr_t dmaphyssrc1 = 0;# _9 t/ K6 d4 ]5 c4 C+ X
- dma_addr_t dmaphyssrc2 = 0;
1 H. }5 J# E6 v1 H# Z - dma_addr_t dmaphysdest1 = 0;8 a7 ~, x2 F! F/ J- _7 G
- dma_addr_t dmaphysdest2 = 0;
" M0 F7 X* ?$ ~ - 8 o, g1 v! w. Y1 ` Z
- char *dmabufsrc1 = NULL;
x) D0 ^8 } A4 i: g+ h8 I4 E; w5 d - char *dmabufsrc2 = NULL;
1 v3 V" G# `9 b: C. A' w( d, ^ - char *dmabufdest1 = NULL;
( m/ [; p( s. N. R& ] - char *dmabufdest2 = NULL;
: P5 F' _$ e x5 S l) S
8 o; o& A. x' h2 n4 p( a, m- static int acnt = 512;; N. k+ \* E4 i
- static int bcnt = 8;
; [: e. h$ `# L: ~1 s, Q) { - static int ccnt = 8;4 j6 C, G& M# S9 G% [
( n* }: n9 D3 p- module_param(acnt, int, S_IRUGO);
; h0 h5 _, ^6 ?2 u6 h - module_param(bcnt, int, S_IRUGO);
; |% A: _) v6 r4 }" w* | - module_param(ccnt, int, S_IRUGO);
复制代码
. m2 u# D4 t6 M! X1 d+ x! g3 u: b5 h( h/ z( a2 y5 c2 A, e- _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) r# x1 T7 y2 E' tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ ?9 S$ k9 a2 m( k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 {0 s3 x/ |6 M
, v' ]% P) J, i- _' H
: l* {' O/ P) D/ P3 X8 C |
|