|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - Y5 G* y& y! S. S) e/ h
- [code]EDMA sample test application9 x9 x% O( B0 T- t, m9 W
- /*8 d6 U' c1 k5 i# f/ `' _5 m
- * edma_test.c
. X1 q3 t* {3 N( T - *( F/ f: O1 T0 `+ \
- * brief EDMA3 Test Application3 }+ Q) [( p- ^0 W
- *) X5 k! Y2 Y# @, P0 F9 A
- * This file contains EDMA3 Test code.3 j+ c' F9 B# F2 w4 v+ h
- *
$ |+ C- P: ?/ \; g' } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ x9 Q2 r0 D& ^& p4 C/ b. ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ W, n" @; t% T1 ?& Y( i; O$ E - * TO CHANGE.
) C! ~2 n' }9 @/ c - *' R/ H% l3 l1 K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ^; E! v0 Z& W7 {+ s3 a9 t f y
- *
0 u7 Q- Q8 l) {2 R3 o6 J& O - * This program is free software; you can redistribute it and/or4 W2 \, L! ~7 ?' T5 k" ~% T) {1 T$ h
- * modify it under the terms of the GNU General Public License as
$ t5 l! ?$ @& S3 l* V( r& } - * published by the Free Software Foundation version 2.
* X* ^* O4 c( _+ R0 H: D& K E - *1 i8 V3 D P" w* c; X$ X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* l. X2 y- }* j! k
- * kind, whether express or implied; without even the implied warranty
, j; e0 r7 a1 }. L4 Q0 w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ x1 w v, p1 [# g - * GNU General Public License for more details.
4 X! U! M- W8 _/ U9 X, V$ s - */
( l$ @# S# m) z - ! n' a/ B) o8 }
- #include <linux/module.h>
# a( O# H4 I$ G: L$ g. J- w8 @. G - #include <linux/init.h>1 p; s; T6 \7 z; S, C7 J5 M
- #include <linux/errno.h>: g9 J [; S/ u( A( y5 @
- #include <linux/types.h>: P/ o) r5 m0 k7 |0 x6 Y
- #include <linux/interrupt.h>! v2 m& R* [: M' D
- #include <asm/io.h>
( e* z6 @! `. p9 i$ m( B) R3 q7 c - #include <linux/moduleparam.h> Q- s6 Z0 v" l/ l
- #include <linux/sysctl.h>
# {8 M* {2 a8 ?: T3 D% ^ - #include <linux/mm.h>
- g% U7 E( @ o- V - #include <linux/dma-mapping.h>
2 p6 ?+ G+ @% Y3 @4 f4 G
& B" W: _4 [8 s# L- #include <mach/memory.h>, R9 V7 o: H( y2 |4 E- I; A
- #include <mach/hardware.h>
+ Q8 r0 i t: V8 ?5 h - #include <mach/irqs.h>
# s% O3 H4 _) G9 Z - #include <asm/hardware/edma.h>
3 J( g+ H6 v) Y: e6 e9 x: ^
6 ]& L+ \9 m: y, l- #undef EDMA3_DEBUG
}/ G; r. Q) y/ D8 P - /*#define EDMA3_DEBUG*/( r& t& u) f7 D( u' k2 X6 L( D
- 2 d4 Z" h$ U4 z$ z. l
- #ifdef EDMA3_DEBUG
* n2 [6 k3 B1 b" v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). g# G5 }( y& U; }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 P5 h# j4 w$ `" F! O0 w9 n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 O5 Z, V2 c$ t- x3 F0 R
- #else
- U- `" U& P1 H9 Y+ U+ x# G - #define DMA_PRINTK( x... )& ?( T5 w. S8 V8 d3 W* n `& U8 i
- #define DMA_FN_IN5 H4 d/ c, ^! Z% @" R1 ?- w
- #define DMA_FN_OUT
8 R* Y/ ]5 B5 }( j6 @ - #endif! n8 N) o3 @- ]9 ^( @3 C% @
- 3 M' m9 [4 }8 q/ K7 K- w9 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! M4 v, J1 C1 ]% D4 O0 `! E1 d' a - #define STATIC_SHIFT 3& u/ U1 A# d9 N+ y0 r+ ^% r
- #define TCINTEN_SHIFT 20
0 y" i7 j+ C$ [( [$ p1 b# { J - #define ITCINTEN_SHIFT 212 ^+ W/ p. W* z" F0 _! F, Y
- #define TCCHEN_SHIFT 225 [3 d t: N1 p2 f
- #define ITCCHEN_SHIFT 23
$ V! @. P! ^) Y! N - . \2 N' w. i$ D' f
- static volatile int irqraised1 = 0;
1 j( T* a' [; _1 W1 q9 D8 F o9 U - static volatile int irqraised2 = 0;
+ [+ A& i# w/ E7 K) ]
6 C- n7 C. n3 U4 ?3 n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 s5 O2 }! v s& Y4 e4 u$ ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ ~6 P; T6 @8 `3 e* O# r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 [' H6 a. l! b8 {( E D
- 0 T4 b6 |* D" F, R
- dma_addr_t dmaphyssrc1 = 0;
' K, @/ h# ^2 R( T, b - dma_addr_t dmaphyssrc2 = 0;# S. R4 O, _5 P0 ~
- dma_addr_t dmaphysdest1 = 0;
' j. \+ ~) ^6 p; L2 X( S! k - dma_addr_t dmaphysdest2 = 0;3 |% t6 j" Q& E3 S- R- s/ `5 f
- + ^5 e" O$ D$ u8 ~8 I a- }1 C
- char *dmabufsrc1 = NULL;# d2 j1 k4 B9 E7 x6 m
- char *dmabufsrc2 = NULL;1 H2 a' ^8 N1 ~- l: l6 Z
- char *dmabufdest1 = NULL;' x) {, u) p/ w
- char *dmabufdest2 = NULL;
1 r1 }* e% a4 q5 v* y0 ~' M5 c- { - $ e# Z) N: j' j2 u" U3 ~& n) X' o
- static int acnt = 512;4 `6 N; I5 x- a9 s, `
- static int bcnt = 8;! y( ^% k9 R( O5 v+ M! q
- static int ccnt = 8;8 N0 F- y5 X4 d7 H7 V- k
H, I$ }3 T2 y4 V* F5 W- module_param(acnt, int, S_IRUGO);+ V( W- ]6 p3 I: S" D ?) b
- module_param(bcnt, int, S_IRUGO);" [8 I5 }! q8 g$ m. z
- module_param(ccnt, int, S_IRUGO);
复制代码
: D% k5 l* w% ~
/ Z: P% F/ b) L C3 A4 d" F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 q4 `1 @: w$ A- d+ @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ \3 | Y7 A, { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 H' v# P$ P6 L4 x% h
- ]: ? N- _% r, Z9 F+ M
* ?0 W) g' @" X0 H3 v
|
|