|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' O3 D9 _9 ?5 }2 }7 M' x' t- [code]EDMA sample test application+ x* M8 I; Z( r8 \
- /*
% n' D+ a+ r k+ f: P6 R - * edma_test.c- X1 `9 [6 p! f+ v7 v
- *
; |! _$ A3 [% e/ D' ^) U - * brief EDMA3 Test Application# M% N7 h8 d5 o) X3 @
- */ [- B; s6 z' Y! b1 l; z( X+ i) C
- * This file contains EDMA3 Test code.+ b& x: f, `! a1 g3 l, W) y- k
- *0 ] K& `9 Z4 {$ w; a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" C* A6 K+ U; B% @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# A6 Z. q; _' q0 }; t1 p - * TO CHANGE./ I) q2 Y d* B
- * }8 ?6 H5 h9 o9 c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' \" i% v1 N( J0 l( j1 @) B; t - *9 s* H, E6 J. b0 F. T0 D! z
- * This program is free software; you can redistribute it and/or$ a* X5 w$ ]5 L
- * modify it under the terms of the GNU General Public License as
) A% E E: i1 C7 v/ g% ^ - * published by the Free Software Foundation version 2.
$ k0 \5 X E6 ^8 v - *
5 v! \) l' ~' v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
N9 ~$ N `) o4 c8 `! o0 c - * kind, whether express or implied; without even the implied warranty
& a# U" D. a& m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. o) K! [3 M( l3 _. p
- * GNU General Public License for more details.5 ~: s0 I: k+ T6 ?3 k% ~
- */7 f9 k* E$ `0 `/ r3 w
- 4 u) g' s, N" o* S8 R* B' q
- #include <linux/module.h>1 N7 ]; O P" b7 @. ^ W, Z* Z, y
- #include <linux/init.h># A4 e# f0 ? }# ]$ l$ A8 d; \" P8 ^( T0 b
- #include <linux/errno.h>9 T" h# v. O2 m- v
- #include <linux/types.h>
, Y. S4 d% u9 g& D9 f - #include <linux/interrupt.h>
% A0 X* G5 U, ~ - #include <asm/io.h># b0 h" r* V! o, R
- #include <linux/moduleparam.h>
; e- s; c |. c% g - #include <linux/sysctl.h>' [$ Y5 u1 b+ @' L. s3 F- @, o; x/ J
- #include <linux/mm.h>
' z9 Z7 R& M0 N% d - #include <linux/dma-mapping.h>
, E3 Q, x7 ~2 p5 @
+ i% ^! ^' y% |2 y- #include <mach/memory.h>
' q; a [1 L5 u; g7 C$ L: Q - #include <mach/hardware.h>
0 w A" X9 @/ W2 ]$ H - #include <mach/irqs.h>
% a. i" _2 I0 @. [4 K - #include <asm/hardware/edma.h>
- D+ P8 u G7 a6 U n/ O - 4 @0 P! }# H' o1 K3 L! @; K
- #undef EDMA3_DEBUG& _- _# Q' D' ^4 E
- /*#define EDMA3_DEBUG*/
* j" s- T& P0 S- Q
, Z* \% B. |; P- [- #ifdef EDMA3_DEBUG9 V& P( I( {. T) h) U- G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 K! E3 {* N6 U" V5 L. [) ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: \! j( m& }, b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( Q) {+ E+ n3 U# L# [. ~ - #else
9 A9 h0 k4 i' M- F - #define DMA_PRINTK( x... )8 I- o0 W8 t9 T3 h6 y
- #define DMA_FN_IN
+ K2 j9 {( }, x# C" u - #define DMA_FN_OUT, n- U: v9 i T5 ~, H8 K( t k4 ~- C
- #endif
1 m! d* \ N Y" H2 M" W) \% _ - 4 w2 i! p8 _5 c' I! ~) p$ e* B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" H( o# ^3 {! V" a/ t - #define STATIC_SHIFT 3
, i( H: I2 L' p - #define TCINTEN_SHIFT 20' {- X5 `; Z6 X* d: ]7 h8 R% i
- #define ITCINTEN_SHIFT 213 z$ |6 f+ _/ w
- #define TCCHEN_SHIFT 22* a. H# t, {: o7 [$ o, `
- #define ITCCHEN_SHIFT 23% v5 I( @: t9 {3 T4 s
- 1 R* L- \* Q/ z6 w) I
- static volatile int irqraised1 = 0;
* J! N8 k) x& L& p. n* I. }7 c* Q - static volatile int irqraised2 = 0;
+ ^6 _* V5 `5 a$ z% A6 [. j - # T7 y' _% s5 S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A2 q+ r, W, t8 x$ I% i. P0 F! A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ R) U6 M+ l. V; _8 b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" @4 A- P$ F' |" P! J
' U2 ?- \4 E$ S8 ?- dma_addr_t dmaphyssrc1 = 0;
0 v1 V! i1 d; s8 A - dma_addr_t dmaphyssrc2 = 0;
$ J6 ?2 v; s, k C - dma_addr_t dmaphysdest1 = 0;
3 T3 U E$ {) t) X8 y( r - dma_addr_t dmaphysdest2 = 0;3 N4 d0 J* @7 o9 T1 s f
- 3 j4 O1 W4 _4 Z1 G
- char *dmabufsrc1 = NULL;
7 |. t, U1 Z. Z2 M2 Y1 V* F) b/ d - char *dmabufsrc2 = NULL;- ^6 R. Y. Q- I W" K$ s
- char *dmabufdest1 = NULL;$ J9 k4 T' Q7 J- Z
- char *dmabufdest2 = NULL;+ g% @" S! e/ Y# o
8 S/ Y, E$ @& i5 E& ?- static int acnt = 512;! u+ E4 ^. h: `& m% t. W. A$ I
- static int bcnt = 8;
, T: z4 y* B1 W$ w2 _( Y% R - static int ccnt = 8;
5 c0 f* [$ g' M - # L" u$ d3 u* E% {0 J
- module_param(acnt, int, S_IRUGO);
" C! x P$ m$ R+ i+ O - module_param(bcnt, int, S_IRUGO);4 q2 ~- |9 r( z
- module_param(ccnt, int, S_IRUGO);
复制代码 9 }6 `8 Q7 ^* V: ]( @% F
5 f6 B& b5 {4 q+ [# x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& h: I6 i0 w, ^1 M6 `4 k4 Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ ?* m' v& o; c8 J; ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ S- s. F3 J; O& ]1 Y6 Z
3 Z4 E" a3 i! b% v3 r
" i7 f8 r" _, { U
|
|