|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 ` b. o; H- p- f6 Q: g- [code]EDMA sample test application& b: s& ]. F% s7 n
- /*) v$ c2 V7 I" l" k& ]* o7 U
- * edma_test.c4 y/ S0 j2 k! d5 G
- *
0 v6 Q% |0 h. k2 M8 V - * brief EDMA3 Test Application
8 n# i( h+ K" o/ G% ]5 I2 `2 H6 q - *7 ?$ Z. K( {$ e
- * This file contains EDMA3 Test code.0 L; ~9 b. O( q+ ~0 v
- *
' P4 U( C/ ]7 _; z0 p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 D$ j% P/ `3 N7 v5 \5 v) D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% L8 {" z" a7 p- O6 k
- * TO CHANGE.: }8 o: N$ [( E2 l5 Y x
- *
: }- R4 E& y K7 B w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ j4 ]& A* P6 N$ k7 U3 S* ?- Q - *
! m2 {% T) P% i5 p" Q: `8 T - * This program is free software; you can redistribute it and/or
/ v0 I, s& q% H W* x' c3 j - * modify it under the terms of the GNU General Public License as# W5 G1 S3 K3 Z [% E. I) p2 d
- * published by the Free Software Foundation version 2.0 S& E* s. G: @0 u8 Z; Q; {* A
- *" c# z8 R$ @: y2 D$ K8 C, s3 N$ ~/ Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ q. L- P4 d8 e* R& K4 {
- * kind, whether express or implied; without even the implied warranty2 U/ D4 p2 J7 W I( R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 ~, U# d% N4 c' g
- * GNU General Public License for more details.
8 E8 ^ L& y; n g5 b0 _: v - */
0 s" }5 ?5 h2 w- O0 F' \ - 9 N! y4 N& a/ k$ l/ b* `6 t
- #include <linux/module.h>
7 n ]* i, f- @( u6 X6 D1 v7 R - #include <linux/init.h>
! h3 K$ r1 @* R2 n2 ~ - #include <linux/errno.h>
5 {( z4 g$ b2 x9 n - #include <linux/types.h>
1 ^; ?$ c& _4 A7 M/ G - #include <linux/interrupt.h> y; F! r" e. D, I0 Z
- #include <asm/io.h>, ^& w( u& x* x7 c# G/ V
- #include <linux/moduleparam.h>" X8 A! Q$ u" T7 R
- #include <linux/sysctl.h>
; |! U G0 Y! J - #include <linux/mm.h>$ X* v3 w0 [8 o
- #include <linux/dma-mapping.h>) t3 r! u, k3 F2 }& i/ d
@6 w$ r9 O4 ^1 t- #include <mach/memory.h># | ]4 a$ j! a" ]9 @
- #include <mach/hardware.h>' K6 Q! q4 n$ V" b
- #include <mach/irqs.h>
! e! z0 }2 v, j1 R1 { - #include <asm/hardware/edma.h>3 [1 Q5 V1 Q8 |# j0 s" E5 {. Y, J0 ~
; M6 x- n: j# y- #undef EDMA3_DEBUG" i4 X6 b4 D$ F& e$ ~
- /*#define EDMA3_DEBUG*/
3 K$ ^# c5 E2 J2 P' L0 ^
: h/ p! Z0 h/ s7 X s1 g. p' x! W- #ifdef EDMA3_DEBUG
! | k) ^& e5 r7 X& o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 ^& e- \6 ]& J: ` L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) H$ ^5 u: @# `3 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 `" u5 [; I, ^# q( e8 [0 l
- #else/ g' Z! |: P4 f+ g6 P
- #define DMA_PRINTK( x... )1 t! u8 B6 L p4 N& c
- #define DMA_FN_IN
$ ^& n" p! H$ g4 U6 u( c5 T - #define DMA_FN_OUT
( O, I. T, J% X$ y( b - #endif
# B, E% Z4 u! M3 x1 g& T. d
* G- p' |4 T; E" |* G0 g. q. D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ h2 q9 k7 w* v) R4 {: n! i- d9 _
- #define STATIC_SHIFT 37 o! e" K8 q8 v# I# q
- #define TCINTEN_SHIFT 20
+ X! ^9 p$ q. L" A* | f, e - #define ITCINTEN_SHIFT 21* a( R) D5 z' A" a: h8 _
- #define TCCHEN_SHIFT 22
. A& ^) [# A7 l3 G( n' c5 G7 | - #define ITCCHEN_SHIFT 23
; x" B% n- G+ X. f' C F4 u
7 w- T4 F# l! O' u- static volatile int irqraised1 = 0;
8 k' `2 r3 a+ j o" { - static volatile int irqraised2 = 0;4 d4 @# x1 x' T
8 Q: R+ x7 q p [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( G- s7 _+ ?/ |% D0 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 I" F. T. x' T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ X& U* J* o. D - 0 m5 q7 ^1 ]6 K
- dma_addr_t dmaphyssrc1 = 0;
# ~+ D8 b. |- u0 l# y - dma_addr_t dmaphyssrc2 = 0;
7 h4 e! A1 S% G" \, W% P `" T) V3 j - dma_addr_t dmaphysdest1 = 0;1 S; ]8 N) f! j* `- a1 u/ B
- dma_addr_t dmaphysdest2 = 0;" \/ }( N& t+ V) Y! r1 o) Q
7 i. `( X+ V& X5 W0 o/ h- char *dmabufsrc1 = NULL;
! X8 i, K Q l0 ^$ {9 z' d% ~ - char *dmabufsrc2 = NULL;2 A4 P5 U0 s+ P& g- g/ `
- char *dmabufdest1 = NULL;! g S4 i3 h6 V; G) }6 \
- char *dmabufdest2 = NULL;8 b/ B* D! j' H9 [$ F2 r0 m
" o) M* u) D, K) o/ f$ U8 D! c- static int acnt = 512;) z* H# S( ]5 }9 ~1 G8 q
- static int bcnt = 8;
' g$ { w _/ A* L - static int ccnt = 8;. v/ r/ M, z7 ~3 j- [3 D6 M3 R( B! g$ u
- : o2 M4 R2 P& y$ O* `. Y
- module_param(acnt, int, S_IRUGO);7 h0 s, T- d3 h
- module_param(bcnt, int, S_IRUGO);
; m4 I- d8 m# n9 P ~; Y' A - module_param(ccnt, int, S_IRUGO);
复制代码 ! H* U" Y& h& C7 P' i: I) z
, d* G2 _. G3 D C: k* C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 u. o8 c+ a) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 A4 G% o5 m y/ c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 K0 ?3 \: L3 v8 [8 C$ Z( e
7 Q- x& K1 g+ p: e; L) A" E
8 c: e2 X# t. _9 g$ G |
|