|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. G# m6 N1 w! p( |- [code]EDMA sample test application2 W- \# Y; ?! b& M& H# ^
- /*5 W- ~: a- j- V+ I- O
- * edma_test.c
# j% ]# s% Q# D/ G `: ` - *
# m! F0 |+ t5 n; z5 Q, ~- K - * brief EDMA3 Test Application, r$ J3 X2 y: J! Q3 E" ~( Z
- *) z: w" ? C4 V- Z- @2 t
- * This file contains EDMA3 Test code.
' u9 `+ i. u k1 y - *
& Q3 D. `7 I" V3 ~) `2 ]8 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* M |+ k) |4 c4 ?6 ^6 z$ a" h: [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! M- t6 H/ Y h: o
- * TO CHANGE.9 P8 F. [: g' g* `
- *
4 b" U `' I1 H* I+ d& V) n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 }: L o1 x/ g5 J1 S
- *
* N; K7 T5 p8 F2 h$ n6 u8 n$ [; D. E; n - * This program is free software; you can redistribute it and/or8 h. d$ ]8 o4 f; e9 P0 B1 y
- * modify it under the terms of the GNU General Public License as* O; b( Q0 g0 \5 n0 |% R3 ]
- * published by the Free Software Foundation version 2.
- R, ^8 u. E. t+ l! h2 S1 Q, d0 B - *# c0 v C- }+ K( O5 j6 [: P9 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 [( t% J. q# u9 O" W* X. A+ D - * kind, whether express or implied; without even the implied warranty
, y! H0 H7 n8 m: o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 |- r' L6 k( A( }( i - * GNU General Public License for more details.
7 q+ }$ t! m, k) D - */& l7 c" s2 E, x
- ; F1 Q! L, g4 T" E
- #include <linux/module.h>$ |& Q% m1 N) t- A. j) ~. U
- #include <linux/init.h>
3 b+ a8 X" v8 @4 [' q& G8 j - #include <linux/errno.h>
; ` R& T: D) }$ m: ?! }0 F - #include <linux/types.h>
; {7 V c5 e8 X5 u$ Y, ] - #include <linux/interrupt.h>
$ D; q0 T/ ]3 b+ J1 F - #include <asm/io.h>
' p3 m. s4 F; U1 C - #include <linux/moduleparam.h>
, v+ B* i2 z8 J" c$ B - #include <linux/sysctl.h>
$ P, i6 A* @% o( d- k9 A! l - #include <linux/mm.h>
0 X) s# U! K0 J, T, d1 m - #include <linux/dma-mapping.h>
4 L5 R& s5 c! \ b) W" z - # c1 y5 \9 D6 j. r0 }8 R
- #include <mach/memory.h>
/ c+ B8 B: U9 [ - #include <mach/hardware.h>+ e I0 ^) }: q. q1 b
- #include <mach/irqs.h>
6 A( y9 I' A! o8 y6 P6 }- t - #include <asm/hardware/edma.h>
j3 [. q+ i: D1 f - 9 ]% T$ T$ R0 O1 @ V" K) E
- #undef EDMA3_DEBUG' s, S4 [% \3 q+ W3 n8 p( a9 H& w
- /*#define EDMA3_DEBUG*/* Y% p- H8 d# G" B
% v3 e7 F# v+ r& P# [/ M! i/ ]- #ifdef EDMA3_DEBUG! j- k, T9 {. P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) N/ W0 H. a, j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Z) E. _( ?) I% ~1 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), [+ ~$ ^6 `; e
- #else
/ F( ?& q4 q+ E7 _4 v9 ?+ o - #define DMA_PRINTK( x... ). I6 Z( C! @ x5 J7 r6 x
- #define DMA_FN_IN( Q* ~+ q' [, n. @/ v$ G+ A( W8 V
- #define DMA_FN_OUT% [+ Y1 U: i& }% L6 Z; S
- #endif
" R; P0 R, F3 P/ K; g
7 ^9 X( w+ L! }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: g8 N( V+ g7 S" W - #define STATIC_SHIFT 3" ^/ G4 z, c F$ D
- #define TCINTEN_SHIFT 20
4 Z/ i7 _5 N# ?6 N - #define ITCINTEN_SHIFT 218 N% W; N4 O; J: e
- #define TCCHEN_SHIFT 22# l7 h" o4 \; c( H+ {
- #define ITCCHEN_SHIFT 23' E5 z! A0 S; j
# Q1 H5 D3 x6 Q- static volatile int irqraised1 = 0;
8 Q/ u' [+ L( ~3 F: I0 \2 J0 K' B - static volatile int irqraised2 = 0;5 W; z( G# V) h; _
; R. I# m& `) i; @) P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ N1 L, f3 @/ t% ~0 ^; J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 J2 {' r* M+ R A0 S1 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 m; ]* n# x7 f$ z
; H% @* K. Q# j, h+ _+ Z- dma_addr_t dmaphyssrc1 = 0;
/ d5 I$ p% g' u: m# G$ q8 _ - dma_addr_t dmaphyssrc2 = 0;/ A# T) _# C B3 Y/ X
- dma_addr_t dmaphysdest1 = 0;+ n/ K) m2 U, t. H5 P# `
- dma_addr_t dmaphysdest2 = 0;' n3 x6 i9 z3 R# s
$ e) P: h$ a- L1 a- char *dmabufsrc1 = NULL;
' B. C7 l2 P5 U - char *dmabufsrc2 = NULL;
( I; Z- G- h) K b( ` - char *dmabufdest1 = NULL;7 N0 D) N0 L/ J% @3 ?5 t
- char *dmabufdest2 = NULL;
* O2 B s$ E; W2 l - ! }( q2 N7 c7 D$ J
- static int acnt = 512; [0 m* L& `4 _% v/ z; @) B
- static int bcnt = 8;) t* W" y* s: Q+ Q# h6 Q* W o8 v$ V
- static int ccnt = 8;0 o7 n" e! j& U. Q& E3 S: y, u
' K; _# E! X1 N( m0 ?: o- module_param(acnt, int, S_IRUGO);
' m) w9 W# Z+ C d/ ~ - module_param(bcnt, int, S_IRUGO);
2 {# D- d0 H4 Q6 K) g" [- b - module_param(ccnt, int, S_IRUGO);
复制代码
9 j5 x% ]: A$ O$ t; ~6 n; a: D3 k
* @/ N' D7 Z5 d3 W/ M4 {# v( z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& G w6 Y# w/ B- Q' karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; }8 e1 [( Z( e( `* K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, B# s& @* F7 K
8 }0 W) C$ r& `) t1 c2 {2 r
) S1 A; X" A! X' Y( n8 H |
|