|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' {/ t% B; [% f) h# g3 H" f* `- [code]EDMA sample test application( o, t8 b) L& r2 u
- /*
% S0 P# A* ]2 B# x' [ - * edma_test.c
( C; U/ ?/ g5 I. ] - *
, ~, x! x+ d4 x C8 l - * brief EDMA3 Test Application8 i, J: \ c( u
- *9 o. R6 E7 q- ^# d# A
- * This file contains EDMA3 Test code.' I9 K- }# D9 n3 O% x3 J6 ?
- *
7 Q3 r1 L; e' C* `$ A' c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ q$ J1 ^# v6 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* ~3 N7 i( z: K1 E# F - * TO CHANGE.
0 D6 z' i' ~" b3 d w& y: U0 r - *4 e8 }( ] c+ x+ t5 i: G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 g. I' E- y- D- K8 E
- *: E! d7 @! j5 f E, B
- * This program is free software; you can redistribute it and/or; _" v V- c a( W# E& H- g
- * modify it under the terms of the GNU General Public License as
! i; `+ w! Z9 F1 D) Q9 c8 I - * published by the Free Software Foundation version 2.
* E L5 E+ l" } - *$ a$ v3 W6 Z b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& \) e2 J" z8 \% P
- * kind, whether express or implied; without even the implied warranty& D. h- O% s! R3 o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" e4 [3 f; A5 d( h/ L; p i& Z& L - * GNU General Public License for more details.
/ S4 c# Q. i; K- m" ?! y; ^ - */
9 Y! H1 W- c% Q
1 ?' z. O- d$ r- #include <linux/module.h>
+ \- t" L! t# c d5 k - #include <linux/init.h>
, O- f. X/ B6 O" v/ W, v( O - #include <linux/errno.h>
m3 M# c3 q' j4 ?- U& C' f - #include <linux/types.h>6 G. X7 a6 v* F
- #include <linux/interrupt.h>. Z- p% y! M: p" u4 H
- #include <asm/io.h>
6 }* D. p# N" J - #include <linux/moduleparam.h>. \* b/ u# ]; Z! s
- #include <linux/sysctl.h>& R. O$ R8 R# J3 H- L! F0 L3 _0 J
- #include <linux/mm.h>
% E* S/ S1 a: Y. u# k; c% c - #include <linux/dma-mapping.h>
' J0 d7 l: {) u2 d/ A/ ] - 2 R6 }$ }: o) u& P/ u
- #include <mach/memory.h>
5 z# C' ?0 M9 C0 y+ h - #include <mach/hardware.h>
1 a& h" x3 Y. O; r8 E+ w! O2 }0 t - #include <mach/irqs.h>
6 d; t$ Z6 J% M& z6 j - #include <asm/hardware/edma.h>" h% Z. ?9 V5 v) N
- 8 l& Z. y1 K% j/ g
- #undef EDMA3_DEBUG
& n+ `& v' E) D - /*#define EDMA3_DEBUG*/* V( \# ^0 ~; l; u
2 t: E+ C4 b0 m- #ifdef EDMA3_DEBUG" Y5 C2 ?6 [/ F$ r, ^3 h* n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 ^/ v3 L* B: L9 G) ]) t- d7 B* v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 r" G7 j& X. V! e: i# a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% R* L; c0 g" g/ R
- #else
& a/ n2 u, D/ r - #define DMA_PRINTK( x... )3 z2 s. p- c4 q* C" O( [; N2 ^
- #define DMA_FN_IN$ |- g5 X5 c$ f! Q/ s8 k8 [0 F
- #define DMA_FN_OUT
" @: D! d. r4 U; [9 H# T7 m9 j7 e* y2 K - #endif2 n1 b/ }; n. s, v
( r; e* q1 j" q6 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ }# a4 M( U" Q5 q1 }7 w+ x
- #define STATIC_SHIFT 3& w$ O& o' U3 r+ X4 W
- #define TCINTEN_SHIFT 20
, N& K, m' ^! e+ g - #define ITCINTEN_SHIFT 21
4 o/ b3 t" ]; x F" B* g8 J - #define TCCHEN_SHIFT 22. x# q3 r5 L6 J0 N; ^5 g
- #define ITCCHEN_SHIFT 23
# G5 L$ Y% f/ A1 O9 I* n ~
3 |# q$ N3 d! ~6 m6 {- static volatile int irqraised1 = 0;1 V" [% N& S0 e( T
- static volatile int irqraised2 = 0;
) ^, s+ M, l; J, K2 W
2 y' G2 {# i* J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. j* f4 H. u3 h6 Q0 ?5 \/ v! P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" R, n ]5 q) O/ G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 J9 t! A4 t( M7 e# G! d) | e - 9 ?8 C7 w. a) G& V8 A5 o+ W% N
- dma_addr_t dmaphyssrc1 = 0;
' _0 ^8 }" J3 K! _/ h - dma_addr_t dmaphyssrc2 = 0;
- k; d0 z% ]& ~ - dma_addr_t dmaphysdest1 = 0;1 d" K% Q8 S2 B0 X {+ B E! R
- dma_addr_t dmaphysdest2 = 0;1 K/ [" o% t, J# S. _4 z+ H
; J5 D: M3 M5 Z+ T! R/ ]- char *dmabufsrc1 = NULL;2 h( P. e5 ?3 j. K
- char *dmabufsrc2 = NULL;
. D: Q/ }, J* Y0 j - char *dmabufdest1 = NULL;3 c+ X$ F m0 R/ _
- char *dmabufdest2 = NULL;
' a) S7 H& N& y2 J6 w2 ]
8 f6 g! x! [% Q& b6 d- static int acnt = 512;. |2 G, U/ ^/ j
- static int bcnt = 8;8 |9 x7 @% j8 |! t$ {5 _. W
- static int ccnt = 8;, Z5 k, G& w/ y/ C4 b
- % G3 `+ X ]: C* K( b
- module_param(acnt, int, S_IRUGO);+ Q( G' U: A, ` W/ [
- module_param(bcnt, int, S_IRUGO);
: ~ k! g" u3 y/ `# @5 }9 E - module_param(ccnt, int, S_IRUGO);
复制代码 3 B, w& {# o% H5 o
, y& U/ x# T7 i+ t- \5 b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ `/ U+ q( t O: v: _/ Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. R) U/ [% D _$ u8 j6 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 i+ n! \0 x7 E5 Y& l6 G, y
: X/ E( m& r9 W" v4 t2 @& R, P7 J6 j% r& \# S$ F$ f& V! Q) d5 P" N' ]
|
|