|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % e: C8 X( l. B. J1 b: o3 S
- [code]EDMA sample test application- u# E5 N3 h$ M/ D9 I! C
- /*
% @$ p2 U% A; t# A5 q( f - * edma_test.c4 Q% d6 j! B" d* W3 q- {
- *
/ V2 N+ P+ N# }0 u6 v - * brief EDMA3 Test Application
- r, v. M v& Z& G0 r$ } - * a# _( k' ]$ c5 Y4 |+ l
- * This file contains EDMA3 Test code.
/ n: H' T: S" m# y - *
1 g, R7 X$ B- x: U0 b; h% K( ?+ q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. d: B3 M/ ~! [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 p+ d+ }3 ~2 @$ R# Q% T - * TO CHANGE.8 W- z0 A5 w) N1 Q8 q* `+ Y7 G% \
- *+ N1 X. w! v; j# X) L4 N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: H8 f+ I+ C% Y5 W/ K
- *& G' h& K* Z: l( v4 Q% I Z2 X
- * This program is free software; you can redistribute it and/or
, i6 _5 }2 v1 z) W6 J - * modify it under the terms of the GNU General Public License as
- m E" P1 \1 z% u5 g e - * published by the Free Software Foundation version 2.+ `; W8 H; b/ g! U
- *
- F% O' N' _+ [/ ^* |$ k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 l) L9 i' k9 i, F
- * kind, whether express or implied; without even the implied warranty
. x- u& D5 S% `5 K% j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- y: e4 Q; s* c& C% `; e8 c
- * GNU General Public License for more details.3 [+ v2 j- N0 O& k5 f4 \
- */ @7 E' G+ |4 _+ ^+ Z
- % {. C6 b) x w: F8 u5 y
- #include <linux/module.h>
* n- L6 h& u( s# j0 M - #include <linux/init.h>8 B9 w/ k8 y. O+ U" v, n8 w
- #include <linux/errno.h># k( b& |8 O9 n6 C% [
- #include <linux/types.h>7 e; p5 V0 b) ~
- #include <linux/interrupt.h>
9 _: |+ z* e5 a - #include <asm/io.h>
8 T: E" X: E' A g$ ? - #include <linux/moduleparam.h>$ P6 d( u, v7 o+ J% F
- #include <linux/sysctl.h>! z8 u0 _" a% R
- #include <linux/mm.h>
g: v6 N4 P6 G - #include <linux/dma-mapping.h>
T! x' D* e5 N3 r9 E, I - # j3 d% P& C/ C: `) J
- #include <mach/memory.h>6 r9 S$ T* l) m! A- C% {
- #include <mach/hardware.h>- D! t4 z# u: e1 ~# q% H8 Z6 m% i+ V
- #include <mach/irqs.h>
* X# R8 e9 [0 z, U9 f: g; W - #include <asm/hardware/edma.h>
5 U) m; f1 R$ y$ d# V - 3 { S- E6 f6 r/ [8 S
- #undef EDMA3_DEBUG* f, U& e; D2 N$ w# O+ y0 |
- /*#define EDMA3_DEBUG*/& z8 ?5 z) \' P" d5 K" `. `* |
- * ?1 ?# M2 e1 ^3 @" d4 c
- #ifdef EDMA3_DEBUG
% O& [+ J+ A' o: h4 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) t+ M. \" [: i5 n K) V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& I; T3 } x& Z) B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
F/ r# \% `. j0 A% y8 j- h4 X - #else$ D' r+ B, X* }- i5 \
- #define DMA_PRINTK( x... ) p4 d5 N* O$ t5 E
- #define DMA_FN_IN
/ X v. n4 k; X/ J7 o, [/ r/ B - #define DMA_FN_OUT
2 i/ U( `) f7 f3 z4 i- Y8 g - #endif# {7 s" ^% _4 l1 I, s" P: m
- + l4 M1 v' \' O, ]6 k$ \& R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 y4 @' a& T* g - #define STATIC_SHIFT 3
* s8 ]+ i2 `* ^. ^& n1 ? - #define TCINTEN_SHIFT 205 v ~! i( X6 I2 g- }
- #define ITCINTEN_SHIFT 21
! L5 N* G, v9 G% `1 D1 v - #define TCCHEN_SHIFT 22+ G# v* `# F$ J
- #define ITCCHEN_SHIFT 23
" W1 C$ t# W& d+ T A. p( Y
, U( m0 K" H: N- static volatile int irqraised1 = 0;4 a, J* l: ~/ r+ f: p' ?
- static volatile int irqraised2 = 0;9 x5 h* ^" w$ f5 H
- - {) H6 L9 r( b! E& @3 q. P8 L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) _" B9 ~; E5 [% J( U! h7 G( J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' W( F- }/ R5 g) V: j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ h7 ?" ^' y. W- O% R. K: n
7 h8 ~) d2 F9 h7 ^- dma_addr_t dmaphyssrc1 = 0;' E( Z3 ^: |6 O5 R
- dma_addr_t dmaphyssrc2 = 0;
' G1 m9 [7 i4 `& m# U - dma_addr_t dmaphysdest1 = 0;
4 \4 I% o% V* V, H0 t - dma_addr_t dmaphysdest2 = 0;, u+ E3 F+ Y- K8 P+ ~" w
4 I& N3 q% A i0 T0 _. q- char *dmabufsrc1 = NULL;
- z: d8 T& ]8 V - char *dmabufsrc2 = NULL;
0 K0 J: H- L X5 A8 ~ - char *dmabufdest1 = NULL;
- j( K7 ^1 w! W" i' K1 F' p: n/ l" k - char *dmabufdest2 = NULL;+ ]+ E# I- J1 h' L& k
- 0 }3 y0 Q# q+ z3 b* g
- static int acnt = 512;
/ |0 T) h+ Z8 E v8 T. z, } - static int bcnt = 8;
! ^% |6 @* L, [9 V+ q+ } - static int ccnt = 8;9 q/ g( M0 I- e0 u: E7 W0 }( q7 d
- 9 M* ~! n9 y& {- Q2 Q% M3 l6 ]+ P
- module_param(acnt, int, S_IRUGO);
& m0 U- \4 r6 L5 V$ h" | - module_param(bcnt, int, S_IRUGO);
W) n3 M# F; N& Y1 |& y/ D( i - module_param(ccnt, int, S_IRUGO);
复制代码 2 }0 Z# k8 c3 X: y+ x# W7 m# I
3 t- H/ ` a7 `5 T- P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 H6 d1 U% ]6 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 {& i* y7 C9 R/ V5 B. [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" k0 z' i7 B) z4 z- m9 q2 z8 Z5 i* e5 N' ]$ M
7 x8 A7 @ s8 w
|
|