|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" t, v+ @6 q8 A, j3 r- [code]EDMA sample test application
- G* R2 |! e4 S9 O9 Q) J - /*3 i$ `1 E9 \. m4 F5 {/ f
- * edma_test.c
% X f3 e: x( S% K) V( r3 u8 W% C - *9 w+ R/ ?9 ~, L5 ]) v
- * brief EDMA3 Test Application
8 _0 P% g, J1 t4 G8 O ^6 u$ x - *. o- Y, t5 B4 _3 \4 ?6 R0 `
- * This file contains EDMA3 Test code.) L9 W5 i/ N+ j3 d, _
- *' B, X6 F' b/ t% z: b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' i# ^! q6 [# c1 U/ X& R z, m* R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 O' ]1 H! J5 u - * TO CHANGE.
: e8 Y/ R) `9 @* p" _! G - *
+ w4 Y6 ]+ w1 n( o% l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 s* ~; w$ {* @. _& i4 {, q8 @ - ** N* e F7 ?5 P8 E4 t
- * This program is free software; you can redistribute it and/or- x3 C, n% F8 t
- * modify it under the terms of the GNU General Public License as
% [4 C* _1 n5 x# b" T* M - * published by the Free Software Foundation version 2.. W6 _8 k" _2 y6 L: T: q0 l
- ** c+ I6 W/ R. p2 z+ d8 z6 v$ Z% p- \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; G; F: m; t6 k1 I: q @9 a - * kind, whether express or implied; without even the implied warranty5 i) t6 f/ J+ V$ Q" e7 Q( Q6 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: A5 ~- @( y" \8 r: |/ H
- * GNU General Public License for more details./ E( u% W0 X' x h( N
- */
+ [5 ^4 u. x. T! C1 c* \ - ! }" o$ }7 h0 B& B
- #include <linux/module.h>0 Y! H. W' J {- @, H& R
- #include <linux/init.h>3 a# Y* A1 }7 J# e3 B, J
- #include <linux/errno.h>
0 h$ k0 h0 I- \5 w$ @5 q - #include <linux/types.h>" C4 x# w2 j& Q; r8 R( U
- #include <linux/interrupt.h>
3 P- O- |( j8 x* z5 o2 I, \1 v - #include <asm/io.h>8 j2 z9 d" a. z. s4 j
- #include <linux/moduleparam.h>3 v" E0 m/ H- A; }
- #include <linux/sysctl.h>
! Y3 I/ R% t m2 U, P( \( ` - #include <linux/mm.h>
. Q- Q: G- V0 [1 I+ z - #include <linux/dma-mapping.h>
* d8 i# U" K' X1 P - " D3 K1 a) n( i& k9 {
- #include <mach/memory.h>/ H1 j, j9 O; U2 o; V5 o! w0 \
- #include <mach/hardware.h>+ P& E1 M' ?3 R# i7 D) F" f; E
- #include <mach/irqs.h>
. ^9 Q; o% ^. M, a6 S% J2 D: g - #include <asm/hardware/edma.h>8 b& o8 T3 e& Z" {0 ~
- . X) J& A+ O; N, ~& z5 Y$ f
- #undef EDMA3_DEBUG
# k* n: O# k9 H( E: z - /*#define EDMA3_DEBUG*/1 q4 W1 t7 m3 I. ]$ U0 Y' Y
+ j& p/ {. X( ?3 S8 a. w p- #ifdef EDMA3_DEBUG
0 O3 m* j* `; \1 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) J4 Y v& t' f1 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; X" V& ^7 c7 H" R: M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, ?* l4 H {/ j0 x$ Q& W5 _" @ - #else! p7 Z! O( s/ y$ b
- #define DMA_PRINTK( x... )
1 T' A, d# K& l m- e9 I: I - #define DMA_FN_IN- o, \. u7 z9 P3 L) @6 ?7 l
- #define DMA_FN_OUT
: J: l2 S% q6 ?4 s$ q# S - #endif# y4 X. t" {0 D, F4 N: S
4 h: R) C# G: c# j# Q4 `: u) A- #define MAX_DMA_TRANSFER_IN_BYTES (32768) u4 ^; n* d9 i7 u# L. x9 G
- #define STATIC_SHIFT 39 c. j, S. p0 p+ c
- #define TCINTEN_SHIFT 20" r% e E: [0 F! \: y' v
- #define ITCINTEN_SHIFT 21: J0 S$ v7 Q1 c* w/ R7 a) A9 I# G& W
- #define TCCHEN_SHIFT 220 k7 X1 i1 m2 r# b
- #define ITCCHEN_SHIFT 23 A, H$ ^: F$ m9 P1 A4 S
4 J# t, k+ j4 c- static volatile int irqraised1 = 0;
4 y+ V- l- O4 v$ h - static volatile int irqraised2 = 0;" ?7 Q6 j! ?) V* i, A
' h: x7 I: J; m3 S3 }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 a9 ?: C: O3 b8 a' @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 Y5 M4 a3 \7 h7 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- V7 \. P' u+ o( t& f7 i
- 1 P, d; X6 u6 ~( u6 a
- dma_addr_t dmaphyssrc1 = 0;
' g5 U$ y2 q: e; x% ~ - dma_addr_t dmaphyssrc2 = 0;9 d5 b. w: f' U! U
- dma_addr_t dmaphysdest1 = 0;' w8 _% T: ^2 v
- dma_addr_t dmaphysdest2 = 0;
$ f9 p9 d3 P. f/ x% Q
7 W3 X8 [7 z, E; I# b( L- char *dmabufsrc1 = NULL;+ t* k7 |; ~2 T0 G$ x8 w; i
- char *dmabufsrc2 = NULL;0 L( I+ L% s+ S& S, Y
- char *dmabufdest1 = NULL;
; y8 m1 m1 l" N6 n' | r - char *dmabufdest2 = NULL;
2 q" R' ?' n$ S o: o - 5 P) Z8 Z! j0 T, T: |
- static int acnt = 512; Z3 q# N1 K8 V% {
- static int bcnt = 8;5 b! c" F7 B' H) W' \5 R
- static int ccnt = 8;9 ?5 ?: s p& d$ H% M9 u/ V+ ?
- 7 d% ^, o0 ^8 d# J& y, D
- module_param(acnt, int, S_IRUGO);
' E' ?, K6 o, o# g+ `4 K - module_param(bcnt, int, S_IRUGO);
' i! Z5 } M1 A; l5 G% M- I - module_param(ccnt, int, S_IRUGO);
复制代码
$ {9 F" X" i z* H$ d) ]7 m
4 w; a- b m! w, Y1 e6 v" @& z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 k- W0 i- R7 ?! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 P& L. v7 f7 s- y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 f7 a* b) g7 y8 }6 ?7 z$ b
7 V. D. y/ ~0 v0 e% `* c
" s4 G. w: D7 T
|
|