|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! B( I- C' a6 t; b" Y/ P+ a- [code]EDMA sample test application6 U$ j& h4 m0 v# g' @8 K
- /*, R( x( |. V$ q2 \5 A9 Z
- * edma_test.c c9 y3 ]; v8 [7 E$ Y7 n
- *+ p( c, L% x7 {6 b
- * brief EDMA3 Test Application
8 S6 \! l2 Y. u+ \ - *
4 _/ h. j+ z9 |% [ - * This file contains EDMA3 Test code.4 D$ ?- \- o( N$ U* [. X d
- *& T0 m8 y! f8 f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 ?" B1 V$ {) A* r% {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- n0 M8 q q0 U" F9 B! o8 o5 K - * TO CHANGE.
t0 p" L6 N' M: s, v, p; Y - *2 S. |; n( ?$ d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" k( P# q" T, Z4 @" u3 h
- *, D$ ]" [0 H+ u3 N% l- C
- * This program is free software; you can redistribute it and/or" r4 P% u4 G' Y
- * modify it under the terms of the GNU General Public License as3 ]' q3 @4 |# Y9 V: p* Q$ p9 \/ s& [
- * published by the Free Software Foundation version 2.
/ P& C5 @; s/ O$ s7 P - *+ |1 e# T$ n- P6 t, {, O1 X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 L0 P+ ~) K' o& t( X - * kind, whether express or implied; without even the implied warranty
/ z' e) d; ]$ q8 _1 l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& u. z$ l: l9 v - * GNU General Public License for more details.( k* x$ ?1 r% q. h' c2 ~, Y9 B
- */ L; `; I. b- }9 y) N1 c. l
- 3 _% O* j' o9 o& M4 u7 r, C
- #include <linux/module.h>' N4 Y9 j$ P& G9 A& b ~
- #include <linux/init.h>* ^5 m0 u6 g: D
- #include <linux/errno.h>! [ J c3 o+ d6 D
- #include <linux/types.h>7 W& |& K, P1 L$ A5 e
- #include <linux/interrupt.h>3 `. F2 t& w5 h9 v) C
- #include <asm/io.h>
" m8 |7 g. w1 J# T$ s8 | - #include <linux/moduleparam.h>6 s) B+ Z& S6 B- [' B9 ~
- #include <linux/sysctl.h>0 G% E7 q7 i% j p! o
- #include <linux/mm.h>8 K) _1 C3 d/ r2 `5 D& ~9 r5 l
- #include <linux/dma-mapping.h>
3 N6 }* N; ]' Y* M - ) M1 f6 R$ i: A& B1 L
- #include <mach/memory.h>; u# b/ R2 V2 a: l$ ?: C3 ~ v2 v' \
- #include <mach/hardware.h>
! R$ w5 O3 j8 U; t* q% C - #include <mach/irqs.h>. O* Z9 S9 I9 j( `: |/ w
- #include <asm/hardware/edma.h>
4 S. Q. E' N) I - " L: t( [) w# n7 p$ X& {
- #undef EDMA3_DEBUG
+ x- \0 K+ E4 m( e+ c - /*#define EDMA3_DEBUG*/" f; t$ v; I4 _/ y: b9 E7 ?
1 K' }: K) j1 `5 l0 k0 K. G- #ifdef EDMA3_DEBUG9 p/ P6 j1 M2 p8 d' \: V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 r, A+ A6 p6 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); J6 {8 s) M0 e2 g2 d: `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( W% d, s- c0 l& [' r - #else! b( j' i( v6 X
- #define DMA_PRINTK( x... )
, H' ~, ^7 J( N5 e, g) ?! A4 x; ] - #define DMA_FN_IN
, ~; O( V+ y5 Y6 P+ e" C - #define DMA_FN_OUT; @% P( h( k* g0 k
- #endif
" B* v- b6 t, z5 M8 C( J
& [5 Q- F& I% W* ^7 a7 G# N+ @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ V; K! F5 _1 { - #define STATIC_SHIFT 3
# ^9 i9 E4 j' i - #define TCINTEN_SHIFT 20
) k: w* [! M: p; A2 ^ - #define ITCINTEN_SHIFT 21
7 M' R, n3 k# m3 q7 c5 Z+ W" T - #define TCCHEN_SHIFT 226 L8 s' x' k) e) m* z( N4 b+ C
- #define ITCCHEN_SHIFT 23
2 N# Z* `: c/ f+ T( r: G, [
+ S$ `9 }* `1 T) C- static volatile int irqraised1 = 0;5 L$ V: ]) Y0 @+ t" c
- static volatile int irqraised2 = 0;
[! L3 j' d) @" s - q. B0 P4 G) D2 M) U' Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 G" m6 [) N( j6 Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* }8 k* {5 i! L- D1 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% A; d3 g5 s/ v7 b - 3 ]$ Y6 T0 p# U! o3 W6 J& o
- dma_addr_t dmaphyssrc1 = 0;3 d/ I% ^' H: c* v
- dma_addr_t dmaphyssrc2 = 0;
# o8 P- `$ n% _" @/ M - dma_addr_t dmaphysdest1 = 0;# V8 C/ |! U: g6 Q8 p( Z0 X" Z
- dma_addr_t dmaphysdest2 = 0;, ` s6 d2 o' C0 b: q8 @
- & R) F; P& x, K) l
- char *dmabufsrc1 = NULL;
0 e2 x# D) H' X. W6 i; z5 g - char *dmabufsrc2 = NULL;
/ C1 S$ k' m4 J9 d) c - char *dmabufdest1 = NULL;
, W3 _2 ~* R5 u7 K - char *dmabufdest2 = NULL;
5 {& J% h. Y* V4 L - $ Z/ w2 U8 ]: P& F+ r$ x3 L
- static int acnt = 512;
' L, I; N) A( e - static int bcnt = 8;
( ?. I: [; Q! q. h - static int ccnt = 8;
, v; f8 n+ M) g. z+ H8 y+ t' g& J
. E% e) i' L- j3 [- module_param(acnt, int, S_IRUGO);
! l" P4 `( B O# M6 M: H - module_param(bcnt, int, S_IRUGO);
I1 F/ T% o. _! y3 E! N) Q1 W - module_param(ccnt, int, S_IRUGO);
复制代码
# h6 ^' @) A" F7 _) p1 m
" v! E+ @4 `- k) j7 G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 w6 W: K c# W4 C5 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! m3 u% P: ]( i6 ~7 P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) P- m" W8 q$ ?8 r1 P3 I8 X' O/ K4 \
; e' U, H6 I+ J6 y8 O0 K& B8 w9 V3 ^& g/ o# T( p* A7 ?
|
|