|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 s) G/ l( i8 e# M( d1 z* t
- [code]EDMA sample test application( f6 o* M I, u
- /*
( z4 U6 f2 r+ ~! [0 O - * edma_test.c6 X% }! B: @% J9 e
- *# o' d$ j+ j. Y# t i {
- * brief EDMA3 Test Application
$ i3 U' K f% n V4 h( @ - *
, |7 e) `: [% j, i% [ - * This file contains EDMA3 Test code.
& h' S6 a X! }* V: } - *2 v ^9 d) O- X% ?+ I& C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& d. N L6 X4 x! S3 n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% x5 j% ~: u7 W! g - * TO CHANGE.' J0 D6 }; [2 y! c6 g9 w* G
- *
- U2 h" B3 h8 ^* m1 O) |' ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, H" L. j# u9 L( S7 R
- *8 s5 T% q8 O, H4 F( p- |
- * This program is free software; you can redistribute it and/or. R) z( O9 c1 j1 @
- * modify it under the terms of the GNU General Public License as; V" [' ], h6 \
- * published by the Free Software Foundation version 2.: Y! Y! w# K$ d! B" O% F
- *$ c; n) D. v* o8 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ _3 P8 B1 _+ ~9 R$ x$ }
- * kind, whether express or implied; without even the implied warranty }; q( e# E/ ?% p: d9 i9 \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the U+ B V$ _9 C8 @/ ~$ W' ~" ~, K0 f' P
- * GNU General Public License for more details.
* z0 V7 R/ s9 j7 \ - */
6 H2 Q( E2 H. u2 A8 O2 F% i
7 v8 `, k3 l2 d) b- #include <linux/module.h>
% Q8 ^" j' f0 w# p" p0 R( A - #include <linux/init.h>
" g9 T" r* w9 M1 s0 K - #include <linux/errno.h># K5 U# t" {' ^- P# X3 a3 V
- #include <linux/types.h>$ w) a5 C: f9 k' C
- #include <linux/interrupt.h>
4 [+ H0 M8 E( q' A0 a - #include <asm/io.h>
+ Z x# e) _. ?1 @* q2 v( N - #include <linux/moduleparam.h># T& Q) }9 i: x9 [ a- |; Y! E& ~
- #include <linux/sysctl.h>' v- j4 B3 y h' R$ T# [
- #include <linux/mm.h>
6 R+ I9 Q4 l5 I% J$ u* A - #include <linux/dma-mapping.h>
3 W" f+ n$ [4 c$ }) b0 [9 q
# J/ w" W% q9 v- #include <mach/memory.h>
: V& @+ H/ ^. }+ ^: K0 m, J* g4 W - #include <mach/hardware.h>
. e# v/ U) n p& W$ |7 \: G" s - #include <mach/irqs.h>
) s5 }8 Z/ i3 V- Z4 ?; ~ - #include <asm/hardware/edma.h>
& R, A( J9 U( {, G1 k7 |; `( C) }
* n$ K+ |/ k/ `( b- #undef EDMA3_DEBUG+ ?' D( w0 a# U
- /*#define EDMA3_DEBUG*/3 ?! M/ D) O3 g2 p
- 3 J/ k- s8 s& ]+ |/ [
- #ifdef EDMA3_DEBUG+ A2 H+ v8 M$ U) O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( z: y5 r5 b8 a" P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 J3 L8 c1 f3 n$ {3 h! I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& j0 k* p! [5 t/ C$ I+ }
- #else7 }$ S5 `8 b2 K Y) i2 ^) X, q4 y
- #define DMA_PRINTK( x... )
" c9 r* e. E- @7 F7 m/ p# h - #define DMA_FN_IN1 E# P( A1 x) I9 `
- #define DMA_FN_OUT
$ g. L: _; g" z k1 x - #endif& B1 I. z$ h6 s) C- I( f
- 4 q; | w% p# O0 Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% \; G/ G4 R. s5 G+ e4 }$ a
- #define STATIC_SHIFT 3
$ t& J: W1 H$ y; A1 W% E( P - #define TCINTEN_SHIFT 20
/ J: h' ?3 @% I( I3 `: M - #define ITCINTEN_SHIFT 21
- C( U1 q0 ^" u8 v6 V7 b; p - #define TCCHEN_SHIFT 22
! F, M3 n, }; s/ B% v! d - #define ITCCHEN_SHIFT 23
0 I( Y0 }* ?. X1 n
) |0 K" k. h9 u' w$ e4 Y- static volatile int irqraised1 = 0;$ r: B. j5 n% `( h$ u" z5 a) k
- static volatile int irqraised2 = 0;
- p) e* T* [$ ]( ?3 B* s
5 l" C0 m, E% ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ~! ]8 }! L" g- m6 X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 |" _, x- v! l2 U6 a9 m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 k. t( H1 a# y8 P) J+ v
- & S5 i+ u! K" \8 Q3 i' ^, b
- dma_addr_t dmaphyssrc1 = 0;
' B4 S7 a$ A/ N - dma_addr_t dmaphyssrc2 = 0;
# a# d5 [' r8 W% Q2 r - dma_addr_t dmaphysdest1 = 0;
7 B: J+ Z9 ^: M- ? - dma_addr_t dmaphysdest2 = 0;
3 l( X @ E' o! R- `! v0 {$ v3 [
: g5 g' T; n9 F: d; W% m% u! p- char *dmabufsrc1 = NULL;
& K, s# W2 w$ I, x: K! r0 i - char *dmabufsrc2 = NULL;
5 f6 Z4 T h% R - char *dmabufdest1 = NULL;7 P( J% M3 P9 }! Y6 k+ ~
- char *dmabufdest2 = NULL;
% r0 Z# V' X+ ?( X
7 ?+ \- K; e' p- static int acnt = 512;# T/ x% {$ `; \
- static int bcnt = 8; h: S ]% [4 N$ g6 _
- static int ccnt = 8;
; L, y- c( A. e/ I1 a% N) c/ Y0 m
) Y+ l% H& g2 n7 T# o; D! K! J- module_param(acnt, int, S_IRUGO);$ j/ I+ F N4 }6 H! ]6 L* c
- module_param(bcnt, int, S_IRUGO);
' B! Y' E' V) u. P - module_param(ccnt, int, S_IRUGO);
复制代码
5 K) {3 E3 C" E! \, k( @
# b. l8 u" k( f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 S1 N& K! i, L7 b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" U; a" V: G' R8 J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( k+ j; v, w! R( U. c, J: r- N9 _
; x# ?' K! \$ |0 T& e# q4 ^& F; k/ u3 \3 g: `/ p
|
|