|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & \; B1 {- ~0 P i( L: h
- [code]EDMA sample test application ]+ G5 n# t- J, H+ s6 B" ]2 _
- /*: i) a* q- I0 c$ \: ?
- * edma_test.c
r% c, P/ J" {" z - *: E+ x% ?. M* J+ l) z3 Z0 Z
- * brief EDMA3 Test Application
" g9 N. ?2 O+ V3 x$ m - *3 S, C8 O. s+ A$ q- ~- M
- * This file contains EDMA3 Test code.
0 K X! s% j+ ]1 ~8 u9 j- _3 ? - *
- U* o% N& ]$ h1 q: u1 L4 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ ` S4 k7 v, j1 M2 W- k9 [( |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( {( I s5 O6 |
- * TO CHANGE., [8 @5 x8 @3 Q/ i
- *( \8 j. ~" h3 a1 Z: G/ p7 n i2 @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) B# t. f2 |8 Q* K$ w - *
4 v. S9 o% M( v/ r' ^ - * This program is free software; you can redistribute it and/or$ ]( G+ X6 T6 ?" b, w& O/ t
- * modify it under the terms of the GNU General Public License as. W8 M0 ~. r2 b& ~" Q
- * published by the Free Software Foundation version 2.1 o% p' L" A p0 f5 Z7 |
- *
3 }* r2 R% P8 o6 Y8 l! q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 C+ m! A g0 ]& M B6 U; F - * kind, whether express or implied; without even the implied warranty
! @' ~ G1 R$ Q' G: k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 {; u1 \! I, B' {+ a& q2 j - * GNU General Public License for more details.& ?+ A# c/ f% O) `6 x& c
- */
9 Q3 M6 T$ _9 x/ D9 u1 p" Z
: B$ |% P& y7 {- #include <linux/module.h>3 @2 J( e3 m6 E- P
- #include <linux/init.h>( P [( Q- x3 K) P0 ]4 v
- #include <linux/errno.h>
" C- Y' R+ e$ J1 j( g Y- R5 \ - #include <linux/types.h>5 b- I" Q. {5 |- b5 S: ~: H
- #include <linux/interrupt.h>7 b5 r1 k: w1 p8 @
- #include <asm/io.h>* @2 a+ ~% n( S, {- _) |, H; H1 i; H
- #include <linux/moduleparam.h>
; d6 c6 {8 ?+ D - #include <linux/sysctl.h>) N1 x0 M5 Y" h% Q
- #include <linux/mm.h>3 a W7 B# V: ?6 m
- #include <linux/dma-mapping.h>
* I7 e, Y3 D7 [6 T4 K' z - 3 k* q$ y+ m9 |! t
- #include <mach/memory.h>
6 ~& N' `3 p2 H V - #include <mach/hardware.h>
1 |2 A. B3 a% v$ g+ C% m; b - #include <mach/irqs.h>3 s& s! ^- R6 j* R$ L2 u% |& p
- #include <asm/hardware/edma.h>% G# D4 s3 S. z( c
- * u7 g' l4 C* W3 e M- d: Q
- #undef EDMA3_DEBUG
. @& P5 @+ q/ g8 o: a, v+ J - /*#define EDMA3_DEBUG*/4 g$ e$ w4 K2 ^+ [9 X/ o
" @! ]& q$ G4 t$ h3 l( d- #ifdef EDMA3_DEBUG
- r) G2 Z# I' c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 d: X5 C( t/ b9 y* J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 e9 z; w( @4 _& U( ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, Q, }/ A1 ^8 Z/ l6 Y/ V - #else& I( a0 y; j' K
- #define DMA_PRINTK( x... )
8 j& A- ?, s. X! M - #define DMA_FN_IN6 s& T6 L* T7 p l. U
- #define DMA_FN_OUT
2 K2 V- c4 p- }) H, j, d - #endif
5 R/ ] l% n) X* O( y - ! ^. @+ \! Q3 [3 `- J. \+ `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). d( V, @& _( f1 n- P% z
- #define STATIC_SHIFT 3# n9 K9 @( l5 R& y3 X
- #define TCINTEN_SHIFT 20. C1 l/ N! w5 O
- #define ITCINTEN_SHIFT 21! ]8 U6 g, z+ n. M
- #define TCCHEN_SHIFT 22. T: i } }; M& `- ~7 w
- #define ITCCHEN_SHIFT 231 N" F+ \1 Y, d; R) v
- 2 x6 e4 L! X7 o2 g. O
- static volatile int irqraised1 = 0;1 O, B$ |0 e1 H3 r- K
- static volatile int irqraised2 = 0;
$ z; M B: J; o% X) D; B1 v - 0 x- `5 ^2 [( a* ?1 |2 r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- h6 F0 H$ e2 s1 v5 s' K0 ?/ F& E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% }* y: ]3 Z+ q& I* @3 z' r# s2 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( g7 t3 e6 H. y6 j) q - % G F! j2 i2 E
- dma_addr_t dmaphyssrc1 = 0;
; R% D5 j4 S. I2 p, {4 m - dma_addr_t dmaphyssrc2 = 0;* q% l4 a: o6 E( i% }$ E
- dma_addr_t dmaphysdest1 = 0;
4 M3 e$ H3 n7 Z2 m3 e$ R8 j# d! H - dma_addr_t dmaphysdest2 = 0;. [1 u) O% O. f0 N* r) G
- 7 W9 Z* W- ?4 x% y. M* Q
- char *dmabufsrc1 = NULL;$ X- ]; Q C; Z' N( S
- char *dmabufsrc2 = NULL;" w4 S3 M1 `+ t* G# B
- char *dmabufdest1 = NULL;
8 u1 `' `0 c9 t0 h# N$ _/ ?$ C* U - char *dmabufdest2 = NULL;
; w9 I4 b" O0 S2 Z4 P4 F6 Q - % J; j) i$ C# L+ \
- static int acnt = 512;; {' }3 G0 E- `
- static int bcnt = 8; |, i5 T! c3 F
- static int ccnt = 8;5 M8 d* n& @: ^5 e) N0 e B
- 3 a, D1 {9 Q3 B: w
- module_param(acnt, int, S_IRUGO);
# `! b6 E2 z0 K6 U - module_param(bcnt, int, S_IRUGO);
0 I1 v- F& H6 F2 {2 e - module_param(ccnt, int, S_IRUGO);
复制代码
$ @& L1 @* L q' ~! H0 c. `! \2 v1 A. B; E" P9 i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' Z/ G1 e+ n# O: L. k4 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; P0 k. k) P' ^# l4 `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) T; Q7 |4 K0 F8 d1 b
' U8 U9 O7 l8 {3 K
& ]: N0 F/ d; o |
|