|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / f( L# ]+ v9 F( W* ?
- [code]EDMA sample test application
' a# P( B+ Y0 \- \. i: Z$ z - /*
9 N R6 N: ~: I7 M) P0 x - * edma_test.c. D' h: w* o' b/ d) a* r: v
- *
+ q# N; t1 f- ` v: m# q' ? - * brief EDMA3 Test Application2 I" a' Q+ W+ E3 y4 a
- *) X' Q7 A A6 Z
- * This file contains EDMA3 Test code.* ^4 i/ {: [3 E p3 f' C
- *9 i4 h7 y$ z& N1 H f" o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, v0 A* c' z, B. a/ { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% y" c& ], B1 ^& C7 D- T! t: h
- * TO CHANGE.
( A8 b7 V8 [. ^7 k' r+ \ - *
& ^ A/ u: V6 z+ s3 i# l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ g/ k3 H) h6 ]5 ~% w# H( r - *
6 @ P( ~; b8 X - * This program is free software; you can redistribute it and/or
7 o. w4 E2 d5 G" K4 p1 l. W, } - * modify it under the terms of the GNU General Public License as. ~9 g/ U8 l4 e0 [5 W
- * published by the Free Software Foundation version 2.
0 n: z( g4 |7 X - *' E j7 A: @4 Y& T- f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 q* g2 B- f* k
- * kind, whether express or implied; without even the implied warranty
" u- c! }* N/ A4 T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 N) J3 q2 ?) p% m) x: o& ]
- * GNU General Public License for more details.
. p1 n. _4 u# g$ d - */
, C& p0 O( K- R" e# M r( `( Y - 1 O7 Q+ Q I" @. e( |, J
- #include <linux/module.h>
( K" f2 @2 q1 _7 x - #include <linux/init.h>
2 r. k' C1 j* j0 Y5 { - #include <linux/errno.h>( b2 D' _! |2 K
- #include <linux/types.h>
2 }/ W+ A" c g9 k" w5 P - #include <linux/interrupt.h> t' F4 @; J: S! V- }
- #include <asm/io.h>5 |: M0 B7 R d. g
- #include <linux/moduleparam.h>. {. _ j1 P! q I- r' P
- #include <linux/sysctl.h>/ X" E& A5 e! ?
- #include <linux/mm.h>' B; a. @4 ?! z2 B$ [4 ?4 d
- #include <linux/dma-mapping.h>
' \) I: z; R: l+ k6 y* X- e
5 X5 P. d5 c8 `9 ] ^' D& ^: y- #include <mach/memory.h>' f- {( U* O( Z% S9 B: U1 U
- #include <mach/hardware.h>
- H0 Z3 j1 _! Q1 }. a' x5 t6 h - #include <mach/irqs.h>, q2 C* S- c4 E8 U
- #include <asm/hardware/edma.h>+ j- w) P( b0 c t. u8 Y' M6 @
- ! c' z2 \- d6 T& b5 R; m, W
- #undef EDMA3_DEBUG
- ?2 ?" N; C0 `* {: {% u - /*#define EDMA3_DEBUG*/6 |+ a+ ]2 r+ K3 A6 R# o
. H3 f; ]* J n- n" h) V- #ifdef EDMA3_DEBUG0 A Z1 ]+ B! s: T# w$ I; [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 e" x( f- F, v& l) h) B: v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); a4 a7 q6 d1 j( O) j/ p; Z! E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" @' T: U! u4 M9 g( {2 K6 \4 `
- #else
" b l6 Q; Q, c; r0 R M1 I - #define DMA_PRINTK( x... )
6 b( A* j9 \5 P7 h5 u+ s: D# I( `# C - #define DMA_FN_IN
3 I* q- L+ |( V - #define DMA_FN_OUT$ x# R! G& ?$ |$ Y* Y$ u0 A! h
- #endif; z" ]; S3 A8 B
* J- K: }5 O# V$ O2 D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ x% f) a9 Z9 T t/ O/ M0 f1 g7 m
- #define STATIC_SHIFT 39 T8 }- v" @" K
- #define TCINTEN_SHIFT 209 Q" V# e* v- _8 h
- #define ITCINTEN_SHIFT 21
% @) o( ^" Q7 N" D3 o4 Q3 ~! e9 w - #define TCCHEN_SHIFT 22
; F- P( B( o! E5 ~- r% [ - #define ITCCHEN_SHIFT 23
% @/ Z$ W) P8 E7 ?' F) L2 R- U - 9 p8 F; R( k5 D! w/ Z
- static volatile int irqraised1 = 0;) C& J8 ~/ c5 }( \+ M1 h
- static volatile int irqraised2 = 0;
" d; B9 F( D( g: S) y - 3 N+ e s$ o% g& v5 k/ }' D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; B2 c$ u. {. N0 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# q' l5 L' F$ N& R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% N+ |* r+ I8 o, z: Q
7 t" J9 E B8 x; g! ]. {- dma_addr_t dmaphyssrc1 = 0;- e8 _" }3 h: a. [- K5 \" _
- dma_addr_t dmaphyssrc2 = 0;
3 W4 D2 [' y* u; a& I - dma_addr_t dmaphysdest1 = 0;
0 a7 `$ z3 C% D - dma_addr_t dmaphysdest2 = 0;
1 A& e( }. s$ X9 L; E, s. e9 p
, c- O9 y T+ r* K Y3 _4 W q- char *dmabufsrc1 = NULL;: N/ p* F7 S# J
- char *dmabufsrc2 = NULL;
2 i7 Y2 B; P! r6 A - char *dmabufdest1 = NULL;: N @+ u& }; d9 C; M2 w9 A' u8 Z
- char *dmabufdest2 = NULL;) h3 o, t" x4 C1 m
, b7 R9 i! l4 u+ ^4 X- static int acnt = 512;" |5 Q. @9 V6 G5 q' U
- static int bcnt = 8;% o+ h4 y2 m8 O* m. W( @- U8 U
- static int ccnt = 8;
# E8 ?! C/ O/ v; h
: \' a- d7 c+ I! ?! t! E- module_param(acnt, int, S_IRUGO);# N, Q! {3 D3 ^$ R& v4 \
- module_param(bcnt, int, S_IRUGO);% ~3 y) N- }6 A9 g+ D
- module_param(ccnt, int, S_IRUGO);
复制代码 8 |% T: o4 a/ N' u
& O+ Z$ `. O+ ?0 M9 c- | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ R6 X' @ V8 ]7 U1 u0 j7 L4 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) T# z F4 Z2 i+ a. \$ g1 W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: J3 _/ K! b% k$ N# a) a$ ^. `3 j! _7 r7 W, R
* p2 | m1 `7 {2 @2 n |
|