|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% k7 a* }8 m- ~5 X0 V* D, ? k( u- [code]EDMA sample test application
L+ u6 ?7 q5 r) Z" C - /*0 C8 X6 j4 `( u1 W; t
- * edma_test.c
8 w; X4 [' w! h - *+ b" @3 f# z$ P
- * brief EDMA3 Test Application# o5 d! b4 J, R9 k2 e
- *
, q5 l/ B& [1 |% F8 j4 P# [ - * This file contains EDMA3 Test code.. R, C1 G4 x- n0 Y* q( q. w% Q& v7 |
- *
: c- z Q$ R5 w* ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* l* Q4 Z) _7 I+ ^5 s. ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 |1 I+ ?7 x' ]) N. `. Q- P
- * TO CHANGE.( o: H' U7 Q, `
- *
. X0 u" E I" R" j9 M8 r/ f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 J5 |/ W" ?% N$ {" ~( T
- *7 U4 i! _" D6 _' j; l5 y0 c
- * This program is free software; you can redistribute it and/or
7 N& S9 ]" y$ {+ M, r - * modify it under the terms of the GNU General Public License as
# W G0 R6 a; f I - * published by the Free Software Foundation version 2.
0 t o* R o- S) {- U C# _5 ^ - *
) N, i. t+ v7 w5 l2 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 {( E0 B) c6 s0 p/ k - * kind, whether express or implied; without even the implied warranty$ I# W, H t2 h, [8 |; U+ h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' b+ e- l" \0 X L8 [$ e
- * GNU General Public License for more details.
4 L/ }* ?0 K; W* k8 y - */; U( g, M3 T9 C4 b
- 3 ^5 d9 n" o) a3 f2 J |% Z! @2 m
- #include <linux/module.h>
; t) n* V: u k8 H7 H6 B6 J - #include <linux/init.h>
9 x9 y7 {% ^' o - #include <linux/errno.h>
, a/ Q( h# U" \5 W' @/ X - #include <linux/types.h>) ~3 o% ^3 Z6 N5 K( l' @# m) A; Q
- #include <linux/interrupt.h>' r: e! o& Q7 T. T
- #include <asm/io.h>* \, o3 ]% L- M2 H. S, h
- #include <linux/moduleparam.h>+ m. ~1 R5 z* _* L8 ~2 v/ N
- #include <linux/sysctl.h>) n; d# t& |. O) u
- #include <linux/mm.h>' I ]0 c, X. D- C( i! b
- #include <linux/dma-mapping.h>$ t" t' o' P( i
# k* q6 U! I4 ]- l% T6 M* H- #include <mach/memory.h>
! F j `' ^3 O1 \. \1 \; x - #include <mach/hardware.h>
6 {' r( n7 a" i; c' I3 c - #include <mach/irqs.h>
, \2 X- R& Z0 T& m - #include <asm/hardware/edma.h>
+ x, j# F( ~0 ~3 \5 Y" z
/ N; L3 {1 y5 H9 X, I- #undef EDMA3_DEBUG$ K \ ?3 m. y4 |
- /*#define EDMA3_DEBUG*/
9 [3 g. t$ m9 C( D - * Z) K/ ?+ |. x' L5 A) v
- #ifdef EDMA3_DEBUG& I d1 `8 R% x0 N0 p7 K9 A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 r2 i7 { d0 F6 h# J* c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), U" r( X! z; C+ i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
P, q; j# h% E3 [ - #else
" A( U! P1 J, Y, j - #define DMA_PRINTK( x... )
' t3 d6 |) [ n t - #define DMA_FN_IN
6 d; t, F: p; F1 W T% A - #define DMA_FN_OUT8 }& C' ?# j& ~! a
- #endif
' r' D5 A5 a; z9 ^3 `
, e) A$ g/ T4 _9 O; O( N+ o; X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 P+ b" y* s( ]3 i
- #define STATIC_SHIFT 3
$ M8 g# P- d9 S# k. O' Y - #define TCINTEN_SHIFT 20
' w% z& O! G0 h/ N - #define ITCINTEN_SHIFT 21
$ u" S$ s+ Q( [ - #define TCCHEN_SHIFT 22
k* G7 ^' O) K8 W - #define ITCCHEN_SHIFT 23
# ~0 ~% c6 P* L1 N. n
9 i" z5 J# a# |& {* P- static volatile int irqraised1 = 0; ?, f; v2 `5 U+ Q6 v( I
- static volatile int irqraised2 = 0;( |% o, D! \6 o- w: ?; }3 R8 p4 w
- " [ W3 ]" o; w7 ^* f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 u/ T0 U, S7 j' X6 R( ^* K! d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! u1 K% i$ r5 B, N% y" E) K8 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 j) X+ p; h3 c( _ f: S - 9 q$ [8 z& W* Q" N0 n) Q4 U
- dma_addr_t dmaphyssrc1 = 0;: x. h+ k' y9 _: g6 U) f& r
- dma_addr_t dmaphyssrc2 = 0;+ q7 H# [0 k* D4 [7 ?( c
- dma_addr_t dmaphysdest1 = 0;4 w, e+ e$ ]. Y0 d* h T [
- dma_addr_t dmaphysdest2 = 0;
" m7 A# G$ D) ^ j F
+ {+ G4 ^% t$ `% {( d s- char *dmabufsrc1 = NULL;
w7 @( b L# i f2 } - char *dmabufsrc2 = NULL;
/ ?2 J0 }/ @7 ~: {5 R2 X - char *dmabufdest1 = NULL;
) L+ w/ C \( l. S+ N6 _0 V9 j$ r - char *dmabufdest2 = NULL;8 X B# v2 P3 J* }; Z0 O0 }1 L# \8 N
5 c* t& a) b) m- static int acnt = 512;
3 B$ q& c: ?8 y - static int bcnt = 8;& A0 s! c3 b- \( @9 g
- static int ccnt = 8;
- s5 C# T& k1 K, W - $ ~2 t5 y0 n7 v5 K' G
- module_param(acnt, int, S_IRUGO);
/ M! ^) d6 _! g* Y! {, x* M. Y6 i - module_param(bcnt, int, S_IRUGO);
; U; h' E6 B2 S3 K( J" s - module_param(ccnt, int, S_IRUGO);
复制代码 1 q+ g8 \0 L- L
( T2 @( a3 k( t$ R! z! [; V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; G) Y. l2 F; X. e( M/ e* m3 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: i7 E# q$ ^/ e" F* D) M$ _3 ?+ A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) } v) i& D$ T7 R6 @4 g6 S* W9 |: e8 V& O( O5 [
* q7 \) V) `% K; M- F) o* o9 k0 `
|
|