|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; [+ p( q( S: C
- [code]EDMA sample test application8 T+ a7 z5 t l- O% b& \( ]
- /*7 |! O$ x4 [! S* J* _2 @) K; O$ H. o J
- * edma_test.c
4 _, B* B% N0 U8 ^2 r( K - *2 l3 L& v/ d. v2 B/ j
- * brief EDMA3 Test Application) \5 ^$ a6 C4 Y7 x, Y
- *
; W' `$ H3 Y& i' D/ @: Q/ q - * This file contains EDMA3 Test code.
8 Y+ g# {) N, w# G/ M h4 B4 t - *
: W0 G3 P/ G d, C1 |% o( l6 H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. W9 T7 b3 H# }5 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 Y U- z) U8 h2 m9 t0 P
- * TO CHANGE.$ Y8 B9 H. j2 m6 N0 U
- *
/ O% i/ }; ^ ~; a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; g0 H' h4 j1 ]& q, _1 U
- *
5 K9 G2 @* |# A. k' U - * This program is free software; you can redistribute it and/or- j# @. \3 y [0 L2 N
- * modify it under the terms of the GNU General Public License as; X+ C# t* X! |" I5 N1 a
- * published by the Free Software Foundation version 2., Z2 I2 k, M; h. S
- *
5 ?5 ^+ v# Z& D& f# v' e- G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 p0 ^3 w% z( y8 p" V2 M' ]' H% n2 |
- * kind, whether express or implied; without even the implied warranty
& f& b# g( |8 Q0 O+ r$ ~7 ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; b# ?# q4 j9 V& O - * GNU General Public License for more details.
" n4 ]" P* j) I% t - */2 U3 K) v. r+ t; P8 F$ d
; z y6 v( P- B- #include <linux/module.h>( l9 V, J9 n$ {
- #include <linux/init.h>! C3 H6 g; g; f P% H2 X
- #include <linux/errno.h>
% p u& w/ R k1 a' u - #include <linux/types.h>
6 Q, P4 @* S6 s4 b- K2 f - #include <linux/interrupt.h>
" ]8 y4 L4 h( H9 ~0 I - #include <asm/io.h>2 v ~/ r7 j- i
- #include <linux/moduleparam.h>
! A0 e' O# _2 r5 @/ C - #include <linux/sysctl.h>2 S+ O# m3 E( d0 a
- #include <linux/mm.h>
O$ n$ y' b! r9 V3 R, D4 \& Z - #include <linux/dma-mapping.h>. T: @ J1 Y! c- U& N
- ( T, J) t2 s% o, P
- #include <mach/memory.h>8 B" ? `. ^1 K" L
- #include <mach/hardware.h>
1 B. Q2 d3 N) V# C" j) m) y0 @ - #include <mach/irqs.h> k' j$ h6 y: }) i8 f, F
- #include <asm/hardware/edma.h>
" y: ?$ q8 X S5 G$ x: w& r
6 p/ w( c' [' u8 z" A; q- #undef EDMA3_DEBUG
: ~1 a+ J6 y% k- l9 i - /*#define EDMA3_DEBUG*/
& S) n6 x& N5 ]6 f
' S# a; p6 ]/ `9 ?, {, _, V( u- #ifdef EDMA3_DEBUG; v; @2 R& D; c$ M% R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
y+ c' b0 d0 d* s6 @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ k8 i( X7 H5 k6 V4 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ v/ i1 i* D; n& s/ A
- #else' `4 v _; x$ ?8 S9 L: W0 `( e
- #define DMA_PRINTK( x... )9 i6 ?/ L2 {( V
- #define DMA_FN_IN! Z2 [" D7 s1 Q
- #define DMA_FN_OUT
% X/ m# G6 M" N, {7 _; q2 E' l - #endif
, t. \8 X/ U4 j7 Q: x' Y9 o1 r
2 O2 p( n m& Z( E/ t* i- R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! U9 m- Q2 F) T1 Q$ o# ^7 C! } - #define STATIC_SHIFT 3. j/ {! t: u9 v2 p' {$ H2 u
- #define TCINTEN_SHIFT 20
3 e6 D5 `5 U2 ` i - #define ITCINTEN_SHIFT 21# O" p, c# X) |' R! J( i) ~' x+ T. f
- #define TCCHEN_SHIFT 22
' }: ^, k) C2 L* A - #define ITCCHEN_SHIFT 23
* R3 [8 ~+ G) |; z: a - - S: y( B; x s8 ]; H! M
- static volatile int irqraised1 = 0;
' ?2 c6 S: V& n5 G* E - static volatile int irqraised2 = 0;+ F$ w$ Q: p1 O9 t1 j8 K
- ! M. p$ @: Y" H9 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) v; m' c1 q- K& c J5 s9 E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 e w( Y" b' H2 _9 b* d$ n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 }: a D. K+ j4 y5 G2 Z/ u, H; c8 W - 3 G& N1 \( }9 H" U. r
- dma_addr_t dmaphyssrc1 = 0;" ~ o/ N: R0 U d& i% w
- dma_addr_t dmaphyssrc2 = 0;
0 M7 h- Y5 V$ z; J! S7 x' M9 @ - dma_addr_t dmaphysdest1 = 0;
d( L! Q' S: h# J. X - dma_addr_t dmaphysdest2 = 0;
( z( J/ f# j7 i' E: z: K5 y
s. j; U) ]7 q9 N8 \- a- char *dmabufsrc1 = NULL;
) b. L$ B0 {# h' q" ~ - char *dmabufsrc2 = NULL;
& m6 \6 _6 p# v# X - char *dmabufdest1 = NULL;
* q" `' H; q( n8 ~- e" z - char *dmabufdest2 = NULL;$ G, ^ Y( n0 Z& i, ~2 c! s
4 n9 K4 l9 _+ h( f! Q# s6 d- static int acnt = 512;1 z) v" c9 {& Y+ V
- static int bcnt = 8;
7 X9 |, p0 H. E/ n - static int ccnt = 8;
( {1 w: \5 }3 U6 Z. U' G! h5 H - ( b, b# G. A4 q8 k* x; t
- module_param(acnt, int, S_IRUGO); e3 g6 Y! C% k+ Y5 z
- module_param(bcnt, int, S_IRUGO);0 O: f4 n; w0 z/ Q, h+ C+ |9 p1 z
- module_param(ccnt, int, S_IRUGO);
复制代码 ' }3 t. `! r7 C# g, h
0 H# w2 p3 o$ g- b1 T& N6 d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' Y x$ r# x& H1 F$ k# C* h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 h3 {% C: G# b/ M5 C# Z3 N" } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 }& P) {# O1 k- s: U, [3 N2 K ?9 V4 \6 L' C) W8 N
# x# u9 i8 X) |; i) i* ? |
|