|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! L1 J* U, J% r& R5 p2 a
- [code]EDMA sample test application! k" i; b; j; M" z+ Y' b/ j( ~
- /*5 m' g8 `, E4 f& _9 r7 R9 h, @* k* Y
- * edma_test.c9 `0 s4 ]" Y5 @4 w" h
- *
8 o# x! ?" D# k) B5 ] - * brief EDMA3 Test Application! Z* r' [) {5 w ^3 {# S
- *7 g/ \; {6 N" a$ X4 t
- * This file contains EDMA3 Test code.
2 p* d! z9 M7 e( `8 ?. B - *3 C. W- e% J2 b" d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. @, z" h7 Y- o# t) M4 Y6 r# J( Q8 l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- j' j5 K% r% a2 E. f6 A - * TO CHANGE.
' m8 k' T1 |: { - *
) [& A0 a7 v, W/ u3 o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 R- B& ~4 n- i3 O
- */ e3 w, s6 g5 ^* ^6 Q6 K
- * This program is free software; you can redistribute it and/or& J+ F6 [+ c S: f1 b
- * modify it under the terms of the GNU General Public License as
4 _5 o2 k+ \! | - * published by the Free Software Foundation version 2.
$ l6 j+ ?( [( v$ Y& u u* F9 v - *
- K9 h# d0 N1 ^& ~4 J; c, y; {0 ?# Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 K$ X( l2 d e; A* Z+ _$ V
- * kind, whether express or implied; without even the implied warranty4 A1 U7 Z, j% Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ O6 g+ f S M0 i) u( ]1 L - * GNU General Public License for more details.
0 @1 j3 ^# P2 T. z& k- f& \ - */4 W+ B) q( U; U5 V m; x4 L
" h2 `7 h3 |3 F- #include <linux/module.h>+ c6 l" H: e0 l" C; @8 J/ s4 P; y# H
- #include <linux/init.h>
8 T, _$ ^1 @1 k3 u9 r' @1 g - #include <linux/errno.h>
( N9 B; P9 S/ C0 {9 B6 j2 Y z) J - #include <linux/types.h> k% l G- C3 Q/ i6 U+ W
- #include <linux/interrupt.h>$ f; V9 n- I5 g, _, y+ v, b
- #include <asm/io.h>
; R# N. i# i8 z! y# K: j$ l - #include <linux/moduleparam.h>
4 x7 r+ p7 ]' p - #include <linux/sysctl.h>
- L# j" ]( g: ` - #include <linux/mm.h>2 u) [" L) g" u8 o& s+ O% Y y
- #include <linux/dma-mapping.h>- Y; M& z2 t) h5 b0 \
* \) q+ Q% g& k2 l& r- #include <mach/memory.h>
" S/ w* U9 Y, R4 M& ~ - #include <mach/hardware.h>
' u, k9 D6 i- y! n$ x0 n' Q - #include <mach/irqs.h>' v$ `( {# D0 P6 O6 O
- #include <asm/hardware/edma.h>& o5 j0 s: C* i' l7 L
- / }4 S- F* Z2 {- G3 s
- #undef EDMA3_DEBUG. `2 c/ a( |" @1 k0 M# ]
- /*#define EDMA3_DEBUG*/: U+ Z2 y O; |- J3 E
0 F2 ?" Y4 A- v3 F5 F* K- #ifdef EDMA3_DEBUG
, r3 s4 b5 Z! H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 ~4 [# c0 Y* H) R+ Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) t; |9 N! U! a# z7 N( I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- m9 M6 Q7 h Z1 J - #else
" ~4 r7 u4 @8 t4 N8 `1 ]( A - #define DMA_PRINTK( x... )
$ g2 F3 s4 l% ^+ V _ - #define DMA_FN_IN
. H! x3 q' H' ^) h$ d% W - #define DMA_FN_OUT
! ]* g- ?1 u" ?! e5 K) z - #endif
& m- H8 A2 \' l4 N1 r { - 6 k# u# \9 o! ^* E8 y, Y: o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 D# ~: b, K9 t+ O - #define STATIC_SHIFT 3; W5 B2 r. M: c/ y: Q" Y
- #define TCINTEN_SHIFT 20# e9 m, S2 P7 t/ Q4 w* J2 h
- #define ITCINTEN_SHIFT 21- h: A2 N, T" M6 ?+ ]
- #define TCCHEN_SHIFT 221 x e E! w1 G1 C- d" M5 C, W
- #define ITCCHEN_SHIFT 23
' n3 H0 \* N5 I( T: p/ | - + E2 h3 s0 \6 r k {: n
- static volatile int irqraised1 = 0;
* C( a1 t8 U! c' K( o3 E - static volatile int irqraised2 = 0;( n8 `; c5 @; j, f
- % \- @9 X1 o: {- o/ i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' L5 [2 Q1 T/ J5 S! V+ W' [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) p( h; r. u6 A' r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ w% Y; f" m' a
, j$ z! K* z1 K9 V7 e w- dma_addr_t dmaphyssrc1 = 0;
: Z1 s, \5 H- \ U - dma_addr_t dmaphyssrc2 = 0;! @+ {8 |/ Y' d
- dma_addr_t dmaphysdest1 = 0;
9 b- P& U" H' ~7 }5 x4 ? - dma_addr_t dmaphysdest2 = 0;
1 n( b5 _" S* t9 p& O5 _) ^$ m
* `9 w$ h v w$ f `. T- char *dmabufsrc1 = NULL;+ Z3 O( O, a0 V5 T) ]
- char *dmabufsrc2 = NULL;" @) a0 T$ F1 @2 l9 p
- char *dmabufdest1 = NULL;
' J) L, B4 g1 p5 @! @. h - char *dmabufdest2 = NULL;: \( G) E7 j. I# _) M T% N; K
- , \6 X- c8 v) z0 x0 Q" R
- static int acnt = 512;# U$ j; d5 ^- J9 s5 u# E1 X5 u: i
- static int bcnt = 8;
. b: N4 m# J: a0 u& r7 V - static int ccnt = 8;; `) L7 z2 O( q$ O- L* T. Z0 k% A
! W, q7 w; ^7 p- module_param(acnt, int, S_IRUGO);
8 I" d! n2 v$ L5 n1 C7 F2 ~ - module_param(bcnt, int, S_IRUGO);4 |, s9 @+ s/ m
- module_param(ccnt, int, S_IRUGO);
复制代码
) A. t* O5 r, T! C! w$ Z& I5 ~7 ^4 g3 M' k, e& P6 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ J5 H- H- U5 P; q- d; m: N/ o, f* [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! ` U; `0 p# \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 R' i. F4 E' x
# }9 i3 \% y, g- r$ Q7 r
, N0 m4 {9 ]$ I2 L0 e: [; j |
|