|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 S8 H+ q' [+ C) |! C* i
- [code]EDMA sample test application( t V; q( n) J D) l
- /*1 ^9 T; t1 f; o4 d! t* Z( Z0 U3 E$ r
- * edma_test.c
! ^% P' A, Q% P% h8 F }& a1 r( Q* h5 ? - *1 K( N' e4 G( X" t x
- * brief EDMA3 Test Application3 m1 s y, {) W( f
- *
2 m& c3 H. Y3 U) B0 a; U9 Z - * This file contains EDMA3 Test code.% k8 k; w& `! K! s6 }6 J0 o
- *2 D+ N) j, Z$ L& _* o/ u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, Y' _* e. f+ q, H0 U5 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 W& N0 @% W0 u- J3 j - * TO CHANGE.
2 U) {' A- s/ r6 ^% R) D+ x1 ^/ D- J - * T# V% v( R; P" a* |' Q0 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ T$ B1 ~8 v, o: ?# ?1 r, t - *
: q# U4 D/ [7 n/ d1 X& D3 n - * This program is free software; you can redistribute it and/or% c( i2 `8 u$ t! Y3 h( S. K# T! x
- * modify it under the terms of the GNU General Public License as. E8 c# ]) C5 ]* }
- * published by the Free Software Foundation version 2.
9 m% _! y6 U% ?4 l: D6 N7 j - *
8 s1 Q' M8 E4 ? F; D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* l. z8 s; y {+ z - * kind, whether express or implied; without even the implied warranty$ I9 A: t4 d' d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 [! S" C3 I( }. i/ X; h5 B9 g - * GNU General Public License for more details.
& A, p, h/ t ~0 _ - */
) {1 w0 ]) h4 ]. C1 [7 t/ l - ' a) f% O! f3 d/ m5 Y4 b: d
- #include <linux/module.h>0 k% L7 g0 W. ?+ d" `( s& `
- #include <linux/init.h>
% O2 w7 Q4 }! b& w4 m+ w - #include <linux/errno.h>
! _* ]+ y: V) P1 Q4 { - #include <linux/types.h>" ? V% U4 c' ^8 y
- #include <linux/interrupt.h>
+ I$ I& {* \8 i* k - #include <asm/io.h> z) o9 N5 g; S
- #include <linux/moduleparam.h>% Q5 `, l( G: b8 [
- #include <linux/sysctl.h>
9 @# k' d$ }* }- X - #include <linux/mm.h>
& h- ~. k- A4 J% M - #include <linux/dma-mapping.h>
4 }0 \& N" t# z$ _2 ^/ P6 |# e; z
, i4 S3 u4 ~% I3 e4 ?! t' }4 Q/ h- #include <mach/memory.h>
! f$ e0 E5 c- {$ Y* h6 n - #include <mach/hardware.h>
' K; \: C3 ]1 a, H; T* \ - #include <mach/irqs.h> u+ C: k2 y1 l* u3 B1 c N
- #include <asm/hardware/edma.h>6 E8 ~3 `2 U; N
- , Z, r$ F. D8 l7 e4 u
- #undef EDMA3_DEBUG/ v- J6 |! h7 y: ?
- /*#define EDMA3_DEBUG*/4 W2 E2 `* p. [, x8 E; e# c, g- p
- , ` s$ t2 d& [2 [" L- d+ v; x
- #ifdef EDMA3_DEBUG6 Z1 q, t6 Q; ]: |. e, M" A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 t9 t2 F) p$ X5 Q" K+ ?- m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 q2 T- }5 U- q' n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% X( p5 q7 p1 R* j% a9 ?
- #else" Q: ^4 t I3 e0 ^ y. ?# a' l
- #define DMA_PRINTK( x... )
( x, t8 S1 |$ k$ @ - #define DMA_FN_IN+ Q# j |0 ~/ C$ }2 P# Q% K* i
- #define DMA_FN_OUT
8 ` p) h8 W# l, L6 M6 A; Y6 Y6 E - #endif
" \. Y* G r1 c6 n
* Q6 a' G/ O0 _" E) |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 y" P4 u8 m5 \8 b
- #define STATIC_SHIFT 35 U2 h$ u5 _- t6 i7 R: o
- #define TCINTEN_SHIFT 20" `, W5 ~5 n& N0 q
- #define ITCINTEN_SHIFT 21' @. f& C$ n. Y: f+ a7 d
- #define TCCHEN_SHIFT 223 ~0 R3 L1 U! L+ z% L1 q
- #define ITCCHEN_SHIFT 23
8 t1 ^7 k N$ \! M0 G - 6 N" T! Z! u2 I5 J& O' o3 Z
- static volatile int irqraised1 = 0;
- N& I4 s2 K G {) C+ I5 o - static volatile int irqraised2 = 0;: b0 q0 }/ y8 y2 [
( f9 o: a0 i1 k: @' D# G% }. y* B& R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 n) X, z+ e7 w' M' ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- m4 G2 N0 i( ?7 ?( x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 |; A2 e5 K" i3 n v
& o" z+ h+ W' F Q- dma_addr_t dmaphyssrc1 = 0;
7 c# v4 B1 j b# [# k, O! t0 [ - dma_addr_t dmaphyssrc2 = 0;
8 c) d& I I, i5 B4 @2 s& Z - dma_addr_t dmaphysdest1 = 0;
0 N# g% c" V d# ~ - dma_addr_t dmaphysdest2 = 0;
2 U7 V8 A! j/ t* | I& ]
7 f V( T r% M1 k$ b$ {- char *dmabufsrc1 = NULL;: k( S# H: e2 P. I3 u+ T/ q/ w
- char *dmabufsrc2 = NULL;' O T0 Y) V8 r# W; ^( A
- char *dmabufdest1 = NULL;, O1 N8 a! h/ M$ D5 u
- char *dmabufdest2 = NULL;& e ]% I% r, H# a7 n' c: x
+ t. z0 l9 Q! x; E8 }6 r& d9 f4 ~- static int acnt = 512;; X- B& q. `! c0 U& J2 `
- static int bcnt = 8;& ?- h! l$ S1 a: u3 U
- static int ccnt = 8;
z# M/ w9 J& g$ p% W
& r* ?- S6 \5 X+ P2 E- module_param(acnt, int, S_IRUGO);
+ v+ a4 `7 u! H2 L - module_param(bcnt, int, S_IRUGO);
2 j- y: T3 T0 T - module_param(ccnt, int, S_IRUGO);
复制代码
l, M2 H$ Q. _/ R7 |# n6 j8 h
$ O! M% |$ A/ p2 [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 T9 K( e% V7 u! c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N$ u: c/ E0 `# I% E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% e }0 N( ^% x2 ~! _- u2 S6 t6 u% P: I1 C4 n* S
! q9 K! w" k& J r4 D
|
|