|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - T0 ]! _+ c/ }6 J# M( c
- [code]EDMA sample test application
4 \& ^' K" K# F3 a3 P& | - /*4 P- r1 T% z# F2 k
- * edma_test.c- O+ g. g3 F. O5 [. ~
- *5 q+ F7 M( R4 ^% e7 J+ J c. _
- * brief EDMA3 Test Application
6 h, t v) e- u - *
7 {- ~: r' o" F0 c; Z* F& L - * This file contains EDMA3 Test code.8 C, B. o4 T& Z1 B- f6 R
- *" J' i' z. s* m7 s8 G. W" w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 o! q) G# i! k! U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- b, Q2 B- T9 D8 @ - * TO CHANGE.
$ Z& ?' x2 X. j8 F' [ - *
4 n" g) k y# e( K3 ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 d5 v% c6 z5 Q
- *
9 q$ M4 T) l/ n# H; ] - * This program is free software; you can redistribute it and/or
! f, A' ?1 W- V% U7 P2 e# E. n - * modify it under the terms of the GNU General Public License as+ x$ ^3 {' J( [9 X U# v
- * published by the Free Software Foundation version 2.
# V2 [$ `7 p1 J( k - *
2 Y7 l' y5 P7 ~. W% ~: M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 R$ D+ x% E0 Q6 |1 q - * kind, whether express or implied; without even the implied warranty6 q$ V# q+ S% h* M% B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 T4 r; [2 ~5 ^8 ?; |, l! F
- * GNU General Public License for more details.
, P5 L2 o1 ?2 p - */, K, d4 F# u" o5 t* n9 P8 k4 O
0 ]2 {5 w# S. R" X- #include <linux/module.h>% R1 [* q4 B6 ~% Z
- #include <linux/init.h>
P: i0 w. x" w+ c/ L - #include <linux/errno.h> Y$ T" [3 e& L8 F7 j
- #include <linux/types.h>
$ x. g) x! s3 o) t! L - #include <linux/interrupt.h>- F* w( a+ c" [
- #include <asm/io.h>
* l7 Z$ |. G( m - #include <linux/moduleparam.h>: f j+ ?6 q0 L: G4 }* }% y6 ?: z
- #include <linux/sysctl.h>, X$ K1 k9 L. P: h4 ]
- #include <linux/mm.h>
/ j! J r- j" V - #include <linux/dma-mapping.h>
! C2 P' r& {) ~, i/ X& q - 7 l3 r! f4 I$ p6 z* d" M
- #include <mach/memory.h>
4 @- `& v& R7 ^7 L) N$ w - #include <mach/hardware.h>
+ r: v1 B' ^7 w( ]. a' K% q - #include <mach/irqs.h>4 x3 u' }* V, Q% ?
- #include <asm/hardware/edma.h>0 Y$ o7 m( T7 R& }: i+ J- D' D: Q
9 R$ E- u4 I& j1 X- #undef EDMA3_DEBUG
2 l5 |' ^5 v- s - /*#define EDMA3_DEBUG*/+ W) I6 m/ \4 k7 r+ N2 b b
- : x* X! N7 ^/ N* B1 `: O9 W
- #ifdef EDMA3_DEBUG) j9 k8 h; x: f; }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). A" n5 w% v) @4 R/ D8 F5 `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 G1 k7 \5 P ~! L, ^! P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( t: ~9 ~1 S! y M# [
- #else5 @1 G7 Y0 x3 K
- #define DMA_PRINTK( x... )
1 `% e/ d( n3 r' O' S" j7 ~ i& v - #define DMA_FN_IN5 z T. U8 n+ b' w! o. Q0 q# E
- #define DMA_FN_OUT
5 s5 [* X6 x6 V1 A, d - #endif
; T/ Q5 Z3 u3 M2 j - T e" M* v8 P0 j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, w0 ] K, p: k# i - #define STATIC_SHIFT 3. r, E' x$ L) L" d6 k+ |
- #define TCINTEN_SHIFT 20. D+ X0 U( U6 P* W# \2 s
- #define ITCINTEN_SHIFT 21
- u. r/ B% W3 l; n& V - #define TCCHEN_SHIFT 22$ G% e1 O; G- @5 T4 P
- #define ITCCHEN_SHIFT 23' A! g" ?: N+ G. Q4 X" N5 c3 M
" _( y% ~6 O5 s* o9 \- static volatile int irqraised1 = 0;
* Z x% `9 G( J# @7 T. U - static volatile int irqraised2 = 0;: R, Y; d' D: n+ p! q
- ! S2 o8 M# n; V; m' r Q1 I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 p8 w9 e* i& I) X- l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# S5 X+ f0 v3 W7 D' U) @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); @( L; ~' Y; @& Z
- ) [& _2 Z/ z5 V V
- dma_addr_t dmaphyssrc1 = 0;
* N6 U( H0 X! E8 ~$ @$ D; z - dma_addr_t dmaphyssrc2 = 0;7 V* o* x* o1 M$ B K
- dma_addr_t dmaphysdest1 = 0;$ [% Y( p( f6 Z' |
- dma_addr_t dmaphysdest2 = 0;* m0 o6 |: T" |1 ^- z
& [# M; T" z; P' m% I& i- char *dmabufsrc1 = NULL;
9 `' i: }- L* H. ]* Y, j$ n7 F - char *dmabufsrc2 = NULL;
. x' G/ b* Z/ @4 O" O: ` R - char *dmabufdest1 = NULL;
# e+ Z" \8 i5 T* \ - char *dmabufdest2 = NULL;
9 o) m$ M2 r5 U) [4 r - 4 u; y, Q% ?4 C! l* \1 Y$ [
- static int acnt = 512;& l8 ]2 @; l& J- V
- static int bcnt = 8;
7 P& [" {/ I6 B6 a, v$ F# | - static int ccnt = 8;! Q% ]* Y3 i! {% s+ F4 Y
3 j2 ?9 a3 z& x/ @! @- module_param(acnt, int, S_IRUGO);4 W/ \& D3 W; R
- module_param(bcnt, int, S_IRUGO);
( I$ J+ ^/ n4 P% H6 s& U6 E - module_param(ccnt, int, S_IRUGO);
复制代码
" z3 p3 b) @1 Z. O. J1 ~5 C( S1 x: x; ?/ u/ @/ t8 r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# q6 X; D( Q4 X! M4 O/ ?2 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ L) a) T; h: P( m& ~+ V+ u' ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 K! y1 t) X8 x& j7 `6 C
$ ?+ R# o: u n1 u( K9 N i, [9 n, O3 R6 _$ Z
|
|