|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 e8 O) W. i. j& f. u2 F% r1 K
- [code]EDMA sample test application
d2 C1 Y5 @) |* ~* T/ \) Z3 A - /*
6 t* { R/ W/ `7 V9 Z! R o - * edma_test.c
9 W1 k: C& o. y. t, F- _- V/ k - *
9 D8 H3 e1 g5 G* ? - * brief EDMA3 Test Application
( A/ A6 d3 N/ t/ m - *" F; G# Y2 Y% n( R' V
- * This file contains EDMA3 Test code. N% g" `: L6 _' Y# U4 Z
- *
$ S* h/ W, X3 I7 h/ h2 G/ c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 L; C2 t2 ?! N" i- O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' b, C+ ^2 n) L- w# C - * TO CHANGE.
, g6 o# x% a" ? - *
* f8 j" y2 M0 z/ j0 B1 L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ p, R1 ?4 Q" @ - *+ I0 E$ X+ Y8 w
- * This program is free software; you can redistribute it and/or
4 C: _4 c" g' a9 Q: I* s9 T+ Q - * modify it under the terms of the GNU General Public License as7 J% ]. C/ `3 n& T
- * published by the Free Software Foundation version 2.
$ B! J2 }' c/ B0 E: w7 B: S - *& D( S' O1 }" }/ ~* f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& V: F v& m& P& l8 C
- * kind, whether express or implied; without even the implied warranty# _* A2 l8 Q9 {, q+ Q/ m6 {$ t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& z# j; N- _: g# C% ?5 f6 e0 O( v# z
- * GNU General Public License for more details.
& B( e0 w9 p6 e* {5 H( L - */( Q1 _. X) m( y, g
- + `$ U+ n, a7 K2 f) q. G" O+ y
- #include <linux/module.h>5 ]) a5 Q* O* C. z6 f
- #include <linux/init.h>
! U* i+ j0 A) d: I6 D4 F4 M - #include <linux/errno.h>4 i) J0 J) b9 ]/ y) H& g7 X. U
- #include <linux/types.h>$ {; a' y* g7 m0 k/ ^( B# |4 ^
- #include <linux/interrupt.h>! R" ^; E0 @$ m. `6 o
- #include <asm/io.h>
+ o; {2 ~ J4 Z5 q/ ?; L, s - #include <linux/moduleparam.h>
* P( r. w% P7 A$ w5 a, `' y& k - #include <linux/sysctl.h>
5 x- N! r+ z1 u - #include <linux/mm.h>
! y3 X3 r8 ~0 v% o0 u - #include <linux/dma-mapping.h>
! R) o$ W$ N% J, p \ - 9 `$ @2 @+ m8 ]( T* g
- #include <mach/memory.h>
+ V6 n6 F9 V" r2 s- {& j - #include <mach/hardware.h>
% d) I6 V- Z2 J5 E - #include <mach/irqs.h>9 N2 W( i! S9 m3 c9 S
- #include <asm/hardware/edma.h>
# K1 X$ k" z. Q/ U. _# o - . D2 R* p3 _' t( b
- #undef EDMA3_DEBUG
9 S% Z1 U, _' s$ P - /*#define EDMA3_DEBUG*/
5 S. ~: f* Y7 `+ J5 `
* M$ g) E9 f' W5 q& t$ X: |- #ifdef EDMA3_DEBUG6 Q8 U+ ]- a, h: a" ]* w# R8 {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 f) E4 ^7 s* k _7 D0 `' c: d: \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 v8 C `- e l- c8 X4 X6 w3 z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 G' ?! D; z, W9 Q/ d
- #else: H; R9 P7 W H+ \. \6 f8 ]
- #define DMA_PRINTK( x... )
0 H# r0 k2 \# P - #define DMA_FN_IN5 O5 A9 L' P9 C1 F% ]
- #define DMA_FN_OUT
/ }4 D7 t7 U+ c8 E& l* y - #endif. o& Z% Q9 f8 s a' G
) e4 U0 j/ x# j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ e5 a8 h" E; C7 @, j2 n - #define STATIC_SHIFT 31 ~& H9 v/ G6 S# p& q
- #define TCINTEN_SHIFT 20, c: n! q6 {: C. i5 W
- #define ITCINTEN_SHIFT 21 l, p( G; e" m+ d
- #define TCCHEN_SHIFT 22% n9 q' y0 c/ R: w' s
- #define ITCCHEN_SHIFT 23
0 Z7 F) o" ^- ?/ { - " [( w. d$ X) G7 T2 c$ K6 F
- static volatile int irqraised1 = 0;
% S" z6 G3 S6 ?( y% S. [9 ]; s( z - static volatile int irqraised2 = 0;. U" N4 h( g$ ~& L( y
3 C% {3 g" L- C+ t% T; m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ P# T* U9 C" |& |3 j; \) e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& P' h& N% h9 m2 D9 k( o% H( A* O3 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# |* c- y% x! |
( [& x* g x( W- dma_addr_t dmaphyssrc1 = 0;5 s& I4 @4 Q, l- ~. X
- dma_addr_t dmaphyssrc2 = 0;! D2 a5 e: J. p) e/ v
- dma_addr_t dmaphysdest1 = 0;
) Y0 Q( P. D! i9 ~( ~. W - dma_addr_t dmaphysdest2 = 0;) |- c' I1 m" M2 H0 x8 ^, J
. r( r9 t; r9 \: y& h1 u: o7 \- char *dmabufsrc1 = NULL;
$ |/ A8 @" n5 y* C - char *dmabufsrc2 = NULL;
# R4 q7 x: M8 A4 U - char *dmabufdest1 = NULL;; v" ?" h6 y! {+ k! }" R8 `" K" U
- char *dmabufdest2 = NULL;
2 G7 e4 @9 t/ `( g
0 A g6 q4 I- V# m- static int acnt = 512;
( `7 }5 l) P( D( R$ x4 o - static int bcnt = 8;
, K) `! r' V* ?- j. K7 l3 v' Y - static int ccnt = 8;
$ ?: |. y8 o% p6 K# S: Y- N
4 F& a" e" N: x, _4 q- k/ J- module_param(acnt, int, S_IRUGO);# ~1 X+ q, J5 Z6 e' Y
- module_param(bcnt, int, S_IRUGO);
# {8 C/ G# M! b: ]* H1 F - module_param(ccnt, int, S_IRUGO);
复制代码 : a+ d. s0 |& ~2 s7 P
0 z" X4 ~! e4 i9 A( A% G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* f1 L0 o4 P9 C* r0 R# C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 |' T/ }1 ^0 @6 e* I; r( M" |: |- A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' u& Q2 [8 ]8 B4 k' ?/ _
. d- t) q* m2 U. Y g1 z. R
* a# w8 j8 J) @1 M4 K* Y3 u |
|