|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * U: h& D8 `# i4 \0 V
- [code]EDMA sample test application
+ S( Q- t8 N S% c& o" C! }& A8 ^ - /*
. J1 H9 s) t( k# B- _ - * edma_test.c' B+ X1 R) J4 e$ C: a" b
- *& l7 F1 q$ d# {$ ?1 d
- * brief EDMA3 Test Application
* |5 ?+ F M# \8 o& O) Y# | - *5 U5 n- [: U5 k
- * This file contains EDMA3 Test code.
' g. F% z* @, l4 P1 f! ~) Z - *
4 Q. ^ d$ o* N5 X8 {3 }3 a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- m, W; I( ?9 ]; ?" f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ {6 D: v0 ]$ D - * TO CHANGE." V' A& v+ a3 r0 t8 ]) q
- *! M/ j; K# o9 h3 l1 N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) Y" P; A g) }
- *
0 p& e- V" M& K' I7 l: W - * This program is free software; you can redistribute it and/or3 ?# F& e/ m6 z! C8 x: r) P
- * modify it under the terms of the GNU General Public License as
2 U& t/ I3 ]# Z' A( | - * published by the Free Software Foundation version 2.
4 u9 `. p% o- _4 E+ u- E - *
% X) s) V; @) ^. d- l Y+ V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ B0 _& m; a' d
- * kind, whether express or implied; without even the implied warranty
9 A+ u3 r6 ?3 e2 n" s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 L3 ]& N( F7 ^# L6 T - * GNU General Public License for more details.
) Q4 m* n* S O - */
, C, W6 L8 |+ N o
6 A9 s% s1 b* I4 T! q1 D- #include <linux/module.h> F M8 @( B" R& |
- #include <linux/init.h>
( \2 v: B6 }- O. _ a - #include <linux/errno.h>; L* D9 ?" f4 [! q6 N2 V$ x
- #include <linux/types.h>/ M: a1 D7 f4 m- p
- #include <linux/interrupt.h>
7 |$ I4 Z9 e T% V- b/ F" U5 _. n2 S- ? - #include <asm/io.h>
8 ~6 _( z; i! t0 K, ? - #include <linux/moduleparam.h>
) D8 n/ g. s+ [- t; i - #include <linux/sysctl.h>/ V& a# ~9 N! ?( H+ m2 n& b
- #include <linux/mm.h>: a" S! y! u4 y8 w" @9 c
- #include <linux/dma-mapping.h>! O' _$ b9 K+ K4 `. e ^* V
5 G, f; P- W/ z4 e- #include <mach/memory.h>
8 o, g* ^6 j2 |& a# H - #include <mach/hardware.h>
y, p" N# X0 c6 k# x$ v5 J' b v* O5 l - #include <mach/irqs.h>
6 ]8 R5 w7 f! J* M( o- @& ?+ n: Z - #include <asm/hardware/edma.h>
- w6 i* I/ j0 D) Q - 3 C v+ k7 }0 q" m+ x6 Y$ \8 _2 Z
- #undef EDMA3_DEBUG
, x$ h6 b6 X) I6 S) G# ^6 } - /*#define EDMA3_DEBUG*/
! p7 p: \6 |4 H3 V6 n) Y- d - v$ J/ F5 O. ^* G
- #ifdef EDMA3_DEBUG
& j" |% ]7 i0 V; u. {# Y# B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; _3 x! ]: Y$ ?( U5 K7 n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 H) o' G7 D7 D/ Y3 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) I% \4 U8 y# m - #else
2 x0 |& P3 i. ]$ h9 v R' B# ` - #define DMA_PRINTK( x... )* J! K3 a# v1 [) x- T
- #define DMA_FN_IN
5 {; i* |- A* R2 u9 a8 Y8 M3 X - #define DMA_FN_OUT
3 D0 V$ y* R+ ~! @/ O' ^+ k4 G0 x - #endif, G% q8 y K0 [4 p/ A5 \- s
- % T- `. z0 [9 H3 U. o' P( F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ ~3 S$ [! W8 O
- #define STATIC_SHIFT 30 v, [! y/ [3 }% T( |4 C ~. h7 O
- #define TCINTEN_SHIFT 20
- v/ C; h# z4 M7 T - #define ITCINTEN_SHIFT 21 k- ~' U% }3 \: u6 M/ ?
- #define TCCHEN_SHIFT 22. E# H, `) P* ~ M% T2 g6 t
- #define ITCCHEN_SHIFT 23
: j# ]1 q2 l% _# i' c* x - 7 Y a& o1 ?% U- f3 q( k
- static volatile int irqraised1 = 0;+ i# `8 q1 S9 Q, V4 ^( u' q9 A6 I
- static volatile int irqraised2 = 0;9 h1 ?- E( l. G5 [8 O7 @) a
- 8 u, O1 U8 ~1 s9 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 J' p4 g$ V6 E _! w. W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r" | I7 ~4 h9 {( }" U$ W4 b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 T( V4 g% |: J3 L. G; }0 Z
. m1 N0 H7 u( H& r$ ?3 U- dma_addr_t dmaphyssrc1 = 0;
' Z: G- f- f+ B+ O: y - dma_addr_t dmaphyssrc2 = 0;' Z _/ ^: l2 w8 e& }9 P# E! d; D9 ~
- dma_addr_t dmaphysdest1 = 0;6 W V1 |* l0 r8 C, _* V9 K
- dma_addr_t dmaphysdest2 = 0;& W3 Y L+ T/ z! u
! m( o, e; F6 H0 I- char *dmabufsrc1 = NULL;
! X: s# c/ t. V# R1 F( |0 C7 l - char *dmabufsrc2 = NULL;
( S) i, U+ U/ B/ b9 b4 ]9 R - char *dmabufdest1 = NULL;, h |! b5 f% g5 e
- char *dmabufdest2 = NULL;8 a0 u+ D- q" u& F- m: U# O! ]0 |
8 e; _/ i* J2 z5 i2 }. T: r- static int acnt = 512;7 K6 w. e$ | S1 t
- static int bcnt = 8;
( C! d W$ G, ^1 Q: G* V - static int ccnt = 8;. J0 M8 d' X& Z4 U
& P* Y1 i6 T# w9 U1 P* D1 c$ ^( G- module_param(acnt, int, S_IRUGO);
2 h% N+ B* y% S% m2 H - module_param(bcnt, int, S_IRUGO);7 U0 `: {0 Z' `, B
- module_param(ccnt, int, S_IRUGO);
复制代码
5 m4 {. D w9 j/ U4 C5 Y/ Y" Q7 G# w4 Z' U7 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# ~5 I2 C2 O; M# k: x2 Z* l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 g8 |, T( x6 n' o! z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* F1 F j7 v# F0 k, r
9 L" b5 g, C& G& ^+ g/ H! ^& z5 r
8 q, J0 A$ s4 k) f: K4 S
|
|