|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 ^$ T0 m9 S# ]1 g& d$ R: w" L
- [code]EDMA sample test application
- W9 F( ]% C5 T4 Q4 P - /*, i4 u; s0 }% _, p& c, g
- * edma_test.c6 y7 F8 `* A9 H! A/ D
- *
2 o/ Y* I, w7 Y* _+ T9 V - * brief EDMA3 Test Application; |/ q; U: p: }& T' z: m
- */ ^) X+ n9 c7 ?1 e: R
- * This file contains EDMA3 Test code. Y6 Y+ j) B; {+ H% K
- *
! G( G3 y" ?5 t5 S8 [& e+ S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 U! a7 [/ a" ^) y$ Z1 y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! m& F9 s8 C# `- S
- * TO CHANGE.
/ \! G7 N+ [- d: J - ** Z% o5 K! v& U9 S4 n. ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& W# f& s( t7 t
- *$ u( h+ s( z# \' p- ~
- * This program is free software; you can redistribute it and/or
. |+ `1 a& d# K4 Y+ G - * modify it under the terms of the GNU General Public License as. t* [+ u! F/ Z+ M
- * published by the Free Software Foundation version 2.
6 H: U( R. K) u$ s - *
$ e5 [6 z \9 y8 x; c4 s. S) | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. u% d9 Y) {7 ?
- * kind, whether express or implied; without even the implied warranty
6 F" f! x1 Y1 M, W" P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ _; s N# _8 G& X, C- `6 O S, c - * GNU General Public License for more details.
# z9 T; M( }- q) o3 E' }; p/ x - */1 f0 j: G4 O) P( c2 H
- " o m2 y ]; [, u! S7 Q
- #include <linux/module.h>
4 Z* ~' o4 M: h2 ?' U) E- [ - #include <linux/init.h>
# I) H. W, v4 z0 q: j; a. y1 c - #include <linux/errno.h>
$ B+ G- {7 F: ?. U% p" l* K* J3 Z z' f - #include <linux/types.h>; k( u/ |/ T( A* J
- #include <linux/interrupt.h>
/ H* W8 {# {' l3 _- L3 b - #include <asm/io.h>+ w" t7 d: U) `+ v7 q# H
- #include <linux/moduleparam.h>% s1 m# X+ K9 [% G4 C* t: r
- #include <linux/sysctl.h>
( M& n7 a" s6 y' a# s4 Y4 q: c) x% g/ U - #include <linux/mm.h>
( s7 R9 j/ j$ x& _% B9 s5 v - #include <linux/dma-mapping.h>1 I, e* v* [/ F! F7 Q; k D
( ]2 S6 U* ], [8 @- #include <mach/memory.h>
. L' i- n' d5 ^$ z9 o& A) k1 Q. m" N2 y - #include <mach/hardware.h>& B9 U4 j, X( M+ G$ m: Z8 M
- #include <mach/irqs.h>5 ^& u$ N- [1 J, E1 }" Q# T
- #include <asm/hardware/edma.h>, p) g. o S4 {) e( a- Z" Z
% |# ]9 G* l( \3 X! K( p0 M6 L, t- #undef EDMA3_DEBUG( H. p3 E, u) b
- /*#define EDMA3_DEBUG*/* n! F. z! \4 {- m
k F3 g) i. o# R- #ifdef EDMA3_DEBUG
5 J, L2 i# H% r7 z" e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! @0 t( J1 J/ _ |# e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 E. m, r. _1 E4 Y; o/ U d( A+ t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# y5 v6 w! c2 {
- #else
1 i! d; a8 }6 F - #define DMA_PRINTK( x... )0 W5 m2 m0 ~8 \2 c/ _$ ]5 a1 i
- #define DMA_FN_IN/ }6 }! R$ e% k7 b% b
- #define DMA_FN_OUT
6 p% u4 t+ u8 A. t' Y1 [) u( d - #endif/ t. E! x, m$ r6 H4 m8 T! h
, k6 F" n& r. R( t0 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 e5 p( y* _3 U4 C( f8 v. R
- #define STATIC_SHIFT 3
9 `) X. P5 O* D, L, J8 f1 R+ i& ?8 y - #define TCINTEN_SHIFT 20' N' M0 x8 ~9 p U* N; T" K' a7 X( y
- #define ITCINTEN_SHIFT 21
" q4 }* k ?# q: Z+ @ X" s1 ~ - #define TCCHEN_SHIFT 22
) \/ y1 p$ m* H6 o4 ?* d. u m - #define ITCCHEN_SHIFT 23
8 Y6 c+ d3 _7 x; F e5 s R - 0 M; k: P; ?( ~& a3 ]2 v) y1 S
- static volatile int irqraised1 = 0;6 ^# L% t+ n' U6 B; u) E
- static volatile int irqraised2 = 0;5 J; @# y% E& @. s
) K* u# {1 M# |! s/ ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 b5 W! t" C+ m: Y8 ~+ p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 R- L* E1 x0 Y2 K8 Y' c$ F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 l7 o h% E9 R* i( E! L2 P
. C: i7 {$ x$ f$ W& @) b/ ^- dma_addr_t dmaphyssrc1 = 0;
# Z3 D' a% z7 f0 _2 k" V9 I* ? - dma_addr_t dmaphyssrc2 = 0;
6 I; w& l7 d) w4 }& Y, _4 a( \& f - dma_addr_t dmaphysdest1 = 0;
/ ^- y' ^5 l$ M - dma_addr_t dmaphysdest2 = 0;1 Y) F; R- c7 l# Y* J; A# ]0 a6 a
- ) O W9 ?/ [" K1 y$ R
- char *dmabufsrc1 = NULL;( B' B3 w r& L1 q) r
- char *dmabufsrc2 = NULL;& \' T) J4 S8 R5 d" f( e7 }- y
- char *dmabufdest1 = NULL;+ f( X n) l; L. `% p8 ~
- char *dmabufdest2 = NULL;8 s9 r! V; ~% i5 S+ J( W$ q
- 3 p; q; R5 s- K, k
- static int acnt = 512;- k; l( r' O% d9 Q A
- static int bcnt = 8;
6 X7 ]% ~/ ^# F* B. Y - static int ccnt = 8;
3 U2 K2 L6 U a$ E! g3 U9 E - ! I" V( e: E9 ]
- module_param(acnt, int, S_IRUGO);
& H1 r% p0 {" W3 U: M# M - module_param(bcnt, int, S_IRUGO);4 X9 ~5 m2 C4 c0 W
- module_param(ccnt, int, S_IRUGO);
复制代码 ' R0 b( y9 ]2 r- w% I+ k F2 k
& x; R& j3 _ K: ^- Z7 I) z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( F- K4 m9 v C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% [+ I0 Y- o, f$ h1 |; e- A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 @* I- r0 f+ i- y) Z; }: l- M. b. P. Q3 j. l
# u" L( }, [7 S9 p3 s; D
|
|