|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # r( B% }, `9 C9 x* Z( D
- [code]EDMA sample test application
8 L: d* U6 X) O( A1 R2 o& ~) Y& S9 E - /*
( F/ B, u1 v( h* G - * edma_test.c
' c" O K/ v! d/ T3 r - ** {0 k) Q% K* q% f
- * brief EDMA3 Test Application l" A/ ?' V" Y$ w
- *- }% Q Y/ b% ]1 b: ?& ?1 ^3 y" q* q, R
- * This file contains EDMA3 Test code.4 E6 J7 b, R3 D% F9 b
- *
5 H1 S' T; W5 E: H+ B# w5 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE Z( t6 H5 S: r. x( H1 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 B& V% a% ? C# }4 l/ |6 t2 O
- * TO CHANGE.
6 t! E" ~5 m$ v - *
" f0 Q9 r4 r& P0 s: H/ z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; u, a) K: J' h! n
- *
( x# d) N' |, a - * This program is free software; you can redistribute it and/or0 g7 Z3 K# P+ ?+ j, \
- * modify it under the terms of the GNU General Public License as* ^0 G* i" m7 M
- * published by the Free Software Foundation version 2.
9 Y: l: E) ?8 s' \0 \8 g( u - *
+ F+ f- R2 D' e/ x- p& d. X- |6 v$ { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any I- l( t0 z1 |# W
- * kind, whether express or implied; without even the implied warranty
7 L) W0 v7 ]; b: s# v4 M2 B7 K) x! _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 c- I1 i; E( o* ? - * GNU General Public License for more details.2 S- z" e {4 O+ @
- */
0 Q: ]3 u$ a: \) m* X2 S - ) [5 I8 q) u1 @
- #include <linux/module.h>0 i2 {2 ~1 W# ?" i- }
- #include <linux/init.h>. p; [+ u0 V8 H$ f$ i% t$ J8 g
- #include <linux/errno.h>9 n& k2 \; T! E5 w9 W
- #include <linux/types.h>
$ ?. k" m- l* Y5 L, W9 D - #include <linux/interrupt.h>
% c$ N! Q) F, B - #include <asm/io.h>5 Y% W" H* v2 y8 `" m! ]9 {
- #include <linux/moduleparam.h>
" r/ P5 i3 p9 G- _" Y - #include <linux/sysctl.h>
4 |9 l: g1 O3 x - #include <linux/mm.h>4 w& g- H4 Q' r6 b
- #include <linux/dma-mapping.h>
# O/ M( N" q$ _' [' N- o - 8 y2 X* I8 M" V) a6 S% I- \
- #include <mach/memory.h>$ o. h5 ?% n8 `# d
- #include <mach/hardware.h>
# @9 L9 K* m# Q& K6 w - #include <mach/irqs.h>
" v, C. ^ _: Q0 f- {: \; B, j - #include <asm/hardware/edma.h>) `& h) Z+ \6 S S4 W
/ n' E4 @; f3 v }) I' V: Q7 b- #undef EDMA3_DEBUG
* T- r, h$ J4 D; q: W - /*#define EDMA3_DEBUG*/+ s7 {3 s: d# l) d
- ) Q8 X. z0 }4 p* J
- #ifdef EDMA3_DEBUG6 T; H! V9 ]; v! ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 ?; L+ r% W' U( j" F; w, a7 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 f" w* |& E! h F5 I3 ~7 ?. m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 h4 K, W: z. F% l" r8 X& e
- #else6 R$ ^+ X& A# V8 k
- #define DMA_PRINTK( x... )
& q, M+ j/ V, @8 E; t( K - #define DMA_FN_IN8 C4 x; h1 L2 C$ T% ^2 k" |, i0 w6 B
- #define DMA_FN_OUT2 k+ V6 D* b3 G* Z; Y
- #endif: u$ u% E C5 p% M9 J' ^9 Y2 ^
- 4 q- m, G \% W* q5 e/ m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ c. v( T: j8 ]5 A. Q7 _7 m& s - #define STATIC_SHIFT 36 \, C# S" f/ s, z) j
- #define TCINTEN_SHIFT 20
( k B! |" H: P$ B - #define ITCINTEN_SHIFT 21: O9 f. C: x9 l& H* t+ c) J
- #define TCCHEN_SHIFT 22# h9 d9 o# G9 r e. ?. W. z
- #define ITCCHEN_SHIFT 23
, f: R( [8 n# r+ k( U
# O/ r }& W R' U. V r, u- static volatile int irqraised1 = 0;7 L* M1 v" W: m. }6 a& Z
- static volatile int irqraised2 = 0; p' j+ }/ @2 g
- 2 Z; l! J+ H( h1 u$ ~% |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 S$ D4 Y ?5 [; B* I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, U8 F' u: o3 V1 i; T3 l( x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 z/ F/ N4 X- e P5 q
- ( f: E# d7 P, m( y" P* i0 L( g& J
- dma_addr_t dmaphyssrc1 = 0;
. ]4 y/ U' h) ` - dma_addr_t dmaphyssrc2 = 0;# }+ K u- K5 l" `2 k
- dma_addr_t dmaphysdest1 = 0;
+ T# A8 {9 \# [ B; Z# t% V( o( @ - dma_addr_t dmaphysdest2 = 0;
' ?+ l+ t. H" h ^ - * O: ~4 U) |$ `- h' Q/ c
- char *dmabufsrc1 = NULL;
7 T& e$ @" K3 ]/ c( D - char *dmabufsrc2 = NULL;
! Q: t; Q- ], R5 J" e: A) H - char *dmabufdest1 = NULL;" C4 B9 s8 K( L, g1 W$ c6 G
- char *dmabufdest2 = NULL;. o: t O, h- U4 m% ^
: ], W* V) @# _8 ~7 I4 Z$ y, A- static int acnt = 512;; e$ }; I4 {, ^2 X$ I5 p5 X7 G! Z
- static int bcnt = 8;% s5 M) N( c/ T' w' o
- static int ccnt = 8;4 E6 ~) |7 E! G' M1 d" V
- 0 l3 T" B5 S- w
- module_param(acnt, int, S_IRUGO);
- R* c% F' z6 l" H0 N" @# q - module_param(bcnt, int, S_IRUGO);# _6 h& t. ?6 @$ Q
- module_param(ccnt, int, S_IRUGO);
复制代码 6 Q# s) V' T* c, J0 l% d7 p8 v4 p
; i! S% H2 E8 [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- w5 j0 J. m9 F3 A0 E! S" Y
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/ r5 X: M( ~$ x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 T |3 |5 `0 C6 C% i/ }! W& }; E3 d2 ^5 |! K+ \% v/ {
. f1 D- _) o3 [' r: a# L+ Z
|
|