|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( X6 U' ?$ \: L; F( {
- [code]EDMA sample test application \% } S1 G* O y5 g2 `3 y T
- /*7 ?) f _5 q/ P4 }: _
- * edma_test.c
. P d* e! x4 E+ v - *
& o$ F7 U. H6 S$ f( Q. E. b - * brief EDMA3 Test Application
! t6 G( d" V' n0 _ - *5 |" A: `! {/ A
- * This file contains EDMA3 Test code.! z$ j& f6 G# @0 |8 I* p* x
- *% d P: n7 t7 {1 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" e v {- _" P, b( S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' f0 z2 b i: f4 i/ l - * TO CHANGE.
9 A9 W' A3 n7 o. B. w9 E6 u5 E - *
^0 p7 d/ I7 Q# A+ Z4 z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# u* a v3 ]! Y7 V$ o9 H, ?2 ] - *' q( K3 f* N4 F/ R( S0 p, g3 _
- * This program is free software; you can redistribute it and/or1 E5 o* j, ^0 p! l( w" T" F8 }5 ?
- * modify it under the terms of the GNU General Public License as
. }& ^- C; P5 ` - * published by the Free Software Foundation version 2.5 A {8 Z! D( [$ W: _* d5 ~
- *
4 `) D' h" q$ w% p( ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; R. g( z+ W5 \, N( V2 N - * kind, whether express or implied; without even the implied warranty
- d9 Y0 D0 D; k" D6 t0 ] m5 D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( r9 W# a! C) N# k3 @, J# h
- * GNU General Public License for more details.5 k& [% s1 \; f; r6 ~& R- @& n
- */! D8 o8 T7 {& m4 E4 m [) K
- & S" ?7 a9 Z2 G# S# U8 G0 k4 M
- #include <linux/module.h>
) V' E+ ?% H9 B, z1 t( J - #include <linux/init.h>- Z, \+ n* K2 ~% q% x
- #include <linux/errno.h>
2 u+ ~7 y6 v4 X0 [( Y( e0 o - #include <linux/types.h>4 w7 X5 E! Y3 I- j% i
- #include <linux/interrupt.h>
# B# ?( i" E& T# Z( q0 a! o5 a - #include <asm/io.h>
2 M. j6 |2 V8 J% M# k) c, L& f - #include <linux/moduleparam.h>
' m7 f$ U, u& k - #include <linux/sysctl.h>
/ S' @0 d* r% c* ~- C) G$ V8 F - #include <linux/mm.h>
) \/ R6 b) s4 J/ p; _ - #include <linux/dma-mapping.h>
: V7 T7 y7 u6 ]) x! m$ a4 K
8 |, v7 _) F& w- #include <mach/memory.h>
+ ~1 x9 f' u4 S4 Z. E; Y) R - #include <mach/hardware.h>
" V- v6 k9 y p$ z2 [ - #include <mach/irqs.h>3 t8 {5 h1 z1 `5 u
- #include <asm/hardware/edma.h>7 F, ?* `! m9 w7 S9 C/ y, i. B
- 3 @1 X& v$ H3 F, }. K9 @; [% U+ I
- #undef EDMA3_DEBUG
' D$ n6 c& b& o/ F' i; K - /*#define EDMA3_DEBUG*/. D# Z6 p- R) h* X: ^: u
6 M" O) @2 r! c4 }" c' L: ^- #ifdef EDMA3_DEBUG$ _8 O# l/ N) |" U+ m( ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& G' y: ?6 a/ h2 M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' ]- R2 `" X2 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 [$ J% [6 ]5 J$ n - #else
5 p& v4 X4 t9 u+ h* ~' ?. S - #define DMA_PRINTK( x... )
6 m6 W( j! O+ I5 ? - #define DMA_FN_IN
! _5 J& b0 s: _ - #define DMA_FN_OUT& _8 i$ `$ u# d" Q4 ?5 R
- #endif6 J4 E1 u! J5 |# }8 X
3 `4 ~+ t6 w4 \: ~7 b- p, J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& K! y0 s) ? y# ?& n - #define STATIC_SHIFT 3% @3 U5 e+ N3 h8 g, G8 l
- #define TCINTEN_SHIFT 20
# z8 `& c0 e& S) N7 P9 f/ A# b! B - #define ITCINTEN_SHIFT 21
+ ~; C+ [8 u/ S# ~ - #define TCCHEN_SHIFT 22; H' G3 [& W0 V" p& t
- #define ITCCHEN_SHIFT 23
( j# z$ S+ |! x7 K
- E4 E, Q, z! @( l* M# P8 r- static volatile int irqraised1 = 0;- j2 b4 O/ C9 D+ ~% Y8 Y) C3 M
- static volatile int irqraised2 = 0;8 I4 I z' ]* e/ [, O% ?& S
( V& B5 s1 E; w. R5 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 A1 B, T! j. x) v' V7 c9 U1 j4 i7 K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 R2 {, y; q; B0 I5 d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" J" ?7 C8 k& d8 H, G/ b
- M# B/ z* J8 ^' F- dma_addr_t dmaphyssrc1 = 0;
# n7 k1 w5 Z$ m! m4 a1 ^ - dma_addr_t dmaphyssrc2 = 0;/ A; F+ G7 E# ]1 d
- dma_addr_t dmaphysdest1 = 0;
% \. d% g j; l9 E L0 Z- R J. {7 Q - dma_addr_t dmaphysdest2 = 0;
0 v0 n) ~6 n9 }/ F7 E; q - , p, v, {- T4 y4 Q/ S% b
- char *dmabufsrc1 = NULL;2 }2 m8 @, o) f2 J9 V; |
- char *dmabufsrc2 = NULL;; O0 ^- \2 V+ Y* r8 J. |, W2 s
- char *dmabufdest1 = NULL;! e8 Y" s2 \$ K' N* o; u; `; H7 s" j
- char *dmabufdest2 = NULL;
- A$ s9 V1 \" H1 m
) i4 j6 G; b& s- J! q, S- static int acnt = 512;
$ v: U9 y+ U5 b( Z% A - static int bcnt = 8;$ ~4 Z* p- v, u4 J5 E S7 Q
- static int ccnt = 8; {5 d% T2 f/ ^& E: R8 R# J
, X# w6 [& G) d K- module_param(acnt, int, S_IRUGO);& {! {" v) ^3 R$ P
- module_param(bcnt, int, S_IRUGO);) Y! P* w1 d# f+ }8 m2 b) Q9 X
- module_param(ccnt, int, S_IRUGO);
复制代码
, {9 b: \& S( G* H) F4 `3 o9 o+ s' F: @6 b, ^& r! I+ b3 q8 b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( R6 ~# v9 U3 a ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# y7 W" r: T! C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) b) [2 x6 S8 N5 r% U# h6 B" |# b) d- C
! \9 N4 u8 z$ L7 e. l# W, S2 a( D Y0 O
|
|