|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 d! B$ `- S6 S4 ^6 |' U
- [code]EDMA sample test application
# c: F, ^1 g+ f- b5 I! p+ J) O# e/ O, d - /*
; P ]$ t! e0 P, {$ ]7 ^! A - * edma_test.c( k( V, t3 V @" r5 D
- *
j( |2 [6 Y* z - * brief EDMA3 Test Application
! n1 B) ?+ X { - *. y8 I. d5 c- y% F5 ]
- * This file contains EDMA3 Test code.
7 l. s( A8 v. L9 F/ ]; w - *6 d# }' ?% C8 X2 }- n w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 Q8 |& D( D8 [5 z( P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( Z1 I- n9 U0 G' p, G( D- c1 Y - * TO CHANGE.
8 @3 s/ H1 A# v. u- L - *
- u* g3 u: d4 c& f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 I5 }7 Y9 \& n, x
- *, w; i b. M3 E6 t
- * This program is free software; you can redistribute it and/or
; ~6 P0 l4 A; ^! E& q" D - * modify it under the terms of the GNU General Public License as- M/ [: f: A9 c
- * published by the Free Software Foundation version 2.3 S$ X+ t1 j. W$ X% y. W& e
- *
% G& C+ F) p: Z6 E; V4 J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 j5 J1 N5 t& v ]2 P& L - * kind, whether express or implied; without even the implied warranty
+ S# \0 g0 ` K& S/ f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; B- e/ [: W, d: F" F x - * GNU General Public License for more details.
& M* h1 G- m' A) M- J2 J - */
5 M, n* I& k7 e0 E
h4 Z' ?" ] F# A( t: E5 V- #include <linux/module.h>
# A' Q/ k( L( u7 a7 d - #include <linux/init.h>
8 g' H8 ]3 k/ O) C( t: N - #include <linux/errno.h>( z2 ]" Q% N9 y$ ]! V* X
- #include <linux/types.h>
# Y) u# D; h# q' H - #include <linux/interrupt.h>' N* @3 H& @7 p7 r* T' M# b
- #include <asm/io.h>
' y0 c' | s. f& p9 X$ o- i8 z, U - #include <linux/moduleparam.h>7 E3 G; F7 B/ r1 n! v
- #include <linux/sysctl.h>
( w0 e& N h4 ?1 @" F - #include <linux/mm.h>8 B" d: @5 }/ p
- #include <linux/dma-mapping.h>
, X, h& ~( k8 k+ m6 q0 y8 {3 Q
. x5 g9 n0 f1 b. ? r1 q; j- P- #include <mach/memory.h>
- a- n! B. L6 D% u& x+ ^" R5 B - #include <mach/hardware.h>1 y( G: B1 P% x' n' ^# a
- #include <mach/irqs.h>! t' v8 x3 O* T- X: ?& m- b
- #include <asm/hardware/edma.h>$ D0 M2 A4 c& p/ r& o0 ?' Z( I
( }3 j3 ]$ J6 r4 z! d6 ^- #undef EDMA3_DEBUG- v$ s! `/ E$ j6 y% D
- /*#define EDMA3_DEBUG*/
2 x% t3 ~, a3 F H& r - . r3 P5 {# W! j6 i# R$ ^/ ~
- #ifdef EDMA3_DEBUG
) S1 m' M0 M9 b0 k* e: g4 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ M7 S% w8 X* w9 C( T6 D: i% r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
G9 I1 x' V6 R8 R! k! d9 l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. B% M1 H; B$ R2 J1 M - #else7 ]- ^) O8 ~8 e) M
- #define DMA_PRINTK( x... )5 Z' ]8 M2 l6 t4 ~
- #define DMA_FN_IN* y) |4 v" e- _' Z T8 q* A, h6 M
- #define DMA_FN_OUT
+ z, U/ O, S7 y) F& G; v) V - #endif
! d* @: a2 T0 s3 O4 x3 u - : Y4 n; k3 L2 V. O [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# X- D! a- ^# J( C" h. z - #define STATIC_SHIFT 3
- _# W3 F3 ? l9 h - #define TCINTEN_SHIFT 206 D! C+ ^3 n4 Q V4 z6 A
- #define ITCINTEN_SHIFT 21
( j8 E, D, g# E1 Q& w, M1 y - #define TCCHEN_SHIFT 22
! o) {1 Q. U' g. E- c- {) m1 E - #define ITCCHEN_SHIFT 23# ?9 Z0 g! `/ P6 g: W% y- g
- ) ?* c9 D- F& B( p6 ~$ n
- static volatile int irqraised1 = 0;& i1 J7 @+ @/ H7 W! @6 n: y* l3 L, [
- static volatile int irqraised2 = 0;! [" Z, b2 U9 M% R% t% P
- 0 G7 d5 N/ Q9 o3 S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" g- ~- X6 a, n; K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& `5 e y q" x8 G& S$ I$ t0 E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 {/ D; F, B- n" Z8 ~; K9 W
: H& o$ j, \3 ~1 A: ?- dma_addr_t dmaphyssrc1 = 0;1 H& D9 P |9 o& ?& ?+ j1 f
- dma_addr_t dmaphyssrc2 = 0;6 b7 r9 S( L" {& C6 x% Z, f
- dma_addr_t dmaphysdest1 = 0;
+ G4 I+ r2 Q3 G - dma_addr_t dmaphysdest2 = 0;+ G' V* ]8 w: G0 I& q3 Q
5 s( |4 q# Y- [3 M, x- char *dmabufsrc1 = NULL;
8 w5 m# K0 p% ]0 c$ I - char *dmabufsrc2 = NULL;
: _5 K# v5 Z4 P [2 Y5 t - char *dmabufdest1 = NULL;2 G; o, g+ a, }+ B" `" l
- char *dmabufdest2 = NULL;
* q, F) R7 b1 m6 h4 K
; q* O: Z$ J6 {' _0 o9 {- static int acnt = 512; ^& j8 X& Y8 Y: r$ A( V
- static int bcnt = 8;
# h$ j, O) F0 M* n7 C! F) ~% m* J - static int ccnt = 8;
" |) W7 o3 A, `+ j - # k" W I+ v. O
- module_param(acnt, int, S_IRUGO);
$ z u. n/ R: k - module_param(bcnt, int, S_IRUGO);
9 C1 u( ?/ Q6 L+ G - module_param(ccnt, int, S_IRUGO);
复制代码 # h2 k' G) o7 A
5 K0 b+ S9 }8 e% T: M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. X, f3 B3 m# V l: ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% q, J7 q. P3 a8 `; ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ }$ T7 e5 a6 L$ X
. k* f$ {# Y6 m4 H* c
4 ^' }. `7 _) j+ H9 z5 R7 X |
|