|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( J/ A7 T/ @+ k- [code]EDMA sample test application
! {4 A l2 f2 r9 k6 Q; L - /*
2 s4 f9 F0 }6 W - * edma_test.c8 `) |( z# W$ Q; l' _
- *
+ _5 ?& F5 Y' i9 E* |, v) h/ Q - * brief EDMA3 Test Application$ T5 |0 t. a& g* u' e$ q
- *6 m7 ]4 ?3 p0 d" P" k4 n. e
- * This file contains EDMA3 Test code.
4 f% w$ j# o. F7 k( ~ - *
! x) M( ~+ v3 L, m7 w Y3 k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& Z# M* t8 H6 |- n2 l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ l9 C4 ]4 c4 E9 o9 T Y* g
- * TO CHANGE.% N7 P# i. w& z" Z( k* {
- *& l- R. P5 m3 S! g" P0 l9 z1 g* V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, K# o; m: _# P- D- [* O2 c2 E5 K - *8 u6 J4 c$ o% R& V8 V
- * This program is free software; you can redistribute it and/or
. z: i3 W" k2 V3 _. I' | - * modify it under the terms of the GNU General Public License as
$ Q9 p$ @4 m5 d: q0 P6 n4 S( q; G - * published by the Free Software Foundation version 2.( x4 P( V8 b7 r. Y: A# W
- *3 p" C* @2 ?/ ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# d3 I! h o0 d: H8 Q8 ` - * kind, whether express or implied; without even the implied warranty
* r$ N1 \7 ^0 C+ f- B ]; B5 v, B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' I9 O' f z6 x! B
- * GNU General Public License for more details.
- l9 ~, V3 e' `" V - */" H7 C) `! w: u0 V, }/ N8 L
; C: m( k2 w r) ?- #include <linux/module.h>7 S8 s6 _ J( V1 |
- #include <linux/init.h>
/ \7 F3 v7 }& \' K$ k - #include <linux/errno.h>. ?# Z' W. s: |; z, F
- #include <linux/types.h>
! T! N$ Y% K# H4 ~! z$ Q# ~ - #include <linux/interrupt.h>
# Z! |% h$ t4 _8 C1 W - #include <asm/io.h>2 G7 D; I. \ n8 c/ I
- #include <linux/moduleparam.h>! d' w' R, s0 h+ C9 k$ T
- #include <linux/sysctl.h>& L) f& E0 p w- e9 v5 v; t
- #include <linux/mm.h>: w( n* O0 @2 m# L
- #include <linux/dma-mapping.h>( z. S; q! ^! ?% A- B7 k
- ; \! j4 F1 G/ \( \# w
- #include <mach/memory.h>; w3 U! w% V& `+ U: k' y) Q5 O
- #include <mach/hardware.h>2 B* _' w( Q: k( W6 Q6 _/ L
- #include <mach/irqs.h>
* Y v# a' X, `. e. [2 \9 H! { - #include <asm/hardware/edma.h>6 X6 P: b; E% v' l% `; d
- $ f; q# w0 |% y9 _" n
- #undef EDMA3_DEBUG
% ]. i4 r, \+ X6 [" }% T - /*#define EDMA3_DEBUG*/
6 Q8 ~6 J3 X/ a* m& M' p - , X }( i' _2 f& b6 l% L7 j" G
- #ifdef EDMA3_DEBUG" p& q9 i! r3 q- \* z! C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): |: f- h7 g6 _/ ?8 Y, _" t6 ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# e; Q( o Q4 D" }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- e7 i$ l9 k3 @: Y3 D: k
- #else
' F. I8 G: P" w/ [" X - #define DMA_PRINTK( x... )
2 o( g( {- z% c - #define DMA_FN_IN
9 |/ L7 w. M8 ^0 d - #define DMA_FN_OUT
& x) t8 [2 K7 `# I4 z: {, a+ @5 V - #endif
' D: D1 D* H& G# c) ]
+ t1 E4 k3 B* V3 Q: N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 t9 h! x8 V! X4 ]8 u- p - #define STATIC_SHIFT 32 ^. q( o- r2 p! S" U# u: r
- #define TCINTEN_SHIFT 20: m& H7 g. }' r9 y; p! F8 ?& |% E
- #define ITCINTEN_SHIFT 21
& F8 C: r+ R% k) G* X - #define TCCHEN_SHIFT 22
! M3 G& n5 x/ v. x1 C - #define ITCCHEN_SHIFT 23- D9 N7 N* i8 s
5 z9 W- R5 q k- static volatile int irqraised1 = 0;
" e1 h. N& K: X2 Z/ ` p& ~ - static volatile int irqraised2 = 0;! J+ H% r1 @9 w, s' L7 d" f8 Y
' \) X1 O& S9 V( D1 E9 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u9 v3 \; U; s, \, _' V& a7 ?0 {; E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 [8 a1 o- g9 u/ V* e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. p; G; e* J& `; |( x! @- u - * _5 ?' p( i6 B8 V$ h3 O
- dma_addr_t dmaphyssrc1 = 0;) l q; p! \3 H1 ]
- dma_addr_t dmaphyssrc2 = 0;5 V7 V/ @& g. [7 _* t& Z/ r
- dma_addr_t dmaphysdest1 = 0;5 ~$ e1 L. ]* J% ]6 w$ a9 g
- dma_addr_t dmaphysdest2 = 0;
0 n) n; ?( a/ C2 W
4 x: ]9 x3 }+ J1 Q8 `" t+ d- char *dmabufsrc1 = NULL;
6 ^) i9 m+ R) l: r - char *dmabufsrc2 = NULL;
- c F6 @* c5 t0 p% r$ L+ D - char *dmabufdest1 = NULL;
# `1 S4 \- t. c& ] - char *dmabufdest2 = NULL;# x4 F+ m* O6 C0 P3 W2 c( f
; g) ^& h& ?/ j4 W1 ^3 D- static int acnt = 512;
5 u! [) Y4 E% a7 @) M8 w - static int bcnt = 8;
6 c, V3 G6 _3 x# ~ - static int ccnt = 8;
. R9 z6 S/ X/ ]& v% P& b% b
* A3 x- f6 w2 f) [; p& V- module_param(acnt, int, S_IRUGO);& h2 [6 C2 ^; F u/ O
- module_param(bcnt, int, S_IRUGO);% F% A4 T5 x* M4 M$ q, }9 y0 T2 O% U
- module_param(ccnt, int, S_IRUGO);
复制代码 7 D$ ^: g b- B
$ _$ f& k) {& B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: v0 \/ s- t' j+ y( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, P/ S, g+ z+ p* q; ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ?# T5 H' H& ?2 I& C, }
: o8 |# I! m2 u: p0 {
8 C# r% V: l" @2 U0 ^7 P+ \ |
|