|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ^5 C) S1 @! l% @7 U0 k4 O- [code]EDMA sample test application$ q( U+ _5 P; a" D+ M, m
- /*7 P% L4 ]2 z6 n7 K6 E4 }
- * edma_test.c9 |' q( K1 `9 O% F/ [* ]$ d" I
- *( Z" w& p( D% F. L2 n! a
- * brief EDMA3 Test Application8 E% @ x8 f( W, S: q
- *# }8 A3 t- P: `( E, R2 p
- * This file contains EDMA3 Test code.+ `. L6 E& l8 C0 Q5 ~4 T
- *
. J5 x; l3 J1 u' L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 s* f0 S% T, Y: q1 z2 w( H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, M$ j+ l ?8 N$ n$ O! F2 \5 p6 T) P D
- * TO CHANGE.$ D- d) a4 X% a6 g9 Z: F
- *
3 }( s8 |% b! W; O8 }' t. Z% b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 K' B$ n! n) H$ s
- *6 G6 U8 T$ A9 E( o3 k$ c
- * This program is free software; you can redistribute it and/or
6 Z f4 ?" L$ W# j# b3 \0 F0 S - * modify it under the terms of the GNU General Public License as1 V3 f ~2 P! S3 E
- * published by the Free Software Foundation version 2.
, G5 l; ]4 |( W( } - *
+ v: H7 d( g6 [/ Y) ^! Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, u/ i3 E% {) Q4 T9 p
- * kind, whether express or implied; without even the implied warranty
- E" }* n" f/ p" K' a1 d B1 t& B6 [, U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" J3 u1 v9 [" ~' Y) o& J; X - * GNU General Public License for more details.
* q! ]/ l$ X) W6 Z - */2 |2 U3 u- ^5 g: E+ [
% s+ S; W+ J# M7 `- #include <linux/module.h>; l F* t+ L; X/ o( K+ m, w
- #include <linux/init.h>
% M% B$ [1 p! H9 E; Q8 o& N8 ~5 \% L6 H - #include <linux/errno.h>
' F: ]+ \& q, U+ r4 V8 K/ D - #include <linux/types.h>& I( g3 _% Y' |6 b* G
- #include <linux/interrupt.h>
! |/ x6 y7 y4 W- Z3 M - #include <asm/io.h>
" q: E* K/ r! C6 f! h$ \( a - #include <linux/moduleparam.h>
, | \, X$ n/ d& Q( Y) G, s - #include <linux/sysctl.h>! |' u' Z/ {' g: {
- #include <linux/mm.h>6 D% U: }- |8 }
- #include <linux/dma-mapping.h>
2 Q" Y* Z4 t0 Q2 w - . d8 d5 A0 Z' S/ X1 p, V
- #include <mach/memory.h>/ B, e* _$ l7 z6 |! b, l: k2 J
- #include <mach/hardware.h>
8 ?/ D) y5 N- F- `6 b - #include <mach/irqs.h>. e: F$ a* U5 R3 s
- #include <asm/hardware/edma.h>
4 F! h2 o0 T% Y, `0 @
, K% `$ M( E9 o& i$ k- #undef EDMA3_DEBUG
8 U0 R" N7 c( {' _/ R7 P - /*#define EDMA3_DEBUG*/8 p7 O: _$ U# y- O* ~* H; j
- v3 v* k& C7 {# [0 ?$ N
- #ifdef EDMA3_DEBUG
9 q$ P% h5 a4 l6 n% b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 f5 U% x1 f: i& a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 P! p1 I) V, A% b8 r% V4 t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% E; [3 z( x# {8 e - #else
$ q( s" M8 z- ^, W# D( l - #define DMA_PRINTK( x... )" b# G8 N+ u3 J5 E7 _9 F
- #define DMA_FN_IN
7 @$ F% ^; e3 Y, [( A# I4 q - #define DMA_FN_OUT9 j) M. n9 D5 N" q
- #endif
7 ]) n- F Q0 l
8 ]0 S, @, R& ~1 v( r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
|, ]' r [* {$ E0 S& v - #define STATIC_SHIFT 3
9 V i7 O$ y) r# `* l: x4 U! W6 H. @ - #define TCINTEN_SHIFT 20% M* Q- o0 n& j& y7 S4 d6 F6 Z
- #define ITCINTEN_SHIFT 21
& q5 Y# \0 t( M+ Q - #define TCCHEN_SHIFT 221 L' p, q! k$ \+ g& l( g
- #define ITCCHEN_SHIFT 23$ f8 M2 X! N, m9 q9 z! ?" v) H9 U. x
- ; V9 g, }* @0 H
- static volatile int irqraised1 = 0;
7 I) d5 a& T. H - static volatile int irqraised2 = 0;
' ]/ b+ ^% I- s/ I& `. G$ w9 x
* D3 D Z% B- ?' S& N \+ ^/ O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( t* O, I1 u8 U# A- q# S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% L/ v7 }- \0 f* o2 N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ?( c8 ~3 s8 p
- ( S! B# {, g, P0 h( `0 r/ I, n
- dma_addr_t dmaphyssrc1 = 0;: M4 t }" G. S- ?0 r% t f
- dma_addr_t dmaphyssrc2 = 0;& K$ w* n: J0 S
- dma_addr_t dmaphysdest1 = 0;% E# a& W L# w" M( y9 l
- dma_addr_t dmaphysdest2 = 0;
+ i# Q& V% L, S7 ~5 a: P - ' O0 z$ P5 G9 S" z6 X" \
- char *dmabufsrc1 = NULL;
& ?; b' a: l$ O% m' V. z+ ] - char *dmabufsrc2 = NULL;
( F( t/ N) m* z q - char *dmabufdest1 = NULL;
8 ]4 j0 O& G. ?$ d" l5 ?, i, X' N$ V - char *dmabufdest2 = NULL;0 b8 n% a1 a* O
- 5 Y' ^; f) N* j0 W( J2 \
- static int acnt = 512;
, q5 C N! g& M& O3 z# H3 { - static int bcnt = 8;
* R$ [1 ^0 ~" m/ z4 B- L6 ]/ \ - static int ccnt = 8;
# X; f8 g, b, G& @4 b
9 R/ q5 f: A" _1 R0 h1 O/ g T- module_param(acnt, int, S_IRUGO);
1 ~0 v R( d2 Z) J+ P- c - module_param(bcnt, int, S_IRUGO);4 T* q3 j5 U. W0 |: w( a
- module_param(ccnt, int, S_IRUGO);
复制代码
5 w; _( G3 @( o& r' K
* W' Q) w( P1 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 }8 ^: D! V3 R K6 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: G2 M) b# ]# \: X: V: G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 r. \8 x P8 q. ^6 W# n1 k
: p6 G/ e* Y& W1 B/ R/ E0 B ]9 C3 G/ b4 R# U! s
|
|