|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - C0 ] `. g" Z! T: T. N2 m
- [code]EDMA sample test application& B; z: h4 @# M
- /*8 U9 x3 v' y9 S2 Q
- * edma_test.c! M7 A1 X8 y/ u% L3 g: I6 t: c. e
- *
- ]& w2 I# ]. N: S4 {. s0 ? - * brief EDMA3 Test Application
, o6 s7 {) P* `, L - *# }) T0 @: Q K& Z" X {
- * This file contains EDMA3 Test code.
3 Q. m1 ~/ X9 y% j$ L$ e U - * S$ r* O, n. z' f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 s7 `% Y; s4 s% R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ C9 U, L" w( T9 o
- * TO CHANGE.
# X( T7 G7 x# F4 ~+ y1 c - */ G' P. x0 j1 N8 _! T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; C, v; l P* n3 u - *$ u4 R2 O* \0 B# h+ K; ~5 D+ M
- * This program is free software; you can redistribute it and/or
# B7 C- `+ V7 ]4 K, m. R - * modify it under the terms of the GNU General Public License as) G: q* Z# L6 x6 P# M# H6 I p6 k. W5 w
- * published by the Free Software Foundation version 2.1 H1 G3 O3 W2 {0 P' j& l
- *
+ f0 V! ~, N$ j! \8 P/ V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 K) I, Z; A: Q0 o+ s$ {; ? - * kind, whether express or implied; without even the implied warranty! r8 _# K1 L1 v2 F9 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% P5 a2 g$ k2 k" r9 V
- * GNU General Public License for more details.: c( D" K x) g1 k
- */5 l* T# ?5 ^& n: T/ `
- 3 y# }+ h4 e" @
- #include <linux/module.h>
2 r% q9 k0 B3 b0 @) A! H - #include <linux/init.h>! l% q/ K: e6 n' V1 W8 g
- #include <linux/errno.h>
8 r0 j6 `8 Q7 H* N0 M; j - #include <linux/types.h>$ f+ d5 d- S' @" D& j
- #include <linux/interrupt.h>
1 m1 S1 J5 E* T O! a - #include <asm/io.h>, @* N9 E9 a3 f1 w. [/ M
- #include <linux/moduleparam.h>
4 }, ~: q- V4 S2 O - #include <linux/sysctl.h>
i% O- z$ [! d2 C8 y$ h+ J - #include <linux/mm.h>' T0 {& V& _4 T$ j
- #include <linux/dma-mapping.h>
: M; q. M, L) Q2 A9 m - 4 b7 P' ^0 T2 Y
- #include <mach/memory.h>
% t% N: l" y1 z( i - #include <mach/hardware.h># Q. ?* Y/ a- Q+ ?% ~
- #include <mach/irqs.h>
* E& k1 F3 v0 I4 `" ` - #include <asm/hardware/edma.h>
; V& s0 U9 ^! X! Q% d1 e - P- i' U) n' I! L1 U/ b) u
- #undef EDMA3_DEBUG1 ~0 B* N2 o; b
- /*#define EDMA3_DEBUG*/
' w3 w9 g5 J& `$ H5 R* F - ; X9 U3 q* \; d& Y- H+ G @; e4 z
- #ifdef EDMA3_DEBUG
% w$ p7 U; a' @- U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ [' l2 @3 X7 k6 t! N( D' ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 }( K; r* s! f0 C/ R( A1 t$ | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. d4 x) t! F0 d1 x: v - #else- X4 R8 t# T0 @7 a8 K" c1 P4 F
- #define DMA_PRINTK( x... )* K0 `; m& C5 K: D0 J3 I
- #define DMA_FN_IN$ q7 |2 e, o) K! Q6 n
- #define DMA_FN_OUT" X+ K8 Y. \3 e; G! u0 T
- #endif
M# a7 o" \0 T: P7 u% B
% k: h: t/ S" S7 G3 `' n8 y2 f' o- #define MAX_DMA_TRANSFER_IN_BYTES (32768). G: [* R7 U- G9 g9 W' e1 T
- #define STATIC_SHIFT 3
& G* S; w( T$ k/ K" h6 c# S - #define TCINTEN_SHIFT 20
) b* c1 d2 j5 F( N3 c" E - #define ITCINTEN_SHIFT 21, b; s+ Y# s- L% C. L8 `& P0 {8 ]
- #define TCCHEN_SHIFT 22
" d/ c- c; o7 b - #define ITCCHEN_SHIFT 23
" H6 t3 G' G( _ - - a1 P8 J7 b0 w# G0 F' E
- static volatile int irqraised1 = 0;
. L* S9 b3 V) x/ L1 d& U3 J$ b( W - static volatile int irqraised2 = 0;! T8 U8 J3 j$ z4 U9 g7 V$ ^/ a
- : S. {* U/ z3 e {8 r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, H; p- S4 j" c( } Y& a+ z, d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 s9 G4 ^7 w8 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 h; S7 }9 j# i
9 z# `( r/ c! E- dma_addr_t dmaphyssrc1 = 0;
; c8 y( ~2 {- l" R& Y' J - dma_addr_t dmaphyssrc2 = 0;
0 s M& Z9 m M. x - dma_addr_t dmaphysdest1 = 0;4 j; u# @! o9 e' L7 |) P/ ]( h
- dma_addr_t dmaphysdest2 = 0;
2 P' N N* S# u$ R - 7 X8 p6 ^9 \; \2 X/ W2 L
- char *dmabufsrc1 = NULL;: h2 Q* k7 }8 c9 {. x5 H f: R
- char *dmabufsrc2 = NULL;7 n3 u" F2 @3 P- o
- char *dmabufdest1 = NULL;6 o8 C0 S9 v0 J& j+ E* f0 B7 w: S
- char *dmabufdest2 = NULL;
p8 k4 O- x7 q* ~1 G# [ - x- R) P) g& y2 j; K! m
- static int acnt = 512;
1 O, s2 r' s c) N* P0 O+ D8 F - static int bcnt = 8;
7 q/ ]0 H [9 ?7 k/ ?* ] - static int ccnt = 8;
+ G2 ?- J. m; |( X+ u+ I
* z* q( I: q) |/ V; h- module_param(acnt, int, S_IRUGO);
* x8 a/ h5 f2 u- |+ g' F' y - module_param(bcnt, int, S_IRUGO);
- w$ E7 [& X) m/ K& f - module_param(ccnt, int, S_IRUGO);
复制代码 ; Q9 ~- H: V( F$ Z. W7 S9 P5 k! y
- }" q" v8 Q. t4 F2 l. ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( h" J/ c+ u0 t! P3 p" i- Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ m, H) G4 M9 n- P- _' S; g9 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ C. {7 _' q: A. y
7 O0 N: }. Q& C3 E
1 h; u2 i* Z* ?, H L( F |
|