|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 {( S0 i Z, @$ s
- [code]EDMA sample test application/ z/ U0 t6 O0 O8 i9 k* H- s
- /*
+ D! `, A/ R4 C, K1 h; A! _8 m - * edma_test.c
7 h2 ]1 U; e% F - *
/ J# Y4 d2 O1 h7 X: m, d - * brief EDMA3 Test Application
# B& [/ ]# v" s- C( B- k a& ` - *
?2 C- n( B! f# z - * This file contains EDMA3 Test code.7 r1 C) M$ G1 r% _2 Y9 x
- *
: v% |! I7 k+ Y" v5 }4 V. E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% {7 ]' h+ K$ B) M- R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 A% v% l: O7 c& E. F* N - * TO CHANGE.5 x* i4 q# J6 Z5 z) g& B. X2 d) O
- *7 T2 @7 d6 L9 o. u" I5 c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 `; e0 H. l- {' Z - *
4 Z# N# `! ~) p0 a' m2 h% } - * This program is free software; you can redistribute it and/or
0 o" Z& ]: h) {# ?& k8 o - * modify it under the terms of the GNU General Public License as
- r8 o7 m0 m( }' {8 ?8 z/ ]( d - * published by the Free Software Foundation version 2.3 ^0 p3 j; p- I3 t( _. W& V% k
- *- \# D5 G, g$ M2 ^$ S6 t; m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ \. A6 _) A/ s/ n) E- a
- * kind, whether express or implied; without even the implied warranty
6 }! O/ A( b) F- c7 z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
z$ ?& S& f" r* V - * GNU General Public License for more details.: x: u' x4 W$ N& r$ b- {
- */
: }/ y1 U( \9 C4 }: z% a
5 r6 Z/ p7 J: m, d- d& T- #include <linux/module.h>" u8 R7 O) Z1 I8 U
- #include <linux/init.h>" I- a4 G9 f$ x
- #include <linux/errno.h>/ A$ o: M3 z: E3 [! b8 s8 @* A5 X% E
- #include <linux/types.h>8 S5 ]0 @/ N% y |
- #include <linux/interrupt.h>
' ^: H) u4 |. }9 e/ ~5 t - #include <asm/io.h># K( ^' K8 z. j4 J; u
- #include <linux/moduleparam.h>
# C* N v3 x7 p' o# d5 ] - #include <linux/sysctl.h>9 p( l: p* e! m
- #include <linux/mm.h>
% x" Y# {: `! m, O) u: u - #include <linux/dma-mapping.h>0 F6 L+ W1 @. g! j2 I; T
- 0 K) D0 ^# g# E3 V l4 a
- #include <mach/memory.h>
% V9 h4 y8 l( J& _2 E& ?8 Z2 i - #include <mach/hardware.h>/ h( e( [8 M2 v* ]& [, A8 V
- #include <mach/irqs.h>
# B6 y9 G0 b1 E" L- h - #include <asm/hardware/edma.h>4 o3 E* W8 r0 ~) T* P1 D& P+ G
+ n* ~% H' ?# ]' a1 i5 k# l2 s- #undef EDMA3_DEBUG: D# R F- ]* W6 @- |+ Q
- /*#define EDMA3_DEBUG*/
( e6 a+ Y3 D/ e5 b - 8 R4 {7 B6 i8 {% `3 J, |$ F
- #ifdef EDMA3_DEBUG( T$ b; A8 N& R! `7 Q& R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 |' Z% d* L% U' p. V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ h* A- p4 q+ H' n; C- I3 K/ W8 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 [9 S3 h3 k3 U4 |
- #else
( U0 ~$ r% G1 `0 Z: Z - #define DMA_PRINTK( x... )
* D& O9 m$ l4 ^: @) o: Q8 S - #define DMA_FN_IN7 q, P& q. f3 J: e
- #define DMA_FN_OUT0 j( ^! O8 l/ {+ `- {' D! H
- #endif6 L4 t* Q' n- c+ Y
; T% F0 C0 `/ D e! |4 N5 X' @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" r( [) N L/ Q2 Y3 @6 O - #define STATIC_SHIFT 3/ u! k1 r* T6 P' N+ _1 h" [( Z- g1 C3 E
- #define TCINTEN_SHIFT 20$ g3 p9 X! P1 N9 w! i4 N
- #define ITCINTEN_SHIFT 21. T9 l' M i* z8 U, l" j" Z
- #define TCCHEN_SHIFT 228 Q3 `4 [9 `/ C' y$ s
- #define ITCCHEN_SHIFT 23. A' C8 Q9 T+ C7 p3 i
8 }4 L# ~; E; c% s* w+ O8 Y- static volatile int irqraised1 = 0;- |9 V7 o$ a" |! c: `
- static volatile int irqraised2 = 0;
$ `! f f) I* }" H: g - 1 h7 [4 C) B7 G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, e' z6 E! s+ D% S( Y4 {8 y) L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ R2 f+ v* c* p7 V) |( m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) _, X! {& Q6 P: V
8 C$ N8 N2 {& D2 @' c) Q- dma_addr_t dmaphyssrc1 = 0;* K( M# b4 A/ W; M
- dma_addr_t dmaphyssrc2 = 0;
) a1 J T5 W" }% Y z - dma_addr_t dmaphysdest1 = 0;, D% b0 J" Y7 l4 B6 @3 m
- dma_addr_t dmaphysdest2 = 0;& {6 g( z) j2 y% a
- " Z5 Y5 p! b! |$ O% D' x+ e3 ?
- char *dmabufsrc1 = NULL;$ v- a% ^. ~! k# \
- char *dmabufsrc2 = NULL;1 Y6 P; t% }) A) _
- char *dmabufdest1 = NULL;
4 Y6 u+ y/ N7 W# C - char *dmabufdest2 = NULL;! G4 i' h) \# A1 J
- 3 R" d% g8 ?7 x( e; L) V
- static int acnt = 512;
7 e3 H9 K* S) R( ?9 ? - static int bcnt = 8;
5 u+ Q' p: C* c' }' M - static int ccnt = 8;
5 l1 d! @$ j/ b/ _3 M5 W2 _ - . w- ^) A! Z, x* }% \ \% k z
- module_param(acnt, int, S_IRUGO);- p# Y% d) J) c! c8 `, I
- module_param(bcnt, int, S_IRUGO);1 S: y& Z" z( f% Y( x- X2 `
- module_param(ccnt, int, S_IRUGO);
复制代码 % h! I9 x6 H# E, P5 Z# v4 R
$ P( x8 c! P0 W( ]7 C$ ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- ]/ h" ~3 V( c6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 P7 G) |* b; a+ D2 m# ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 n! ?: k6 \' z, q2 m; k+ y
: T0 A; ?( ~: d' ~7 e
. P* ?& d {" ^* j |
|