|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! T" W! \/ e3 z' e" \ m- [code]EDMA sample test application$ b; d; w- E, j }
- /*! m" x% W9 q6 j+ q
- * edma_test.c
7 l+ U/ H5 L9 m/ Y/ s. l: K; ^ - *
. U- o$ Z# H) Q% x - * brief EDMA3 Test Application
% ^, {! C4 K" `* n% ] - *
8 F( X" i6 s# b) W3 R$ {6 y - * This file contains EDMA3 Test code." p2 u3 o* N, l" b
- *
* O& U! |7 K( c: ~2 G" T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ I& w9 V0 T& Z* E F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 C* X8 l, W/ v) \ [ - * TO CHANGE.
" }' t- c# W$ ]% d - *5 H5 |) c6 V; D# p3 o+ {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 l, j& A2 ]: m' |! ^6 x - *( h: j1 D% \7 U }7 _
- * This program is free software; you can redistribute it and/or
! U+ C A5 c1 O/ y' q& ? - * modify it under the terms of the GNU General Public License as
( G; t& L y6 ?' ?! o/ w - * published by the Free Software Foundation version 2." ]3 B/ e5 d) D5 R" f
- *
/ @$ h2 A5 c* Z+ ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; v$ k" Y3 c& R
- * kind, whether express or implied; without even the implied warranty" }$ B% M( S. d# @/ K3 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, l; c5 w, a: y5 j: G8 G
- * GNU General Public License for more details.! Z2 V% N- ]" o
- */
; v C; a4 [. ]; W. y- p3 O - : Y1 ]2 D$ {- S
- #include <linux/module.h>6 ~) ]( [$ L& G) c' j6 o7 u+ Q8 d
- #include <linux/init.h>7 u3 [0 `( ~6 T$ b
- #include <linux/errno.h>
1 W( G0 |$ ]; q: I3 Q c - #include <linux/types.h>. U# x: u+ b/ N: w" \& n: J" s; k
- #include <linux/interrupt.h>
$ ?- L2 k1 _& G7 f - #include <asm/io.h>
$ ~/ |4 G; }2 @% a! L1 m) u7 Y4 Y - #include <linux/moduleparam.h>/ t) ~8 {9 {# Y, L3 s ], ]
- #include <linux/sysctl.h>4 D5 s0 ~# G% C6 h3 d E
- #include <linux/mm.h>: a! \& I5 n3 {
- #include <linux/dma-mapping.h># U. H- n5 }2 ?' A
& w' @2 g1 \) ?" |, m* S- #include <mach/memory.h>
7 f U- h$ F$ A8 B) l - #include <mach/hardware.h>4 I$ W* V8 Z5 h) B
- #include <mach/irqs.h>, q, x; I3 i, S$ ^% E+ ]
- #include <asm/hardware/edma.h>
1 L. Y, k3 h$ u6 D3 q - 4 V8 Y% \5 F% m. T
- #undef EDMA3_DEBUG' q' ~2 g8 g# c7 D3 P. o/ i
- /*#define EDMA3_DEBUG*/$ m* k) H# `( P* A
- + D' R q4 }6 D' G5 K# D
- #ifdef EDMA3_DEBUG
* S2 o% T$ u& ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) F* g$ F. J9 R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* | w' \: B* R9 m0 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) r' w* Q$ B7 ?+ Q# O5 \
- #else% K% F- E0 a1 D7 }5 @. T. e6 ~
- #define DMA_PRINTK( x... )
& Q9 W! l0 C# Y. | ?9 \# A& r. w - #define DMA_FN_IN
$ a" @' F) E; ^" @ - #define DMA_FN_OUT
6 t3 \ P- U. k3 J/ i - #endif
0 `- F$ i- h% }, U - ' x" `* `; w1 _! W1 s# P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' Q/ a# _/ n* [8 Z# U) a - #define STATIC_SHIFT 3$ y X2 O5 }7 {4 U+ u2 A% e. w* C
- #define TCINTEN_SHIFT 20' r8 R; }; @: a; i" Z4 H
- #define ITCINTEN_SHIFT 21$ Q7 Y# M% A* Z! K% L: g
- #define TCCHEN_SHIFT 22
! _3 ^, [, z. k8 f9 i0 L - #define ITCCHEN_SHIFT 23) l1 Q3 d0 g R5 O. ^" M& L
- % M' F# W+ [# j: O% d
- static volatile int irqraised1 = 0;
( N% S8 U( z1 q! {7 s1 k0 B! b F& e% Q - static volatile int irqraised2 = 0;" s5 w. `, d# {
- ; G9 p/ l" U+ E0 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 i. P; w$ D) a1 C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 i) i2 K: c1 N/ V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, d* F4 b% F2 L
|1 y. o- `2 L @2 k# W" n7 s- {- dma_addr_t dmaphyssrc1 = 0;; r3 r: c3 }! i) |7 c- G5 S
- dma_addr_t dmaphyssrc2 = 0;& C* j' U0 U" M+ e2 t
- dma_addr_t dmaphysdest1 = 0;
9 A2 }9 O; _5 j. g - dma_addr_t dmaphysdest2 = 0;* W2 d! G- Y) A6 W0 D* J
; M# l' k2 Y" z9 h& m! a% u( R- char *dmabufsrc1 = NULL;9 ^ @# Y% C" S9 `
- char *dmabufsrc2 = NULL;1 |. r( J; c7 ?, X/ A
- char *dmabufdest1 = NULL;' G8 b; c2 |6 X" d, {; |& \- P
- char *dmabufdest2 = NULL; j. _( D4 t8 t( k" Y9 V: _
- : C2 e# M! z2 j. A( d! |! X
- static int acnt = 512;
, r. m6 ~1 [9 V% F1 I: ?5 @& _8 C - static int bcnt = 8;3 ^% @+ ]/ r# A) P: m
- static int ccnt = 8;
; b. |9 G" {# R) B( y
" R) C4 p+ T" {7 V3 y( H a- module_param(acnt, int, S_IRUGO);% C- r# U, [ w. d4 n
- module_param(bcnt, int, S_IRUGO);7 B1 M6 g ?# w/ L
- module_param(ccnt, int, S_IRUGO);
复制代码 * F6 b0 H! \% ?$ l+ p* X
8 I( u p5 }' b, e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" j+ _' z5 G5 I& f; c5 ^' u; }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 J7 [+ z4 @# ~# @, u1 L- H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, m" q- Y2 C/ I+ z% f; k# L0 _: l
( w7 S' \2 o# {+ h8 m; Q$ x
V' L- ~: q' K: |* c& j6 v8 i [
|
|