|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 S: Q# Q7 F9 y. X
- [code]EDMA sample test application) m" ]5 j- R( t, S
- /*4 N. o1 k8 [% `- }. G1 n
- * edma_test.c
; ^3 A# j9 c' Y4 u% P' Y) p/ t - *
( V1 f5 @8 B3 b. o( \& D; |8 t2 _ - * brief EDMA3 Test Application
! ~, ~; r7 `, g- N1 a - *) |* N3 T: a' ~) x V/ Y
- * This file contains EDMA3 Test code.
1 \6 Y& d" l. W7 `$ Y - *. {2 @# Y) L. z5 c+ X' f( ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, |. i' o/ m0 X& v( r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 i* e( r! S7 ]6 y( \/ a, x, N
- * TO CHANGE.2 b8 o4 t2 U. h" S( E
- *
' r; @# E2 ?3 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 I ^* }& r# b# m
- *& ^8 \" [, x+ U$ O
- * This program is free software; you can redistribute it and/or
, ~' E/ u' v: Q; k5 C - * modify it under the terms of the GNU General Public License as
- D: {! R0 Q8 ~% k% M7 _4 h - * published by the Free Software Foundation version 2.* B8 x0 u( p1 }/ ]
- *
" j$ z9 D" b! x+ V. P; I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" {! ^ B& a, Z6 l% \# V; I0 J - * kind, whether express or implied; without even the implied warranty
0 G- V6 B: [ \7 y6 u6 P2 X# j; s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! s8 o" z8 l. I# \1 @9 F - * GNU General Public License for more details.. `+ q- i! }4 f$ z* X3 H) Z4 e
- */2 F$ H" `+ p" Y3 S( U
9 ]" E+ J7 u0 D9 j$ K6 w" ~- #include <linux/module.h>
: k3 K5 U7 p; o% L- N - #include <linux/init.h>7 \3 a! T* T+ I! ]8 P; U/ S6 a( g
- #include <linux/errno.h>
. q& o' @' v) Q2 g) [/ Y7 ] - #include <linux/types.h>
) R3 Q+ U& ^: Z* _% D& U - #include <linux/interrupt.h>
$ a( L9 O' e+ t1 q0 e - #include <asm/io.h>
$ c4 O% P8 H( e2 g - #include <linux/moduleparam.h>- Q7 l6 g5 c6 s
- #include <linux/sysctl.h>: d3 j i) s7 ?4 Y
- #include <linux/mm.h>: l, ]# z, f( v: G/ f3 t& K
- #include <linux/dma-mapping.h>
7 L2 G; W+ A, d
S, A" q6 o/ m ^; r- #include <mach/memory.h>! G- [5 C9 t4 x& \% M: {3 d
- #include <mach/hardware.h>1 f9 I2 Z0 U, X4 V+ B8 w
- #include <mach/irqs.h>
, _! P$ G q' n' `3 i" ~3 K$ X - #include <asm/hardware/edma.h>- A" g) [5 N. ^0 S- F# k# P
4 d, X' ~4 K2 @, A1 i- #undef EDMA3_DEBUG
# q8 |! L; f8 u1 @; e1 r - /*#define EDMA3_DEBUG*/
5 z/ ?& t& n( w- \4 t& ]
4 \* K# e$ l9 m( A- #ifdef EDMA3_DEBUG# ~$ `" H8 T$ g/ P4 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 r/ S: q/ ?) u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' y0 X7 w' I9 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( j% X& Q* y6 C' C1 |. I: r5 o
- #else! s9 _# L [ R& i7 m$ O' B
- #define DMA_PRINTK( x... )
9 i; I/ t" N. F8 n+ X - #define DMA_FN_IN9 @+ a' D- L3 r+ [# Y! Z: Q" a
- #define DMA_FN_OUT
2 R: j* c' y+ H+ u - #endif
+ K- W# g* c( a+ |& b
8 W6 {$ x$ @" m t4 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 `7 O# z& v; }" Z6 [ - #define STATIC_SHIFT 32 I) E b; A- c1 w- U2 b
- #define TCINTEN_SHIFT 20
; P1 ^5 x5 D" @ - #define ITCINTEN_SHIFT 21" x& `% h, q+ x A, U
- #define TCCHEN_SHIFT 227 F6 [3 k# \! m& n, [
- #define ITCCHEN_SHIFT 23
) h7 r' N ], x t
6 r- b+ @9 C/ b' W0 l- static volatile int irqraised1 = 0;7 T0 y2 U1 F6 w
- static volatile int irqraised2 = 0;% r* Q* A" D) B( b+ X: w8 I
1 \, n' W' e9 H7 b) H0 s( U" e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 `- F- i! N' X. s6 ~. F2 ]. Q- ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) D2 I3 @1 N: B k* y0 Y6 r$ n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ o: k# J1 `0 }& G( T3 n/ S+ v - . M% V3 Q: r2 l9 K3 y7 h) B9 j b( W
- dma_addr_t dmaphyssrc1 = 0;
6 ?% F7 \7 O- Q! N# p- b - dma_addr_t dmaphyssrc2 = 0;
* D p H# {" H - dma_addr_t dmaphysdest1 = 0;
0 ~% ?; A/ e2 w/ n, @; M9 _2 M& ` - dma_addr_t dmaphysdest2 = 0;
: X0 Z- _/ N& `& p
' g3 J% B' \: l D* O& H1 y- char *dmabufsrc1 = NULL;
0 K! W) z5 \- p. a - char *dmabufsrc2 = NULL;
, u$ b0 a! F4 y% t: L1 o, n - char *dmabufdest1 = NULL;
8 `" |: D# L8 g3 e/ _- L/ } C# M: Q, C - char *dmabufdest2 = NULL;
* o8 u5 ]4 r1 D$ f9 V0 c - : B! b' b9 _$ c& L: g: D
- static int acnt = 512;
7 v- X N; Y# E; P - static int bcnt = 8;8 n. N- T0 |3 i8 K; l
- static int ccnt = 8;2 H# N, D' w) O' h, R
- 3 V0 f; S, l- e9 k7 g7 h
- module_param(acnt, int, S_IRUGO);0 O1 r4 N/ v n5 L, O
- module_param(bcnt, int, S_IRUGO);& Z) D) T" ^5 }8 K
- module_param(ccnt, int, S_IRUGO);
复制代码 - ?: t$ Z; K3 [$ e5 e
4 N1 z5 ?. S, [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* n7 u; D- @ c0 i6 Z/ B; w1 w3 ?- marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 j, d- g+ ]/ i2 C! N% `+ W2 R" N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: Z8 N/ }8 y7 N# e
8 s( A k9 n0 v8 e& N& ]: d/ S9 M+ S3 ?
|
|