|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 u" U+ d# G5 d- [code]EDMA sample test application) d9 O- Q, H8 i, @2 I# h" C. J
- /*/ l/ R, H$ ~: F, u
- * edma_test.c
+ K' s, V- b; w - *
1 b- ?; m+ H$ K1 S5 d - * brief EDMA3 Test Application; l) \, i% \7 m5 X
- *% S* X, L: q8 j
- * This file contains EDMA3 Test code.
( Z- F N5 O9 I, y - *- S2 |& ?$ u$ Z8 S4 s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 R. R; k1 R. O& x/ I2 t6 q8 ^* W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 }( o, {6 `0 e$ } - * TO CHANGE.. m2 k5 w. B# f- p' V" B2 z, e1 p5 Q
- *! y l! _: q. u9 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, ~( v5 B, A# \' E2 h9 M - *
) u: r0 D. f" [( \* O% e* r! q2 F - * This program is free software; you can redistribute it and/or
2 Y$ D2 ?4 }2 y$ J5 R - * modify it under the terms of the GNU General Public License as5 L E! n; T7 A4 [$ B. a9 @
- * published by the Free Software Foundation version 2.; m6 k7 n6 X) \0 q) k- U
- *& R f; O. ` j5 p( s1 Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ D. F, w/ z9 o* @4 ~ - * kind, whether express or implied; without even the implied warranty
+ D" h \' {/ K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 i1 I2 D$ U% ~7 N3 [8 b1 w( o1 s - * GNU General Public License for more details.
$ R% A. _5 I0 C: q3 R5 u6 s - */
! m/ T/ ]8 m2 u7 I9 X
- ^8 |0 j: b/ n4 k+ Q! P# N" B- #include <linux/module.h>+ p+ W/ N t) R/ s8 ^
- #include <linux/init.h>! i9 s+ o6 P& U8 W/ l) u; g& x( A
- #include <linux/errno.h>9 }1 @" c8 r+ X, L
- #include <linux/types.h>1 k6 f/ b8 r9 N2 j
- #include <linux/interrupt.h>6 f% U; w5 f8 J' A2 Q( n4 m. M
- #include <asm/io.h>% l: S' @4 c* B5 S! N# I1 D
- #include <linux/moduleparam.h>
7 {" K8 R$ C# i6 W1 K& [ z - #include <linux/sysctl.h>
$ S1 Z' P2 {+ v1 ?& c% u" N - #include <linux/mm.h>% N6 J v& V \
- #include <linux/dma-mapping.h>
, ?! N) s' G; ~7 E
7 ^# C$ r7 i: A1 R- X- #include <mach/memory.h>' H& v @6 t7 M/ Q" d: _+ R' E8 i
- #include <mach/hardware.h>' h' r2 f* {& r7 ^& a
- #include <mach/irqs.h>: e: q1 N! Z) k7 h
- #include <asm/hardware/edma.h>
2 U( x5 F8 p! k0 _1 f* D
+ \2 H" T( Y- w `- #undef EDMA3_DEBUG! x8 w* E& ~) P$ Z; {
- /*#define EDMA3_DEBUG*/- N; E8 E# G$ s
6 A& F" W# t' Q& r( m: K! j& X- #ifdef EDMA3_DEBUG
0 L( Z0 I2 d0 ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& E& M0 [/ r" f2 x3 x( R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 O7 [) n+ V8 S8 c& v( X2 i2 g# o" c: N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ |( H1 ~( c1 j- D) W
- #else
# l# U* @$ l7 ]' R - #define DMA_PRINTK( x... )
! B4 W2 I! F R2 T0 l - #define DMA_FN_IN
2 b7 B# [4 }+ S( m6 O$ B$ v ^' g - #define DMA_FN_OUT# ^. u1 O. r7 d1 H) r
- #endif
" J- s H. O$ t# m$ e, Z - " V, O; Q/ \1 a6 ]4 u$ o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): e' S+ \6 t% M3 Q4 _8 I
- #define STATIC_SHIFT 3! ~; v( N" Z" Y9 f) E
- #define TCINTEN_SHIFT 20
) h: z# t9 r" d1 F - #define ITCINTEN_SHIFT 21* P! m# ]! _: T5 _% `: u
- #define TCCHEN_SHIFT 22
) {2 W2 `2 H3 R7 f8 u - #define ITCCHEN_SHIFT 236 w% n$ ^( x( o* V Y" n
8 }) }+ Q' k# S2 r5 m' Y- static volatile int irqraised1 = 0;
" }2 Y/ J9 d) Y( u# |) E - static volatile int irqraised2 = 0;
% _' V: V s6 B2 n0 N8 j- `- k3 I. M - / \, O# A1 B9 z2 q7 e7 m5 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 |' T; I. F) r. D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* _% U; ~! q5 h& q% ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: F- E8 _4 A0 H$ U4 z
9 `0 j' X5 Q% T+ X7 c! l6 Z7 i& U. Y- dma_addr_t dmaphyssrc1 = 0;
4 ^1 X3 O7 v; ^$ `( O+ L - dma_addr_t dmaphyssrc2 = 0;
- b2 s5 \/ n, S4 g - dma_addr_t dmaphysdest1 = 0;/ R, y1 ~% x& J, G: a7 J. L$ B
- dma_addr_t dmaphysdest2 = 0;! U# }2 p' d6 K. V
: M2 l4 U3 @+ m! h. f- char *dmabufsrc1 = NULL;
# @, x+ k! Z' E! a - char *dmabufsrc2 = NULL;
! f7 [! _$ d8 i. o- t1 l. a9 @% E - char *dmabufdest1 = NULL;3 h& F7 h0 ]1 V0 I+ }0 L
- char *dmabufdest2 = NULL;* Q: k5 d+ S! g+ D' b/ ~
3 ~- C& @! q# x2 B* M; x- static int acnt = 512;' m0 u! h# Q0 D0 I7 i- O
- static int bcnt = 8;
- g6 Y2 l8 e* T+ J% k, `) Y - static int ccnt = 8;
6 O) j' Y7 i4 r) y - 8 l2 T$ \* G# y6 K: Y
- module_param(acnt, int, S_IRUGO);
7 x; U0 r. z( X8 F - module_param(bcnt, int, S_IRUGO);1 J: n" @" N: k" ]" B# ?
- module_param(ccnt, int, S_IRUGO);
复制代码
+ L7 t- R" \( c
8 y1 Z; T) b5 W$ t* P7 Z, C- G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( Y. H+ N3 O6 L3 h! X! `+ n0 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 P/ V4 }& K% {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 s, w5 ~# F2 z9 X, \, U
6 u9 u" P6 D" s. a4 O. q* W" ~6 S [# ?% g1 V/ T
|
|