|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # {1 a. T: E0 b9 p, X
- [code]EDMA sample test application$ A2 l( s" f1 T7 Q4 ?
- /*
9 l4 e2 \/ L( Y - * edma_test.c+ g; d7 T3 t" v a
- *
$ O8 O7 `3 f: ]# a$ K( P3 F: ^ - * brief EDMA3 Test Application
7 @) P9 w+ x! D - *
3 n4 P9 Y$ c1 I" C- y6 S - * This file contains EDMA3 Test code.
" d+ e5 p$ D8 V1 G( s - ** [% J- t# E1 N) T% Q0 W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 L2 H: y5 |8 ]& {3 k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) b: A# J; @& ~1 F - * TO CHANGE.1 ]+ C" N% h" w
- *, h7 h1 p! [- V: Y3 N0 t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ x; @! u# V6 A) d3 S - */ t2 R- |' t3 l& ]' K A7 u* L3 h+ j
- * This program is free software; you can redistribute it and/or
4 m8 U: T' [ A$ w( @ - * modify it under the terms of the GNU General Public License as' ]! `3 p/ P$ T6 a& Q8 p; Z
- * published by the Free Software Foundation version 2.- ]1 Z g4 n2 K1 R$ P* S
- *
4 o2 ]" n; m, n1 C! K3 ~, y9 _" A& Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ?( l+ n( M" N% Q" `8 G8 v+ ]- }$ n
- * kind, whether express or implied; without even the implied warranty
7 c* p5 Z/ Q6 L1 K, Y4 t2 w+ b8 g& D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 T3 l2 R/ q" i# o; M$ E
- * GNU General Public License for more details.; ^- h* c6 W# w+ q4 G; _; d, d+ w
- */
6 ?( |$ h2 _/ P/ j, y7 E
{3 L0 \8 |! f7 g& i+ r& k- #include <linux/module.h>( X/ j1 I3 s" C& G
- #include <linux/init.h>" c' w3 H' o5 w( E% `
- #include <linux/errno.h>) i2 Z. F$ N& o9 \6 n
- #include <linux/types.h>6 R" A4 p* K6 E4 I- |( E
- #include <linux/interrupt.h>7 p; n+ A; e. P' ]5 M( v }
- #include <asm/io.h>
' s( M/ A' T. G/ ~# s" a: ^ - #include <linux/moduleparam.h>
6 o/ f- f4 k( @) r - #include <linux/sysctl.h>
5 C/ c% i) x8 e" d' n- v - #include <linux/mm.h>
+ S6 g' N4 F2 C- { p+ S! l - #include <linux/dma-mapping.h>
. L6 x* j: d/ P# V
6 C I2 H1 \! ]( v% F- #include <mach/memory.h>( W8 f7 _' G7 D1 ]# c
- #include <mach/hardware.h>
7 i- A: M3 t0 J! ]8 B' e - #include <mach/irqs.h>5 f+ f. I) r. f" ^4 r4 t
- #include <asm/hardware/edma.h>
4 Q9 }( A! J& m |1 Y1 m9 A
- |( v2 {5 g+ P3 \0 X- #undef EDMA3_DEBUG- H( {) \, P" H! t# l& p1 m$ m( R
- /*#define EDMA3_DEBUG*/
* z/ l- `0 x# N" C6 H3 y E8 Y
! y" s r( h3 h+ L- #ifdef EDMA3_DEBUG% h2 j: l# b$ R# E! |% U- Z1 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* C9 r* i+ G, ?: v+ }; V! a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ [( D0 O" r! @! Z1 w7 K% I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& s8 d& \) L- \% p- K u - #else
3 N' H! U7 a1 d! L1 K - #define DMA_PRINTK( x... )) G' g c" {+ [9 c
- #define DMA_FN_IN
; K1 y$ d9 a" b( t4 I1 h5 `+ i - #define DMA_FN_OUT
( K$ g0 K. ?0 i' n4 r - #endif
+ @% @- V$ ~& ^5 A' G - $ Z" V! W% U% O8 {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# m" ]* v7 @5 [2 A1 j( j - #define STATIC_SHIFT 34 a0 W7 P2 o, z
- #define TCINTEN_SHIFT 20
4 j, a5 k, l% K1 r$ D+ ] [ - #define ITCINTEN_SHIFT 215 a$ V' `$ q# j# H% @0 d
- #define TCCHEN_SHIFT 22
' ^" r: k8 V- w- ^, M ~* }/ S H - #define ITCCHEN_SHIFT 23
( x( ?) R* t% W8 d( J' X
, U% H \2 C" v, h+ w- static volatile int irqraised1 = 0;6 j' L: X7 l0 i% p e5 W
- static volatile int irqraised2 = 0;& C6 f3 | T/ F
- 3 |+ c3 X3 ~- g i' y+ l8 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 S K" n5 w% w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ^: F }% {" f0 l2 F; T* K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u' w$ d4 n1 ?$ w- I7 j' |4 o
- + n7 m, `: R' A# E* e8 I
- dma_addr_t dmaphyssrc1 = 0;% j A/ H- i3 W+ K( B7 g% D5 N
- dma_addr_t dmaphyssrc2 = 0;
3 b% ~+ [. q& z$ }1 ]. a" z* D - dma_addr_t dmaphysdest1 = 0;
# U' w" ?; t0 r3 g - dma_addr_t dmaphysdest2 = 0;
) }# |' K9 T. n+ h2 `2 O2 C! z
8 `6 o9 Q9 w5 |% F) P- char *dmabufsrc1 = NULL;
2 R6 p! S- _& A: N+ U - char *dmabufsrc2 = NULL;
) O/ Q( R3 r6 n+ \ - char *dmabufdest1 = NULL;$ K7 x! G% c4 V5 m$ R
- char *dmabufdest2 = NULL;
# \7 W: M% T0 o - + y& Q& O" }6 ?5 o- j7 b G+ i
- static int acnt = 512;
0 Z7 H {% {6 ? - static int bcnt = 8;8 U' E' n; {6 K$ p# o8 n2 C
- static int ccnt = 8;9 N& O+ |5 X$ v. s; R0 ~5 U
- / _0 `: L7 s" q; b1 q
- module_param(acnt, int, S_IRUGO);
( j. |9 O0 l7 S; e3 | - module_param(bcnt, int, S_IRUGO);
& Q" s7 x4 J2 c) T) d6 x - module_param(ccnt, int, S_IRUGO);
复制代码 ) A0 P j6 t$ T7 s o$ h
9 r" f# O& j8 o) d, U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* M" T* j% x) I$ f: s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; m# E# ^" l( t2 {( {$ ^$ ~, n( f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" c& k# c4 {- X+ c5 Q' f$ Y& m
# L p( ^5 A* Y) y+ m7 D2 H' G- ?3 e$ S9 s: D, V
|
|