|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 P9 k' ~7 ^( e# ^7 ~! E% t- [code]EDMA sample test application
: \# |6 r4 p$ Z - /*2 i4 e) s4 V% p9 u- J( Q! J+ t3 N, t* W
- * edma_test.c$ t. Z- [+ g6 S) Z3 R4 t
- *
7 L6 D8 ]1 ^8 r6 \" f - * brief EDMA3 Test Application
' {5 @1 c' ]8 T" I/ c$ V: l - * A: u) g0 ]& w" S6 M) r: O
- * This file contains EDMA3 Test code.
9 r% C/ L. F6 U; r6 @ - *
7 g$ o4 F; P; H1 N! ]! M% f8 G. k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 ? F C. q3 [ E r% J, }! [" W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 M4 @9 U$ i' a% n' Q! H' M( M - * TO CHANGE.
* L) J. b$ ~9 R) O" v - *$ ^, S- N! \: Q5 i+ n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( n) q( M) Q1 Z( n+ l& o/ y
- *
P; a) y* i- b1 ?& u+ Z - * This program is free software; you can redistribute it and/or
7 ~2 V7 ?, [, |. | - * modify it under the terms of the GNU General Public License as7 |3 z# e! {* L( {: `! D
- * published by the Free Software Foundation version 2.+ m9 X5 ~/ Z2 h" y; { m; g
- *3 J/ _/ d) n, G' M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, z7 K% J, x: g8 g) M7 n8 u: b
- * kind, whether express or implied; without even the implied warranty
( s9 v; R: n: P" h1 e6 p, M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 f4 Y' V" P' W$ Z* H
- * GNU General Public License for more details.# s# O( T9 f8 P9 z5 r+ q- Z
- */
7 l1 u( z# D& S# n0 v
3 o1 U# x" } p8 s; ?- #include <linux/module.h>. m+ _8 E. J! |1 {5 i& n
- #include <linux/init.h>
/ r X* \- I" J! T' M( u - #include <linux/errno.h>
) T& i0 L9 ^% k( E( Q6 W2 k' n - #include <linux/types.h>: ?1 w! K$ M7 `; ?2 j4 {; L
- #include <linux/interrupt.h>
0 a J# Y8 j% Z- ~2 F - #include <asm/io.h>
; N8 [# u4 i; C8 B( H& _7 y3 B - #include <linux/moduleparam.h>
- w/ d7 |' X; A9 |: x0 V2 I - #include <linux/sysctl.h>
- J i3 J! @% N2 p5 t4 O# x - #include <linux/mm.h>* h8 R6 e$ E5 A5 X8 M
- #include <linux/dma-mapping.h>. O$ m* E1 C& ^: z9 d9 ]4 U" K
- ; ]( N- r6 ` j2 p
- #include <mach/memory.h>
6 K$ w8 i/ _+ ^* O! y l - #include <mach/hardware.h>
; l! K: O0 `$ O# z1 k% u - #include <mach/irqs.h>0 O2 c6 u/ U9 S$ X
- #include <asm/hardware/edma.h>
6 h: A) E) B8 s
0 P' T. o3 N# q, c' V0 e' @- #undef EDMA3_DEBUG
/ Z3 A( Z; m' @! y7 [/ c# b( C, K - /*#define EDMA3_DEBUG*/! N) D1 G2 D4 O9 y5 W" [" E
% m5 ~) C3 W1 ?1 k$ q2 J- N. S- #ifdef EDMA3_DEBUG: u/ l. p/ A0 U- H: ?1 K7 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' h. [; q' p/ X; r1 K, b, N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& }; j) S$ H6 l* l9 O0 h P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) G# L$ p1 F3 a( z7 E7 r - #else+ Q; U0 g `' r% V0 p0 w) P
- #define DMA_PRINTK( x... )
1 e9 {8 g& [1 ^# y. J& |8 ~& t - #define DMA_FN_IN
) s# K H. ?5 V/ R l - #define DMA_FN_OUT
: `5 b$ D! Z1 A' S0 \/ ?; i - #endif/ M" R: h+ E+ p W9 I
- ) ]+ j0 l$ ~& ?+ e9 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). v, \9 N0 \, Q
- #define STATIC_SHIFT 3$ I% }4 q( H3 H+ A
- #define TCINTEN_SHIFT 20
( O$ F9 _5 ]- a. S4 _ - #define ITCINTEN_SHIFT 21
* G& J# v- y" ^( o) G' t - #define TCCHEN_SHIFT 22/ Y# n( ~ G% y: C3 B
- #define ITCCHEN_SHIFT 236 e3 m8 t! w- \& u$ u5 g- L' j
& G$ G# _+ r, l- static volatile int irqraised1 = 0;
. j* T1 \; U, ], A, ~# ~ - static volatile int irqraised2 = 0;
; @( U% ? y0 z+ l% a* u) ]
* _# e+ Y( Q7 j2 g$ X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 t$ k( H7 F1 I- r: c+ @* b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Q3 ^' W% N6 M8 c- K! e1 `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' Z( r2 O5 j; [) }' T, I4 w2 V
2 e7 M+ z' [# A4 o0 q+ A- dma_addr_t dmaphyssrc1 = 0;
$ U5 b0 O+ \* N+ W& m( E - dma_addr_t dmaphyssrc2 = 0;
8 O& d. `* b. V, r: Y - dma_addr_t dmaphysdest1 = 0;
1 C: Z( R- ?: s7 n3 f2 J0 N, p - dma_addr_t dmaphysdest2 = 0;; o. y( e; b& @6 l' r: R
- " M# }: Y- x1 Q
- char *dmabufsrc1 = NULL;
" D/ s2 {& J' H1 c - char *dmabufsrc2 = NULL;
# j/ Q, h1 @5 q: I7 n( } - char *dmabufdest1 = NULL;
$ F1 g: l7 D5 V5 R9 M L8 p6 \8 K0 _ - char *dmabufdest2 = NULL;: j9 a+ ^+ A c
- $ _/ Q8 L8 {. m# ^3 y
- static int acnt = 512;
+ S2 V% F x7 ^, T6 H1 O - static int bcnt = 8;7 i/ v6 n. _6 |# K# P+ M
- static int ccnt = 8;
/ E! a8 y% n" w( j - 9 L$ z" U4 k( e$ C8 H
- module_param(acnt, int, S_IRUGO);/ h' W) j) ?" l: n% v- f8 j5 ~+ Q
- module_param(bcnt, int, S_IRUGO);
' `- H5 L" e/ p9 H- K6 f: _0 A' b - module_param(ccnt, int, S_IRUGO);
复制代码 + ?' r9 p; l1 k: y
% ]# Z, t" t+ j8 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% x6 I" h# ^7 m7 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# R+ H* N/ T6 j A0 U* \/ }, N5 F6 B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 C$ @1 J& h, F+ b0 w1 \
$ A. V+ s3 y& `" o# V+ e/ R' X6 q
& x# t- S3 m2 D3 | R8 t! g! s) | |
|