|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: C' f8 V4 r; E! R0 ^" \0 ]% p- [code]EDMA sample test application# ` e- e* _ _& u! n5 J
- /*
0 V$ ~1 T4 D% L. S7 [5 q - * edma_test.c4 }4 y7 V1 ?' A
- *
& D8 S# m l1 |' |$ m. d; u - * brief EDMA3 Test Application
8 j! l" V" H; E |/ c# |. n' n7 ~' u4 Q - *4 j+ s3 u3 k# w0 k- r' U1 o+ u
- * This file contains EDMA3 Test code.9 P% j/ x7 n2 b8 p+ |8 G7 _
- *1 c4 A% l; H7 c/ i6 k/ ~# w4 a7 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! H( _7 l% S+ \# j$ ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 V6 l$ \, y& `8 G9 K+ D0 {7 Y# m - * TO CHANGE.$ C0 R" F" F, E/ A: L- _
- *9 t7 }% Q) w, p* P8 i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 v0 i9 c9 f$ [, p) u1 d - *" z- H- c8 H* @* K
- * This program is free software; you can redistribute it and/or
0 }: j$ q5 e6 Y. \& R: S - * modify it under the terms of the GNU General Public License as6 ^9 p- E/ g8 b, v! F# n+ A
- * published by the Free Software Foundation version 2.( _* `0 L$ ]7 \
- *8 \* A, E. t+ N! Z6 J! c# }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ }. f, i2 m t* P - * kind, whether express or implied; without even the implied warranty
0 f Y( C/ p5 F( Q5 r' ~ S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- s' a9 r9 Q' m6 i$ L4 i/ ?5 ? - * GNU General Public License for more details.
! v0 f6 c4 h+ E( T8 t5 v$ J9 k; m - */$ M; F6 b2 E/ ~ \
# q; ^" [ l5 f5 H" G- #include <linux/module.h>! {/ S' W' m. q1 r. Z: N
- #include <linux/init.h>! c/ t/ Y, [+ G! y
- #include <linux/errno.h>
8 k. ~2 i. L# z* n) J - #include <linux/types.h>; c/ e* K: X! V
- #include <linux/interrupt.h>
( Q9 }) Z% q) E4 S - #include <asm/io.h>
: g3 e- W( E! Q8 k- D - #include <linux/moduleparam.h>
# T" v- b- u7 a$ Z$ U1 r - #include <linux/sysctl.h>
2 k# G# s- b9 v. E# f: `- O - #include <linux/mm.h>
5 R3 F. Y- r) O ^+ F - #include <linux/dma-mapping.h>; l2 m4 P) z- T8 ?) y9 g" B2 {
- ; U( @8 e, {1 B! b& R
- #include <mach/memory.h>3 j2 w1 S% I8 T- V/ B
- #include <mach/hardware.h>3 w0 O/ F1 S6 I% m
- #include <mach/irqs.h>0 N/ k2 U3 A' k7 C! d7 R
- #include <asm/hardware/edma.h>( y3 }! z4 K3 H/ I, @# S, Y
) Z: G" r" I4 l I# j. Q- #undef EDMA3_DEBUG
* I0 w1 G( u- H) |3 T3 \& C - /*#define EDMA3_DEBUG*/
5 e% L! i( }: s) Y K+ n* Z
6 `) V5 i, @9 G) v$ ], |+ v( B# c4 N- #ifdef EDMA3_DEBUG
+ i3 v! v) U3 J. Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# G3 Q* i n& l$ v$ @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) ^" z. K0 [) E0 N% d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% N( o5 o9 U# w- \% S6 I - #else
- p5 |7 E$ l$ k. r- d! _ - #define DMA_PRINTK( x... )
8 a% v* r( F" e. i0 R - #define DMA_FN_IN5 d' D3 w7 M/ t2 u5 T
- #define DMA_FN_OUT" _ ~4 W4 {9 e: J0 `1 ]
- #endif
9 [. M" l' }5 s% b+ T( @) i9 x+ Q4 T - / M- Q5 n- X- N, m! h+ V- T; t6 S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( U f: @: u$ R! j5 [, b
- #define STATIC_SHIFT 31 v" {& y7 Q# B6 ~
- #define TCINTEN_SHIFT 20: H" C9 Z& F, ?6 m% ~* W
- #define ITCINTEN_SHIFT 210 W g# M" M$ C w3 Y
- #define TCCHEN_SHIFT 22
- `+ P, K: f6 z' g& r3 T2 G - #define ITCCHEN_SHIFT 23
# T7 Z( ^% g& J7 X g
' S' m1 j1 W( q1 N- static volatile int irqraised1 = 0;
, {' b0 l, j* \3 N! n- \ - static volatile int irqraised2 = 0;
, G7 A+ K c0 a8 h" \& \" r
( m- u$ t( E D" }' t( U5 x/ @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- M7 n6 q+ s- Y8 S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 @* F+ x1 y, g/ E9 f3 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" g! m! U8 w: G1 k- p* ?
* Z' G) Y7 m- _1 ], E- dma_addr_t dmaphyssrc1 = 0;. B0 C/ |& M9 I6 \+ V
- dma_addr_t dmaphyssrc2 = 0;
* c+ P u, l" |' m: F - dma_addr_t dmaphysdest1 = 0;1 `5 U( e0 G8 m" t5 i
- dma_addr_t dmaphysdest2 = 0;
# @# k' k/ E# g1 e6 x- M, d: w - ! _) f3 d ? e
- char *dmabufsrc1 = NULL;
. B, v) V: X6 a# N4 r7 g - char *dmabufsrc2 = NULL;. R' `5 w2 T2 G4 i8 b. X! w) _
- char *dmabufdest1 = NULL;4 J" W8 y$ h4 Z7 \# i
- char *dmabufdest2 = NULL;9 _3 W( Q8 y! h" x1 ^- s/ h* a2 o4 P
- 3 ~; _7 r h( ] r) E8 c
- static int acnt = 512;- q2 s4 ~0 N( b7 @$ W
- static int bcnt = 8;
; B- Z- W0 T* d- d: } - static int ccnt = 8;
: {1 F" U& x6 h - 2 w. o4 r7 Y3 ]
- module_param(acnt, int, S_IRUGO);1 V" H! u6 p' P( {( d
- module_param(bcnt, int, S_IRUGO);
z8 S& j3 [5 K* ?/ A - module_param(ccnt, int, S_IRUGO);
复制代码
& H" \! H8 |, m& q _+ o& A) M# J" Z7 ]( _# W0 x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 {/ w% E2 d6 m0 f. D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. E7 Z$ o. i( h4 S' i+ y& R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! \, |# Z& T/ i2 D* }! ?) r7 I. Y, {2 E" H |
1 y: M$ S) j3 R' Z( M( Q9 @! Z7 g |
|