|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # d! }: j, g# g# o" \! F) c
- [code]EDMA sample test application
/ i3 M# B1 ^ p3 D - /*. j* K$ t/ Z: f4 g$ g; J& K5 q' l
- * edma_test.c
$ v9 C6 M2 C+ P5 b& C - *! e9 n2 o; ]! o& |9 k
- * brief EDMA3 Test Application7 D X# I, U: u. `4 j
- *6 O# s- U' U2 ^- w6 E- G
- * This file contains EDMA3 Test code.
% U4 _% I% Z. b - *
0 p& |' U: v4 b1 N `) h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE Y7 z0 `* a/ D$ v" b i: p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 b9 W: i. `9 f @ _$ l - * TO CHANGE.3 y* J2 J+ k5 T% d o
- *
$ R* i2 P: f3 w+ ~( u/ ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! o8 s( X# |3 e; Y: i
- *" v) e8 z, C% Q. O) [
- * This program is free software; you can redistribute it and/or1 }3 ^8 i6 N# W/ W6 V6 K0 _
- * modify it under the terms of the GNU General Public License as w# r' @# X, w6 T7 |0 Q
- * published by the Free Software Foundation version 2.
# _& C8 N, C9 } - *$ T) g2 K& R5 c6 Q4 W: s2 x0 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: S, ~+ i! z2 V' L6 f' i3 z, o - * kind, whether express or implied; without even the implied warranty" b2 q& r8 H* f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 q {; A7 j5 o$ w6 o1 ^5 U
- * GNU General Public License for more details.( h$ t! k) ]( q# l* i9 ?2 _
- */
$ Z9 Z) Y8 \( ]# Q0 C - & B- L# Z* l6 z
- #include <linux/module.h>
; l- I& B g p: z - #include <linux/init.h>
9 ?9 O! a4 b" M( `7 f* ^' N" | - #include <linux/errno.h>
8 h# C/ f( |7 a - #include <linux/types.h>
/ _5 r; f8 p. q9 t& ^6 d' Y8 o - #include <linux/interrupt.h>0 N2 ?, z9 U3 T% u5 d
- #include <asm/io.h>4 w6 G( ]6 s: \
- #include <linux/moduleparam.h>
- O8 \1 E6 t9 J) c& y, U. ? - #include <linux/sysctl.h>
/ b* z. T& O& K l, y1 F - #include <linux/mm.h>2 U# u# g2 ^" R" N3 c, b+ n
- #include <linux/dma-mapping.h>) f+ Z3 @3 M0 J) b* ]
' z+ a6 B3 a: h% G: _5 d- #include <mach/memory.h>& }7 u. N+ N$ o' q9 m1 x( T/ r
- #include <mach/hardware.h>6 X9 J! D8 m! q0 |: D& g
- #include <mach/irqs.h>. I K J& G, g) H2 {
- #include <asm/hardware/edma.h>
9 f+ |: O. N3 O+ A" S' G3 q% ~
( }3 i$ H$ M7 T3 h% `- #undef EDMA3_DEBUG2 Y& H2 @1 s0 Y
- /*#define EDMA3_DEBUG*/0 N7 U1 G- d! `2 j- P' i+ W
- . K6 L2 \$ E( b6 Y
- #ifdef EDMA3_DEBUG
* b! C: M6 c ~( L$ T/ ~" n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ o; O9 M$ E- @& }+ { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! X6 [: f4 p1 i E$ _' h# ?2 a! t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 V( h1 q. l* a
- #else8 a9 `3 p6 t" ^) {- m( c
- #define DMA_PRINTK( x... )+ v- l; {/ @( O& R' v G1 h
- #define DMA_FN_IN
6 N$ p2 x" Z( J9 n( T' e - #define DMA_FN_OUT- P+ K$ e5 P& `; J1 ]" z( R
- #endif, h' G% E, |- n4 o6 `9 V
- , K9 N2 {8 u; h9 C! b8 n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 w! U( C( |- O* A3 c1 |' @
- #define STATIC_SHIFT 35 g/ `: d2 h* @0 I
- #define TCINTEN_SHIFT 20+ \# T5 W# @9 ^; L
- #define ITCINTEN_SHIFT 21% o0 A$ S, y: Y) n1 `" A! S# E
- #define TCCHEN_SHIFT 22* S" |- L+ ~$ o9 h" S/ N
- #define ITCCHEN_SHIFT 23# K2 J. P, G' _& R# v2 b# h( \
. C3 T- O8 }" |, t- A" s, `" q' W: k- static volatile int irqraised1 = 0;
- e1 d( {) U7 B) a+ U$ c' I1 d4 f - static volatile int irqraised2 = 0;) ?$ e# \ b, j0 |% n' v! C( `
& E1 P8 A' i# B9 i2 `' h! {5 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, t% H1 R' x8 M* \/ I# E7 l8 W+ f% P8 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
S$ v/ @3 g. d. I2 T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' J H, r0 G1 ]6 {. h) ^* B
/ k W. j# [1 K' a4 ~, u: c! A- dma_addr_t dmaphyssrc1 = 0;& k$ V, j- [2 b2 x7 |4 U
- dma_addr_t dmaphyssrc2 = 0;6 S$ o1 L6 m; W7 j8 ~$ o" Y
- dma_addr_t dmaphysdest1 = 0;
1 Q$ P- a' c7 `9 } - dma_addr_t dmaphysdest2 = 0;
: h/ y" Z- [* B7 `( V - - O% V; t( k, C$ e: z b) ~- }6 k1 v
- char *dmabufsrc1 = NULL;
# `5 h8 l1 F F, X* w V/ F7 i - char *dmabufsrc2 = NULL;* v8 m! K. v" |9 M1 C. ]0 `; ]
- char *dmabufdest1 = NULL;
; a; B, e, X' F- m6 C - char *dmabufdest2 = NULL;
' @0 I4 w* a8 I6 ^( o& P5 ^
- Q% m/ k( N' N) D0 \4 ?0 C- static int acnt = 512;; b4 r+ N; S- A7 }6 a% K5 o+ G
- static int bcnt = 8;
5 G9 @; [% \: O1 L* _ - static int ccnt = 8;% h8 n/ D: S0 k
- 5 P& P3 u3 \! Z0 ^8 h4 Y
- module_param(acnt, int, S_IRUGO);( f& i% O3 ?9 x6 W1 w& W- g/ H& [, V
- module_param(bcnt, int, S_IRUGO);) w0 l9 H/ p c% y; U+ F5 [
- module_param(ccnt, int, S_IRUGO);
复制代码 ~) m7 B4 e7 [' r5 w6 m( E
4 `2 H+ N1 W( x, v9 C, } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. J! a: [! i6 X8 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& \3 d3 _1 J* V3 P' |; G; c! u$ I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! C, J% P W+ O6 V+ p& ~+ w/ y. a7 P; ^$ Z, q
3 O: {) G% {1 w" b
|
|