|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 b- M9 I( u0 m2 [; `- [code]EDMA sample test application6 h$ _+ g" x3 _1 {' q4 r
- /*4 z3 @2 Q- Q- ]% y
- * edma_test.c" Y1 H& b/ i$ O; s, O
- *
# z# E* E2 `, l - * brief EDMA3 Test Application6 {# y2 p) W8 j
- *
0 @2 ^8 B6 M# F/ g - * This file contains EDMA3 Test code.
+ w4 ^9 r0 n: x9 O5 C, k - *
/ t! \# I$ B) x3 m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 r; a2 p$ E3 D9 |/ h, ]3 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT M( ]+ @/ P7 }9 K4 `
- * TO CHANGE.
9 L" S% e: W$ n+ Z+ s2 `! f - *
$ }8 r4 Q1 x0 @1 x0 Q( N0 [! T: ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! |) O: q0 ~9 Z# g8 O/ t2 }# c
- *# d" O) m9 G; E# }5 V5 c
- * This program is free software; you can redistribute it and/or# ]1 |; Z7 \* {/ V/ w
- * modify it under the terms of the GNU General Public License as
" }$ R& \( W+ E" h- [% [ - * published by the Free Software Foundation version 2.
" y9 X* U# R8 g. g2 v7 h4 H2 k - *' c* k) F$ j. D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 t# _6 e4 Y+ i0 ]! P - * kind, whether express or implied; without even the implied warranty
: q5 ^, R1 { E6 L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" \ {- h4 Z8 c+ _5 I - * GNU General Public License for more details.3 l! b. K( N; {" E$ C/ z0 t
- */& G& b( l* z5 J
- # v6 t9 h/ _% f% A
- #include <linux/module.h>; f0 `& {: S W
- #include <linux/init.h>/ I% V0 Q; C: I1 d# `3 U1 [
- #include <linux/errno.h>
# F7 x1 R" f4 o6 M: x) F( M - #include <linux/types.h>& o6 ^) Y0 C. f
- #include <linux/interrupt.h>, @6 `/ k# Q( x# [3 y2 ?
- #include <asm/io.h>
, @2 I7 g6 k; o0 f; V; V8 g - #include <linux/moduleparam.h>: [1 J- |4 O# U7 f
- #include <linux/sysctl.h>
) J6 n6 H$ I, X8 R+ @ - #include <linux/mm.h>
/ m2 b* O* o: a* s; {* Y' O$ ^ - #include <linux/dma-mapping.h>
. X! h+ X$ ]- _! O3 I
( C+ @. k( [' `% F: l+ I- #include <mach/memory.h>
1 [# b+ \6 |8 w6 u! e J, c' o - #include <mach/hardware.h>: K& c4 u9 o, b Z% N8 ^& c1 s2 I( z
- #include <mach/irqs.h>& O1 W6 t* J0 K2 U1 z* b
- #include <asm/hardware/edma.h>
5 f E0 o- h. f- _# e4 o: S3 x - # ?9 P5 v% x6 U4 \
- #undef EDMA3_DEBUG
0 L; ?$ L& [: f- l6 i9 ^6 q+ l1 D - /*#define EDMA3_DEBUG*/* X- a/ ?; Q& A3 P' u
- & ~$ s% Z' p! i* M
- #ifdef EDMA3_DEBUG1 h# t; I% f" n& `0 M4 O% \/ G2 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& L9 ~% i1 ^4 r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! L" R0 M& {* k1 }; F! g' a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% }# r2 ~% ]$ {) ` - #else1 J$ Z ^6 t9 j2 D$ ^3 g2 V f
- #define DMA_PRINTK( x... )
' f J7 H" N+ M$ V+ H - #define DMA_FN_IN8 g! [- E0 N* v. f' n% R) T
- #define DMA_FN_OUT
. i* D4 H. ]2 E8 @ - #endif2 A& h& H3 y$ _0 N
( x, W0 g6 |9 d8 i/ c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% z$ o1 q$ T9 A- ^# O& M; p, t
- #define STATIC_SHIFT 3 L: u- b6 J) m0 ] t
- #define TCINTEN_SHIFT 20- c* Z, W7 \; f0 c7 W3 V5 d
- #define ITCINTEN_SHIFT 21* J1 }, q5 x0 K. r: c, ^) B
- #define TCCHEN_SHIFT 22
8 E' B8 O/ |% z! G9 Q - #define ITCCHEN_SHIFT 23( @' A+ e! Q; v# {1 @
- : B2 o) B4 X& z1 `. t3 z
- static volatile int irqraised1 = 0;
7 U) Q O0 [2 d3 u, x: p - static volatile int irqraised2 = 0;5 }7 L6 t" N0 @
- 0 c, V. t7 O9 Z3 {5 ~+ D$ h2 g5 a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. J& I: w4 Y" L6 g, K K7 m9 n7 _* h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 K) r D8 R7 j- g5 I. ~0 t; {6 K9 u8 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 }) l6 ^5 I8 |* e. ~
$ b2 I0 c# u- Q! z/ c- dma_addr_t dmaphyssrc1 = 0;
, q6 h1 H' ?- F5 L7 g - dma_addr_t dmaphyssrc2 = 0;' M D! F& l. }
- dma_addr_t dmaphysdest1 = 0;9 x @+ J/ f* p' G2 j. v2 u
- dma_addr_t dmaphysdest2 = 0;. e; t9 J; i9 z8 {
( w* P/ p) }5 u# S1 o0 b; G- char *dmabufsrc1 = NULL;
q0 \3 F u6 y* c+ `; f" U4 } - char *dmabufsrc2 = NULL;
. W. f6 Z' B/ M/ u3 Q4 S% R( x - char *dmabufdest1 = NULL;
; Q7 Q, Q7 z b6 d' f6 }& G - char *dmabufdest2 = NULL;
) ~0 J; D3 P- M* H+ q& Q$ [
% L" m& X& Q* }7 o8 S ^7 _- static int acnt = 512;# ]' G7 N$ ^* F' T( H
- static int bcnt = 8;
5 s( a1 V5 i( j) E& Q4 ` - static int ccnt = 8;( [8 t+ U7 w2 j2 N0 e6 @
- ' q' u! ?8 n0 {& s5 M8 w' A6 F
- module_param(acnt, int, S_IRUGO);7 N8 P4 M+ ^5 C( |) W8 T6 {
- module_param(bcnt, int, S_IRUGO);' O& a4 n+ l" D
- module_param(ccnt, int, S_IRUGO);
复制代码
: C% l* W, H* B* q- Q+ z) J
2 _0 g5 T5 i8 o } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ Y! Y3 w3 l3 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, t4 k u8 m9 |0 ^$ H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' Q% _" t4 u. a# o7 p% i7 k/ n7 I$ D
; S( c; s. i b7 n3 F1 O# U1 U1 o
8 W& @5 I0 }5 x O- _6 e8 O4 B
|
|