|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ]- C [0 a9 \3 g2 G! U- [code]EDMA sample test application
4 G1 `- m7 |: r" m+ \ - /*
9 b) }& ?) y! c/ ~ - * edma_test.c5 ~& k I6 u" I' C
- *8 u; o* x/ g) P" m( _
- * brief EDMA3 Test Application
( Y6 B7 S& T5 n! s" a* t M - *1 k; O. U I7 Z3 c2 V' {* ~
- * This file contains EDMA3 Test code.. A P- O3 Z4 b/ N% {' }7 F ?
- *
7 m$ Y/ {, t6 W8 G7 z6 M( ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 J! s8 K% b9 O. ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 @" |3 u5 j5 Z( _2 ]
- * TO CHANGE.- @! s4 }! b- b& s
- *
4 j& r8 @$ }9 y" g/ ~! c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 M o8 g# Z- ]( h$ N" G1 g - *' x9 {% X. \& Z+ o& }( m! U$ k
- * This program is free software; you can redistribute it and/or0 r! i; h) X0 m
- * modify it under the terms of the GNU General Public License as
* R/ a+ R9 P! l1 s+ l; \: t - * published by the Free Software Foundation version 2.; J H9 X9 ~( H, t0 R
- *
( L( z( [; @7 N5 m9 I- V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! ?. m# M; q, \: D3 p8 O1 i
- * kind, whether express or implied; without even the implied warranty! [9 y! L l# T5 W' \% h' C) @6 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& o7 K% |3 V" u1 o5 `( U
- * GNU General Public License for more details.
: y1 w) W6 b6 f0 L3 |% Z; k& \ - */
/ B0 q. ^5 V9 k: | - $ n1 P5 W* V% D: l b" ?& \( X
- #include <linux/module.h>/ B! r0 X9 P! ?/ B, v
- #include <linux/init.h>* p2 p+ F0 h1 n+ ^$ p6 f1 x
- #include <linux/errno.h>
5 u! C9 O4 k. a' I - #include <linux/types.h>
: T: H/ ?8 _ I' |* t; v - #include <linux/interrupt.h>9 m1 G1 E- I; t
- #include <asm/io.h>8 D9 S! o' i0 y( n: s
- #include <linux/moduleparam.h>* W# N9 s! k, R: Q
- #include <linux/sysctl.h>7 k! q6 q3 y# M* A7 O" b7 h
- #include <linux/mm.h>9 M- G# ~- w4 _" ^% h/ Z/ ]
- #include <linux/dma-mapping.h># `: u% @/ X. J: V3 ]( f
- - z5 g" g' q$ o1 L7 s
- #include <mach/memory.h>
; }: U# {8 G2 D) F - #include <mach/hardware.h>& s- i& X4 X2 I1 t
- #include <mach/irqs.h>
2 q" c6 A" r. ^4 W/ C) O o2 V - #include <asm/hardware/edma.h>4 O7 `; F9 F" `2 ?
9 c" R# Y& E+ l' k5 s8 h& b8 ?4 T' z- #undef EDMA3_DEBUG
3 c7 S+ b# F/ ] H; `' W. }$ ? - /*#define EDMA3_DEBUG*/; e) q5 X* v! x+ i( }
- + V# {, H" H% q7 I# ~+ H! L+ d, @8 ^
- #ifdef EDMA3_DEBUG
& a8 H4 R) ]" `% o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; x/ j, d# o; S8 z2 r# v0 ~% ~8 { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 _9 i+ F% D5 f/ t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" E+ q$ A( \- a- {
- #else
/ E# V/ N! A, w0 b1 Y! W - #define DMA_PRINTK( x... )
1 K. T' ]/ d- p$ T- h3 _' o* n - #define DMA_FN_IN# b/ L+ [! V" K" b
- #define DMA_FN_OUT# t3 }/ y4 ^# N$ Z/ v' ?
- #endif7 ]. y+ S% W3 j( l. M+ }
' f6 f6 Q) q( ? \3 `& c( q9 j7 t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' I) a+ h0 S( S; ~! A' ] - #define STATIC_SHIFT 37 p' @$ Y8 z+ V% i/ Z- K
- #define TCINTEN_SHIFT 20
# ?6 O" y P4 [ - #define ITCINTEN_SHIFT 219 t% {1 X3 j$ n+ }7 n
- #define TCCHEN_SHIFT 22
2 a3 {% `+ \7 y' L& A$ D7 E! l( B - #define ITCCHEN_SHIFT 23" m8 v T/ L4 u+ p$ Y6 D
; {# \3 ?/ A: o! F# j- static volatile int irqraised1 = 0;$ r1 j4 n5 f0 f, z
- static volatile int irqraised2 = 0;
, w! W5 s3 [8 P - ) D& }: m2 T$ J8 R& H4 n, ^- J! p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ^0 i. r4 B6 d3 I. p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 |& m1 o" }0 P6 w% h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 W$ L( v6 E8 [! V3 w; S( ~ - % P+ Y6 x( w* W
- dma_addr_t dmaphyssrc1 = 0;, C- k, p u7 t. [; I. Z
- dma_addr_t dmaphyssrc2 = 0;
% B) u/ K+ U2 {) Y - dma_addr_t dmaphysdest1 = 0;
+ g. a; {2 G- Z/ z, N - dma_addr_t dmaphysdest2 = 0;
$ U2 U# t) x& k6 T, P/ H/ }
4 r- y7 c: u9 N/ J, Z8 X- char *dmabufsrc1 = NULL;# G0 s" {# B/ j/ |
- char *dmabufsrc2 = NULL;( ~0 B$ {" j9 x
- char *dmabufdest1 = NULL;
. I, t. Z+ g m+ R- }9 Y# p# J - char *dmabufdest2 = NULL;
/ T/ q* }5 ?; y8 j, C4 r7 { - 6 f- z. ?. R3 ?$ G; }
- static int acnt = 512;
, M6 W8 x+ \! T( P% i - static int bcnt = 8;
% P7 f1 M# p( v) c/ l% {8 D - static int ccnt = 8;
) S: J+ u- r t3 o4 O2 W) F: b - 4 I% V- I+ n" }0 Z. V
- module_param(acnt, int, S_IRUGO);: z# e% f, O5 ~" L
- module_param(bcnt, int, S_IRUGO);2 E! t% O+ D% t: ^
- module_param(ccnt, int, S_IRUGO);
复制代码
% M: w4 v' e- H' N! G5 j
# T" `9 t9 p P0 B) U/ U6 G1 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 }& C& i6 S5 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 h5 t3 g8 o5 f! E; W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& p* C, u. B4 d5 e' x- y) v: Y# x1 u! ?/ Y3 x6 R8 u. p0 I
2 f$ D) g" R0 f3 I/ J" h |
|