|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . S( { r4 k! t' ?4 B
- [code]EDMA sample test application
$ p9 u0 {+ W3 @; t - /*/ c* W" o7 v5 q0 Q
- * edma_test.c$ ^0 V9 c( A: i% k" S
- *
. ?' p& d+ d9 t$ O" a) w. t - * brief EDMA3 Test Application
, ~2 Y* j7 r0 v7 a# }- @% t - *6 j* u M4 j% V, h& ^2 b" @: Y8 V
- * This file contains EDMA3 Test code.
% S6 I5 y$ l! l. ^7 t8 V; V) S - *
8 z* e/ Z. W( i. v4 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) N7 [( O: p4 H( n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) ]# u8 d* H- V6 d
- * TO CHANGE.9 X; Z5 h4 r( f
- *5 i( V4 ]& |, K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- \' @+ ]2 q7 l& O* I2 X - *
0 Q- W; E, T2 r t2 g* J - * This program is free software; you can redistribute it and/or" t! ^$ M8 B; ?
- * modify it under the terms of the GNU General Public License as
5 W7 K1 e7 O# l1 @, S) r - * published by the Free Software Foundation version 2.
1 c4 |# N0 c. @( Y# A# I& [# n - *3 n# M+ g0 ^- M. V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 a# p& _ L u! G0 o
- * kind, whether express or implied; without even the implied warranty
7 M+ E( t' ?/ f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 ^3 }$ x. |5 y, \! m
- * GNU General Public License for more details.4 u6 [5 l/ H+ I( U# ?
- */9 t" | Y- W4 v
7 C8 A$ o/ ?% A, i9 h) e% j- #include <linux/module.h>* Q! ]( k0 B# }, K' m
- #include <linux/init.h>
# E: M) @" _& l - #include <linux/errno.h>
* J7 G% ^. A9 V# e! z1 S1 j2 n, \ - #include <linux/types.h>4 N( S6 C) }2 B
- #include <linux/interrupt.h>
& y+ S6 @2 S. m3 K6 V# v - #include <asm/io.h>" k% }! ~/ \2 Z9 e9 g) x+ S
- #include <linux/moduleparam.h>
( g3 S3 q" Z) B0 I - #include <linux/sysctl.h>
. F& }! ~( e$ }8 L. N9 Y - #include <linux/mm.h>5 k' d5 Q0 |1 |5 S+ s0 F" B
- #include <linux/dma-mapping.h>
. E: D/ U- M6 [: d
6 I$ v. [2 }6 j" |9 U0 }2 K- #include <mach/memory.h>. \# g" ] ^; v4 j
- #include <mach/hardware.h>8 ~) ]5 x' X# \: T! D) b- `( \2 T: f
- #include <mach/irqs.h>
$ x% i3 b3 Q* E4 t* E+ k! d+ n - #include <asm/hardware/edma.h>
7 _) M% D8 T! d: S- o9 c. X- d
1 r3 X: r$ \' k# |% R- #undef EDMA3_DEBUG6 g5 f8 k& K* b& t
- /*#define EDMA3_DEBUG*/
4 W& r6 f% `5 ^7 g! N
6 W2 _' B w1 H- I- #ifdef EDMA3_DEBUG
! u: W, u% _! c$ O" j5 p2 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, B! Z- S; V6 O9 W7 t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), F9 @! J9 [8 I, k* E( Z5 d' A! w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& K! a/ Y- b& o: y - #else) ]% U" x* _! u
- #define DMA_PRINTK( x... )
& Z! ^' ^* ~" Z - #define DMA_FN_IN
" @5 t9 }1 t0 \/ j; Q - #define DMA_FN_OUT- w' ~, C: c; }" q" T
- #endif+ o g/ I% I7 V1 h- O' t2 b9 Y
- , K. a# c) V6 e* o4 g: n/ _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* P6 _, H/ f6 O _& s, [6 E9 _
- #define STATIC_SHIFT 36 X5 e% |/ }; {' y& k+ Z
- #define TCINTEN_SHIFT 208 D1 k' P$ j+ ^) o
- #define ITCINTEN_SHIFT 21
" ]$ Y- N C, o1 m$ C5 D5 i - #define TCCHEN_SHIFT 22" w, g6 [, A( q; j
- #define ITCCHEN_SHIFT 237 w( S0 k' T" @2 `- q6 M% V
- 6 j+ W' _& u' {$ z. j6 O
- static volatile int irqraised1 = 0;
/ J! n& J, m7 _4 [ - static volatile int irqraised2 = 0;
2 C$ I7 x: A1 W2 \) ?2 h
7 q' O k. F. ?) j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: L4 I+ B$ \7 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' c& A2 w- ?; M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ U- |0 P, A8 g8 R( |" @+ c/ F - , \& g |( I3 L; D
- dma_addr_t dmaphyssrc1 = 0;
4 s" B. J m8 s+ y0 j1 B - dma_addr_t dmaphyssrc2 = 0;% V( I0 Y% K: c( V) g
- dma_addr_t dmaphysdest1 = 0;
5 y) d, e, b6 E3 P) s, c - dma_addr_t dmaphysdest2 = 0;# j& S# a0 s6 B0 V6 n7 C$ n8 G
- : N8 `/ J$ l# V" S: @9 N
- char *dmabufsrc1 = NULL;
, U" u% Q( U2 x# t7 a - char *dmabufsrc2 = NULL;1 j+ u8 _3 s9 R; F4 y
- char *dmabufdest1 = NULL;
+ R+ S9 \7 n. [7 W+ U2 [ - char *dmabufdest2 = NULL;7 k8 d0 \. T9 L4 E5 j
- 3 W0 F' v. `9 @) k/ l
- static int acnt = 512;" D! @6 B- l2 }5 z' h+ P
- static int bcnt = 8;
3 y5 g C% j& h, y3 M" n4 f: o - static int ccnt = 8;
/ o( ]% C$ q! J! u9 P - & I8 L& k2 l0 ~
- module_param(acnt, int, S_IRUGO);8 Y) i3 ?6 O' P! }
- module_param(bcnt, int, S_IRUGO);
" W- f4 n+ P C0 L4 u - module_param(ccnt, int, S_IRUGO);
复制代码
9 n* ~* o# r, F- Y2 y& p# c% ]8 Q. `0 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ |6 V4 Y2 k! Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 i* ^0 b3 ^: V7 N! g" n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; b3 k& S0 ?: s0 o5 f/ E% l/ G
7 O5 T8 Z' M) i+ p7 N
* X4 ?( {+ U9 C& D' g8 Z |
|