|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& i" `- R a. I( M4 E: t1 r- [code]EDMA sample test application
) L% d/ Q, x8 {, E K( n - /*
; L3 f( l u7 n Q6 { - * edma_test.c
2 b* ?/ Y) l0 p- F - *
$ w. K5 t: \4 Z+ X! k - * brief EDMA3 Test Application
/ U4 d7 g+ R# n - *% A7 d, D1 d! |7 T0 t7 _; K6 v2 k
- * This file contains EDMA3 Test code.
4 O$ K- u9 l+ } b/ q - *- w" k' I' |* a6 G5 r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* F3 D3 {; ? r R. N# t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ g" E: |* Q6 r$ H( @3 `) W% Y
- * TO CHANGE.4 j" j, h& t1 }; f+ `4 }' ~
- *
, E. V" O q; p! v% ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 x1 ]4 s4 K* e# A# N* @ - *
4 P s! f7 ?7 k6 H7 Y- s - * This program is free software; you can redistribute it and/or
( }& Y+ ~9 Q; W0 A0 W, X) t - * modify it under the terms of the GNU General Public License as
; R* }1 o) k# o0 |3 m% O - * published by the Free Software Foundation version 2.: o1 `9 E: G+ m, `* T! z( d
- *" I0 b- m" W9 O9 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' s2 h& [. D4 b1 E7 }) L( F* R" c" F - * kind, whether express or implied; without even the implied warranty
w; K+ k4 t5 S; A; r6 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- Q2 N7 }- k4 s - * GNU General Public License for more details.
& v* Z% ^ t# i% p; U& g! S" b q% x - */
) `; z, s1 T1 v& z; Y- A
$ f9 v, s' r Y r( ?/ }9 M% Y% X- #include <linux/module.h>
5 H$ Z( |% X$ ]" r6 e7 H; W2 j5 E - #include <linux/init.h>. [4 \6 t( m* |7 w- ]
- #include <linux/errno.h>
+ |% M$ m5 F7 C; T' \5 u - #include <linux/types.h>
. v2 q3 n- V# k) Q9 B - #include <linux/interrupt.h>+ E& B T! v4 u' L; `/ D
- #include <asm/io.h>5 Q/ f' L( ` d
- #include <linux/moduleparam.h>0 i4 z7 n* H8 x& }1 I1 U
- #include <linux/sysctl.h>+ M; t8 T& R5 v- o4 x. [
- #include <linux/mm.h>
/ U5 t3 d. z8 S0 _ - #include <linux/dma-mapping.h>
6 R5 M- l: _9 y. u6 ]
) v! W, d4 h! K- #include <mach/memory.h>( R+ i \ M5 a& n& V9 v. ~
- #include <mach/hardware.h>
6 }% Q2 N0 ]2 r0 g1 F8 G- l$ h - #include <mach/irqs.h>
6 k2 I% X: _2 K* }3 I - #include <asm/hardware/edma.h>
+ ?3 k/ e* Q' F" C - ; f7 ~3 f# v- Y
- #undef EDMA3_DEBUG
$ a' p- R9 W) x: z. l* a; J - /*#define EDMA3_DEBUG*/5 I' L9 |% k6 s% q" Y
- R% K/ U( a, z3 C1 l
- #ifdef EDMA3_DEBUG
( o; ?% y1 p1 q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 _. y% Q! ?" G; c$ f& p& O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; b6 o3 n. u0 z7 K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* e3 y+ T* p8 ]6 o* T; z+ r, w9 V
- #else
4 }- v( F2 i% f% m5 q - #define DMA_PRINTK( x... )" Y7 | b! J6 M& B4 E; T) I
- #define DMA_FN_IN* z; j' V, Q2 S% f
- #define DMA_FN_OUT
" C" n2 ~4 o9 k5 W) ^9 F - #endif4 p2 `2 n( n2 N4 A$ M+ y
- L+ O8 c5 f" l2 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: a7 j" m1 i/ ^+ H. C - #define STATIC_SHIFT 32 ]+ P' y6 P7 p0 ?
- #define TCINTEN_SHIFT 20: [8 z) i& Z2 s) B
- #define ITCINTEN_SHIFT 21
1 I0 }" n0 t, j7 C - #define TCCHEN_SHIFT 223 h" y& v# m% d$ C7 x
- #define ITCCHEN_SHIFT 23
/ j/ f" v1 X: s6 ` - ' O4 z$ U2 t/ R+ z2 X& t" c
- static volatile int irqraised1 = 0;+ Z; [% [4 k4 ] m* y3 v* M
- static volatile int irqraised2 = 0;
8 w/ l$ j- p0 W) y& [2 V( U1 m, J
7 j9 T6 P. p- |9 @2 v! }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 z1 @: |. Y: I* h% [; l3 X/ g: ~& i" t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 h9 h) e' z4 I' m+ Z" H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) r8 c( }6 J- W M/ @
- ! h5 P( i4 a8 Y- L
- dma_addr_t dmaphyssrc1 = 0;
+ a4 }9 O: j( O* b- R8 B, F - dma_addr_t dmaphyssrc2 = 0;, I. S! ]' P% P. p: S
- dma_addr_t dmaphysdest1 = 0;
5 ]* l7 d8 n. X; _7 ^$ k7 K7 c - dma_addr_t dmaphysdest2 = 0;
# A$ i' l3 C: m9 q/ t. H' p
) X2 ~5 F% T+ h( d7 j) d$ E- char *dmabufsrc1 = NULL;
: H/ t0 N% {0 b# Z+ b' {; A7 L - char *dmabufsrc2 = NULL;
7 L W9 n5 m( ~+ R; \7 P0 }! } - char *dmabufdest1 = NULL;
2 g7 B9 J* B8 q1 e. X. u" f - char *dmabufdest2 = NULL;
+ j7 O8 c( j- I' \& ? - 8 L+ ~2 \4 r6 f: b
- static int acnt = 512;
) F% @ M% k! E2 k, H/ h1 e - static int bcnt = 8;/ `! O8 ?' H& g
- static int ccnt = 8;- u2 g7 p2 S8 O; y" p
- 2 h* {5 ?$ e u: R( l/ C' I
- module_param(acnt, int, S_IRUGO);
x/ O4 w- S8 C - module_param(bcnt, int, S_IRUGO);
3 M+ {' c/ I9 d) v5 F - module_param(ccnt, int, S_IRUGO);
复制代码
3 a- m) y8 a, Z1 \/ q% V6 ?7 t2 V( h. i- X" [. ~2 U% d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 T( _ V8 Z" Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) a O& }9 @/ v+ n' z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' k W. L" W% T1 O* q+ L& k9 n$ ]) P/ M" R) g1 _" T
- f' G4 e5 C i* e8 T
|
|