|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 v: U. M) Y# @* E
- [code]EDMA sample test application3 n1 i1 ` i g Q1 D
- /*7 Q: `! I) h) ~/ p
- * edma_test.c R5 U" T8 ~9 U. b- K8 F9 V! K
- *
; s0 Y8 _+ D; i3 ~& a; u) h3 t. O - * brief EDMA3 Test Application# {1 O4 r% H' e+ L# S" o0 j
- *9 `7 d' v& }! J7 P: }
- * This file contains EDMA3 Test code.( k" v2 i( f- i2 q
- *1 _! n# i" y3 N$ w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 h, C$ ^) g& N* f9 n1 a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT T/ j9 x C* j+ U, o0 X c
- * TO CHANGE.
. D, g. t4 T8 N9 `0 c - *
2 G9 R( Y' W, K3 b$ T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ a7 z0 g* w' a8 B
- *
- [0 u [9 ?3 z; t/ V( q - * This program is free software; you can redistribute it and/or2 P2 D) I! ?4 K2 V+ J5 b
- * modify it under the terms of the GNU General Public License as2 }' j* T& g$ h* b! t
- * published by the Free Software Foundation version 2.
# w+ U3 D0 Z6 n+ q' {9 L - *
7 ~6 k, [6 r: L2 V6 H" U+ A& K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 u: O# `( P0 A7 u. d4 \3 ? - * kind, whether express or implied; without even the implied warranty% x- p# O; I3 e( m0 Q" Q. P) d! e0 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 j5 w" r3 i: |( m4 T - * GNU General Public License for more details.( q! ^; g0 W9 \5 `4 ~" q$ ]
- */
* x) \2 }& }3 |0 \; s
. W- h' N) {0 \% A3 F- X' W- #include <linux/module.h>) D# Z& M1 B& X3 Z* a( |5 X$ V+ U
- #include <linux/init.h>2 @/ f) e# P) k$ p" G0 b2 s5 I
- #include <linux/errno.h>5 @5 I; P" c' S
- #include <linux/types.h>9 K) K* F. ]9 K
- #include <linux/interrupt.h>
/ D5 ?3 X" i0 \# T/ W - #include <asm/io.h>0 `% k- b9 n% t1 T7 J5 Z" k) B1 H7 @
- #include <linux/moduleparam.h>
) r" A8 z# e/ @8 y - #include <linux/sysctl.h>5 ~# f+ W! a; `# N8 r
- #include <linux/mm.h>5 {: h% Z$ C' F2 l( ?
- #include <linux/dma-mapping.h>* {3 d( S% }- H# ?2 Y" n, X6 r
- 8 M+ v! \5 n$ m
- #include <mach/memory.h>- @. h {. o. W6 M9 j
- #include <mach/hardware.h>4 w$ |. @. E% u) M s6 y4 J; y
- #include <mach/irqs.h>8 w! {' U" R3 k$ k* Q$ H, f
- #include <asm/hardware/edma.h>
1 r! M, W6 T/ c" a: A' J4 x - , h0 z8 @) i% k! g+ z" H
- #undef EDMA3_DEBUG
6 w f0 _2 T7 \& g9 a5 Q. _9 u4 E - /*#define EDMA3_DEBUG*/
1 J; F/ V. K4 U# _ ^- J" w4 H - 2 v: D; ~3 a4 r2 @. W1 Z/ N
- #ifdef EDMA3_DEBUG
% |$ a4 Z ~ f* a' r# i5 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
z: t/ y' W \5 \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
i- K0 o( w! E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ R1 V: V) i! X' N) ^! i) C9 d
- #else& E1 S. M8 r b) G/ J: q6 z
- #define DMA_PRINTK( x... )
! @$ R5 t; X8 R - #define DMA_FN_IN8 D" B$ b& \; G
- #define DMA_FN_OUT
. u5 i. W$ o2 h5 Q- n/ L - #endif
! F3 j* S, L/ @- } - 6 v) \7 B2 R `' E3 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! K2 v3 L6 Y+ r' |
- #define STATIC_SHIFT 3% c; l$ C+ E9 B l" X3 f; |
- #define TCINTEN_SHIFT 20
) ` L, s, J8 P1 ~( v8 y5 |5 j5 S - #define ITCINTEN_SHIFT 21
& S2 @: R5 Z6 k1 F8 b# i( M - #define TCCHEN_SHIFT 22- M: L. f i1 u
- #define ITCCHEN_SHIFT 23$ U5 i# C" M f6 w) g+ Y! c8 d6 h
- 0 u- q8 }( H T+ f9 R
- static volatile int irqraised1 = 0;; a, [7 ?+ O0 Z: s' @1 T& ?5 X# }
- static volatile int irqraised2 = 0;, q3 G; H; u- e" F9 i& C
- + \. M4 V( g7 ]1 N$ @* T6 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y' n6 R1 G: M' c" h3 X, n/ G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 x2 q% V0 ?8 D2 B' r* y: t' ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 N' E$ @! f9 k
3 `( \3 m, a& K: f# ~; c- dma_addr_t dmaphyssrc1 = 0;* G6 J3 K" q3 C3 l9 Z) t
- dma_addr_t dmaphyssrc2 = 0;
& { [- i0 e; o) b# `; D% [ - dma_addr_t dmaphysdest1 = 0;4 G# P% I1 C c1 T( J) J
- dma_addr_t dmaphysdest2 = 0;
2 d! b1 y& l% t0 s& I% F! b - 0 c* h$ r+ s' G: t( w2 v! G5 s* Y
- char *dmabufsrc1 = NULL;
8 m! P2 U9 H) @' l; z - char *dmabufsrc2 = NULL;
% K' c0 L8 w7 V- a& D - char *dmabufdest1 = NULL;
: T# X) d+ n2 n. } t( R - char *dmabufdest2 = NULL;+ i W$ z. ?4 Z
* Q; [8 r% j% L# e7 l- static int acnt = 512;
+ n9 H) Z6 b* t+ r F; r - static int bcnt = 8;% f& v$ X* Z8 [! P0 i4 i$ b
- static int ccnt = 8;
) Y/ A: Z1 c |2 L
' _$ n8 ~/ s5 `4 G+ I3 y- module_param(acnt, int, S_IRUGO);5 d0 t8 V' N9 z5 `$ W0 @) N( ?/ w
- module_param(bcnt, int, S_IRUGO);
7 Z: r: p* W9 Q! z0 R - module_param(ccnt, int, S_IRUGO);
复制代码
4 I: p! [7 ~9 p. i$ W# J/ g; d7 X/ T" Y% Q3 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, v+ t3 o* ^. T2 S3 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- m: t- |' F f' D5 Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 S A m* K2 i" \
7 a* Y4 N! s3 a G }$ J- t8 x* u0 L8 P$ ^, Y0 {6 T
|
|