|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; B) t/ |/ z) ~) B) c- [code]EDMA sample test application
! B, x. |! q2 r3 N8 ^" \ - /*
2 w( s0 } u% M3 I* S$ t, R - * edma_test.c# @" V. c: B% p5 R
- *4 h. O5 A' D3 M+ U& @6 U/ g
- * brief EDMA3 Test Application& @+ B6 C" j0 l" u, C, ]2 q! ~' d8 ?
- * a1 N, h- w% b2 m
- * This file contains EDMA3 Test code.. s+ `7 `. t ~; @) B
- *
5 Y' O* d* F( H/ M. T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) R( T! I0 j2 [: [' C# F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ u% v; G" j# F7 i7 O+ w1 X - * TO CHANGE.1 R- M# s6 G4 P8 z! t* p- d5 U
- *
- J& A9 M, T7 l2 E' G( @2 h. u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 K" {: o! H" K) m3 @. b
- *7 E7 k- p% R; C, c6 t* s! q
- * This program is free software; you can redistribute it and/or
% J0 G4 Q5 G O* j - * modify it under the terms of the GNU General Public License as
% i; H, h2 g( z* v - * published by the Free Software Foundation version 2.
4 u9 k! E1 u/ R. M' K - *6 |! x* @5 w ^# W6 ?+ y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, [" ]0 D0 R8 Z4 X" n( Z5 o
- * kind, whether express or implied; without even the implied warranty
. u" m+ l' D0 w! S, N( p( B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 w! s3 P; N4 K2 g9 `$ t - * GNU General Public License for more details.& ]# O h1 U9 d+ `
- */3 }' P+ f. i2 r1 c. E f5 E. x
! K0 x! D/ n- s: R$ f/ r! A- #include <linux/module.h>
9 a1 |& N2 b: `. [; Z5 T - #include <linux/init.h>0 S7 h$ f2 y# o
- #include <linux/errno.h>
: p6 j& k% @) {+ t - #include <linux/types.h>
* j2 O* Y1 @5 G1 r: w9 i - #include <linux/interrupt.h>
) l0 X; x' I# S% t# F) ?. k% w - #include <asm/io.h>
1 @/ h) }1 k' A. c- L& S - #include <linux/moduleparam.h>
- Q/ ?' x7 p# P/ W5 }$ n( Q5 F) W( c; V5 P - #include <linux/sysctl.h>
* ]8 p5 L, [" m0 @7 m& ?( M$ r+ l - #include <linux/mm.h>
7 u" B$ t/ E% O - #include <linux/dma-mapping.h>
3 T- E4 X( X: A - ; M. C/ Z4 H8 X# [
- #include <mach/memory.h>
" O& T! Q* w) w$ p - #include <mach/hardware.h>' W- I8 N ~5 F+ i) d3 [
- #include <mach/irqs.h>0 ^0 P8 s! J. j5 j; I& s
- #include <asm/hardware/edma.h>9 B# `' \# R; W# V+ h x5 K! I
- $ ~6 O, R; I0 ?; }. v A
- #undef EDMA3_DEBUG' V; S/ x9 x% b8 B& k% N& x
- /*#define EDMA3_DEBUG*/$ N: e" d# E4 n0 n5 x
% Z) e: R$ A; y+ v. W( U- #ifdef EDMA3_DEBUG! | N+ ~8 i% ?3 c5 J" c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, P2 a* `( e, {& e9 Z% _! a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% N+ n, h4 S6 [# J" v( A" a' X9 s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# M3 a) K% q1 T% |" x# ]" W
- #else
W! p$ M& @. S, H - #define DMA_PRINTK( x... )
; x- T; D* a) f% E* I$ p5 o - #define DMA_FN_IN7 m" P' b0 K2 J$ I7 S. D1 y- M, a
- #define DMA_FN_OUT- n+ {& b1 L- w% i7 Q
- #endif
# R0 g" d9 h0 F! D' J! B; o5 n: ?
2 E3 W# B4 V, p+ g" ^2 ^$ B9 w! g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 p2 D, t4 i7 k2 w" V5 W- j - #define STATIC_SHIFT 3. g4 s0 K+ S2 W9 ?" {5 P h {
- #define TCINTEN_SHIFT 205 C: p R( ]7 U
- #define ITCINTEN_SHIFT 21
& J9 P6 D5 j } - #define TCCHEN_SHIFT 22
% j7 }, E n; \ p! `& Y5 \ - #define ITCCHEN_SHIFT 23
9 ~) b' x8 I$ a
: Z8 i( l: ?4 M- static volatile int irqraised1 = 0;. i7 `& X1 K* C" @/ x( o; U; |
- static volatile int irqraised2 = 0;
- r9 p! D, J" H. L3 h9 p$ D6 c - # {& a6 b, Y4 i# P$ G& ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. b5 {: I& y8 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 E; Q' ]! @, h% N. u* d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 a# g: e+ a6 Y1 C9 N, u- p
- $ T8 E. C' I: N) E5 |' ~2 |
- dma_addr_t dmaphyssrc1 = 0;/ Y! X* B4 ], z2 r I
- dma_addr_t dmaphyssrc2 = 0;% m' p% A8 V ^! W. |( ~
- dma_addr_t dmaphysdest1 = 0;
9 G( v; s T! ^' I/ O0 _( M/ t - dma_addr_t dmaphysdest2 = 0;
% O& {" D7 p- m* `3 E) Y, L& A
, @1 M& G' k7 |; V" w4 m1 [" w- char *dmabufsrc1 = NULL;3 n, h9 b5 M, O* K: ~ I
- char *dmabufsrc2 = NULL;
! _( y: U" P, n0 R5 O% z# O - char *dmabufdest1 = NULL;
, ^; Y6 h$ r- E0 K; E/ [- M - char *dmabufdest2 = NULL;
, Q6 m) y: T0 m - / Z" p, q5 k, j5 b8 x; I
- static int acnt = 512;
9 }9 h& ?$ d6 x, D$ i5 X( s6 q - static int bcnt = 8;
' ]9 b: {. Z6 u - static int ccnt = 8;
/ t' D4 e( G( `& s$ z( |% s' Q) ~ - * I! W% H" G/ X
- module_param(acnt, int, S_IRUGO);9 x8 i2 o" O* [! t& z9 ]! Q3 x
- module_param(bcnt, int, S_IRUGO);6 S) \ Y- K8 t" k. _8 d
- module_param(ccnt, int, S_IRUGO);
复制代码
4 A9 K# O u7 p: v0 N
& @+ N2 g7 n2 h4 {0 h# { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* j5 s. a( k- c6 k8 L1 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
z0 ?& \: b B& e e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ B. `3 r5 C+ C6 I! w* k2 k( B: B: s
- y! _6 c( C0 ?! P
|
|