|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # ?+ O7 u! W4 U/ {% z- p
- [code]EDMA sample test application0 d% S& g4 n a% @+ P
- /*) l$ Q: ^+ X% H+ T4 [
- * edma_test.c
6 \9 ~2 k R2 {# M4 r - *
/ P! A' M7 x! v8 p& i* ]+ B - * brief EDMA3 Test Application
1 q9 v% R6 C% r" O+ G$ f; v( \! t% { - *1 P6 u: { ~) E* P2 h W7 m
- * This file contains EDMA3 Test code.
+ e+ L2 s& Y$ D7 _: K - *
/ s; B C7 S+ B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 ]' G- L9 C9 Q3 v w. I( d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& t9 [1 N1 B- M4 Z' V; r @" g - * TO CHANGE.
& _+ c5 d( |2 h+ ], ? - *
8 B6 `$ i/ O m3 O& @+ a K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# u; s5 V1 C% K# n9 i% v - */ z8 [6 ^* i; @3 _, G
- * This program is free software; you can redistribute it and/or6 q* W, s- B8 X- S
- * modify it under the terms of the GNU General Public License as7 ^. O+ T6 ~" H- D* g
- * published by the Free Software Foundation version 2.. g7 |4 r) c' Q% j
- *
4 L; z/ B" j3 U. q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 X5 ~$ X, {) H; D) r
- * kind, whether express or implied; without even the implied warranty
+ s3 `+ E& ]! b6 h8 ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 _; P1 |3 ~4 c9 t' v/ { - * GNU General Public License for more details.; X2 @" `. B/ n& p' F1 J" o4 W
- */7 ] s- w, Z* }9 x# ~" V1 G# ?
- : ?! `" f& B1 l* U7 k3 q/ p
- #include <linux/module.h>
+ }2 \# C: Z+ p& |1 [' ]$ G( v - #include <linux/init.h>
4 z) D8 E' ~9 a0 p - #include <linux/errno.h>+ q6 p, [* N O. `: w
- #include <linux/types.h>) i3 t1 n6 h# V6 p
- #include <linux/interrupt.h>
/ ~4 k" Z+ x; S- ~" W - #include <asm/io.h>
1 B& G- D M9 T9 e0 Q; T& M5 y - #include <linux/moduleparam.h>7 c/ D4 E7 c" t1 {
- #include <linux/sysctl.h>) K+ L! n: O% W' W9 }2 v
- #include <linux/mm.h>7 [9 e3 x- t+ u2 y! h+ Y% k
- #include <linux/dma-mapping.h>9 K2 |2 e. e; b0 @; L
5 P( W) ]1 Q( \; n! i5 s- #include <mach/memory.h>
2 u- y" P( p: ~+ |: g& Z; A - #include <mach/hardware.h>
1 {' [- h4 c) M) S: A2 ` - #include <mach/irqs.h>7 T% }# \. d: L7 q: K, j4 F+ ^
- #include <asm/hardware/edma.h>
/ M) [0 I) e2 {* ?7 G! D - 7 B# l5 F7 v6 i5 v- c+ p
- #undef EDMA3_DEBUG' H! [7 i1 O" ]/ k2 d- t
- /*#define EDMA3_DEBUG*/
0 I( r2 P. `) R5 J8 P; [
: h9 ~' H) f3 C2 L- #ifdef EDMA3_DEBUG
6 O) B" _, t' T7 C: O$ v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ~& A5 O$ @7 Q! F* ~3 j% \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ x# k9 k; g+ U1 E3 |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. b. S) H+ p5 g. e, @ - #else
% R% Q2 U5 {, i8 H5 U6 F$ d% { - #define DMA_PRINTK( x... )+ R/ \) q; `' d# { L; M
- #define DMA_FN_IN( O9 Q! V! a* N! B9 r! u p
- #define DMA_FN_OUT6 d8 q1 _+ P1 a# K5 W0 P
- #endif( V- W- ?; N' Q+ \# C/ A0 o8 r
- * @) c9 [. c7 k6 |0 e" i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' v9 ]" G0 q1 G1 z+ b
- #define STATIC_SHIFT 3
; ~ P2 L# ^7 V7 x1 J% h - #define TCINTEN_SHIFT 20
1 [; X, q3 e) p5 Z - #define ITCINTEN_SHIFT 21
5 W) A" F' [' J- I& [5 r% @2 J - #define TCCHEN_SHIFT 22
8 w; I1 P* t, h- G: E! d8 O - #define ITCCHEN_SHIFT 23 Y$ Y0 e& \2 K% c
- / o1 ~! o- q/ ^5 q5 X, E& R' B
- static volatile int irqraised1 = 0;
. Y/ R; T: Y6 d- t6 z' b - static volatile int irqraised2 = 0;
, Y8 Y; ^/ L/ N! }7 o5 t: ?) g& a - 9 z0 X) Y# G5 h& o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 o3 a, K$ y/ d$ [7 q: V! ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); @; g! Y! S& q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' p1 W- r4 U: s$ i0 t( e4 @: O1 Z
& y$ ~6 _2 Z. L8 B3 o' o/ P5 l# f- dma_addr_t dmaphyssrc1 = 0;
" t, W1 ?' B, n0 b0 g - dma_addr_t dmaphyssrc2 = 0;+ {$ Y, R2 G& W) C8 J; n
- dma_addr_t dmaphysdest1 = 0;" w2 F8 H; }* ?" M/ s
- dma_addr_t dmaphysdest2 = 0;+ x% S( Q& r$ u* I1 u0 _" b) p
) g6 d c( S$ W- a# Y$ N- char *dmabufsrc1 = NULL;1 y: C- }$ y4 Y- V( U5 o" _
- char *dmabufsrc2 = NULL;4 g2 W h2 O' `" Y% |6 ~
- char *dmabufdest1 = NULL;
7 U% S' w+ i. U/ S9 U+ U+ J - char *dmabufdest2 = NULL;% i9 m( @2 [6 X/ s
4 ~2 Y5 I( d& H- static int acnt = 512;
/ n- p3 w' t( _1 | - static int bcnt = 8;
) r3 e+ D p9 Y' H - static int ccnt = 8;
3 a+ D N4 q# | - & ~0 C, u# v9 M$ r0 d0 x, O0 R
- module_param(acnt, int, S_IRUGO);4 P( w7 }" j: G3 `& C" S( A
- module_param(bcnt, int, S_IRUGO);
; `+ E% g) G% o! P" K) J) b - module_param(ccnt, int, S_IRUGO);
复制代码 1 M8 V, ~4 t1 u/ H
$ X# A6 e: m/ z- A, b {! I% `& A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ M6 J! i8 M4 F6 q' i6 r- E" {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- X5 i6 Y8 Y% I' ^# l* K( M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; A$ g1 J. b+ t- E q6 u% L8 E
- T' ~" r/ F$ h! x+ j% `1 k2 ]2 q
0 }. [# c1 a$ j |
|