|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - w. I$ l& R; V* D* I! {
- [code]EDMA sample test application
6 [" N; Y5 U4 i/ w* i6 |* S - /*
! N8 i& Q/ Z6 E2 x$ A$ S - * edma_test.c# F3 k. `# s( l" \- X
- *1 j2 \$ q4 s/ [9 B: e5 ]
- * brief EDMA3 Test Application1 t( X0 `% R! f# G: W, I
- *) h' d$ e4 } G! C
- * This file contains EDMA3 Test code.
|; G& o: X& P6 p; c7 | - *
$ K1 |4 h5 s& J, n5 T `# G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE g/ V: A4 F3 t: D- h) `2 ^( j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, N6 g8 d3 x5 o6 w9 M
- * TO CHANGE.$ _8 o" ~( Y& Y9 Z6 e
- *+ A- g! P; {" Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 ^) F: z5 V$ V, [, O3 p" K( K
- *4 J! [0 L& w+ c1 w2 f
- * This program is free software; you can redistribute it and/or k ] v1 b: j1 J
- * modify it under the terms of the GNU General Public License as1 p1 \: W+ N6 n2 U$ A- C8 E
- * published by the Free Software Foundation version 2.3 M9 k" V$ Y/ [' U
- *+ r! r$ N6 D8 w+ L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' ?9 T, f/ u& Q) P/ T- i7 D - * kind, whether express or implied; without even the implied warranty0 e* K7 |7 z0 q5 v0 [/ N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: |- H% r- q5 W* A - * GNU General Public License for more details.
3 M5 {. E5 R) d5 P& ? - */& N! O4 t& x0 q' z. L
+ w/ p; T8 L5 _- #include <linux/module.h># \, U9 ^3 |$ b
- #include <linux/init.h>
4 t2 b+ y, I4 Z( `& M. f; i7 {+ u3 R8 u - #include <linux/errno.h>
8 d. l) c: ]7 I. N' k - #include <linux/types.h>
# p! Y# O B2 K7 n# J - #include <linux/interrupt.h>( i {: t" @2 n: X
- #include <asm/io.h>
# ]; O# G! E( O' r) s+ y, r+ \) G - #include <linux/moduleparam.h>: ?7 ~1 z) S- h" h
- #include <linux/sysctl.h>
) b) i( N& m$ L9 X; h% h - #include <linux/mm.h>6 H. b4 p; U: h% H( g$ E
- #include <linux/dma-mapping.h>
+ F2 b: p* O, N1 Z; }: `7 _
8 M; { J1 P7 q* Q5 s. X3 ?- #include <mach/memory.h>
4 J3 @3 l* T' O( c - #include <mach/hardware.h>& b2 F0 s' K! N; |0 z& C! C9 [
- #include <mach/irqs.h>6 |% R( [% l6 ~/ K
- #include <asm/hardware/edma.h>
* W6 _, s. u+ x, Z6 E: ^, c! s
' V0 I2 B) s( o. v! _- #undef EDMA3_DEBUG
3 t/ ?" K7 f( ^ - /*#define EDMA3_DEBUG*/
) V9 O# c, u7 O$ `6 U8 n" w. D
L% {- r+ A; A B6 d: h+ I4 A- #ifdef EDMA3_DEBUG* ^3 ^" Z9 s6 w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ Z7 z. S1 r9 p$ K6 |' ~' `* [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( g& N- z- W8 k% J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
H/ e0 Y1 q- L( L* a2 C- C m - #else
; _1 z C2 w# u% F7 q1 b2 ~# Q$ n# r - #define DMA_PRINTK( x... )
1 E; J4 v" C6 [* M: k! i - #define DMA_FN_IN
3 m& w& n" t" Z! C0 n, c! ? - #define DMA_FN_OUT- _$ ?9 J: M* A2 u0 |
- #endif
- H- g$ J. t, O: o/ r$ ^# I j* m! F& K - ( M, k( D4 b& h4 H8 w' N# b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 ]! N# w+ {1 w/ W9 H
- #define STATIC_SHIFT 3
; R! Y# T) ]' K1 m - #define TCINTEN_SHIFT 20; L& d3 M) R/ s0 E6 b
- #define ITCINTEN_SHIFT 21+ n3 {( P$ o* N5 K
- #define TCCHEN_SHIFT 22; r: B! C& L) H# L
- #define ITCCHEN_SHIFT 23
1 o2 |: n6 ^* Q5 [9 w1 S0 p" l - . o" g; `, U: r; a
- static volatile int irqraised1 = 0;
! {7 j& G. C5 x3 H+ i8 m - static volatile int irqraised2 = 0;
& {8 M: F6 [7 u; `+ A6 }5 r - - c" X7 w+ Z+ e* g) m }' I' C2 o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 N5 Z, \( G, _5 g+ s8 D" D1 [( Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 J" ~7 m& ~0 x9 j3 b- |, Q% ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, |- e, `% g/ h, l- g
/ D- L1 ^% y0 t! E- dma_addr_t dmaphyssrc1 = 0;
8 {8 M7 T& V3 r: o2 b4 P+ O - dma_addr_t dmaphyssrc2 = 0;' j8 r; }' n9 m; C5 t8 f8 D# @
- dma_addr_t dmaphysdest1 = 0;( |. G' L( b* s. N- i) `
- dma_addr_t dmaphysdest2 = 0;
7 ^4 \% S% X' f% p9 k3 b2 ?
! d k5 U2 t6 `* T8 x: s; J- char *dmabufsrc1 = NULL;
9 N1 \/ ]6 S" Z - char *dmabufsrc2 = NULL;
7 V7 L4 Q, a$ W; ]5 f: s2 C - char *dmabufdest1 = NULL;
u) d7 X' y# j. S4 {) J* g% O - char *dmabufdest2 = NULL;$ m' B, h$ b8 |& r
3 o% a5 ]4 S7 t; ?5 I, W- static int acnt = 512;
% L- _" [) \- p* X+ w9 g - static int bcnt = 8;$ ] i6 L% H9 Y& p% K" E+ t
- static int ccnt = 8;1 Y6 C/ U! n q, a: x
8 X6 C+ x' D! j% k% W9 r- module_param(acnt, int, S_IRUGO); X3 s' ]4 I5 | f% p+ p# J: @1 v; g
- module_param(bcnt, int, S_IRUGO);8 ]+ U% i" Z! O" J4 x
- module_param(ccnt, int, S_IRUGO);
复制代码
6 ]4 D6 W- I1 z9 E! b1 R# y4 H
# v' ^8 C# W2 O" M5 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. m {3 q8 n8 r1 e3 L0 y6 H
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* S, U7 Q J7 r/ n, J( V3 T# C0 _0 o8 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! \; q+ R- P( I# u6 \4 T
- i4 Y; V6 f A+ m) S; P
[7 V* R, d# l) n' T8 T |
|