|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( `7 k" b1 h X# q- p) W0 X$ u- g
- [code]EDMA sample test application+ g( H0 _& a& e L
- /*
( x- X/ _/ p9 ]8 u# Z: p* | - * edma_test.c
& ^" Q& K8 X/ }7 N* f - *
0 ]- E! t; z8 Y" W1 v - * brief EDMA3 Test Application
& y/ U$ g5 h( Q J7 u2 p: M* a L - *
5 v. s# I4 Y: |! ~ - * This file contains EDMA3 Test code.0 E! w6 D1 C! Z# M2 x) W% S
- *
% x+ |# C8 \5 E# x/ E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 K }, R$ g7 N5 F; M; a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* E" O) ]/ X& R6 \3 ]
- * TO CHANGE.2 Q3 y( h6 }9 i/ m
- *0 \/ v, S& {8 K' M( }* g8 o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 B g0 d9 d% m% S& M: W4 e/ a - *
. t: B' `! J! i+ `& `( S; q/ r - * This program is free software; you can redistribute it and/or# w8 @$ t! ]3 O+ n
- * modify it under the terms of the GNU General Public License as+ U h7 }5 E) S% I/ ^0 _$ R
- * published by the Free Software Foundation version 2.
% R5 z) g+ W+ j: b9 l - *
$ {5 R8 F" \3 G T' g/ Q4 c% e3 J* ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
H0 u6 ` G7 j6 P - * kind, whether express or implied; without even the implied warranty
6 Q; [7 M+ c: v" {5 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" }. A0 s( i! R- B - * GNU General Public License for more details.
/ z% d3 b& ]3 H. D( u6 X - */# ]+ [" @ A4 Z7 ^1 x. a! w' @. s
- 0 D }) H' \- k1 u7 U
- #include <linux/module.h>
3 U: ` C! P4 c( I; L - #include <linux/init.h>& Y; B' F" y9 y- G2 q
- #include <linux/errno.h>4 p8 I4 A e( w* _
- #include <linux/types.h>
. |7 m: q, |4 t - #include <linux/interrupt.h>1 J' r: u0 a1 r, m
- #include <asm/io.h>
) v2 A v7 L/ h* U+ m+ \ - #include <linux/moduleparam.h>9 C" x( B! m5 ]6 n$ C
- #include <linux/sysctl.h>
$ d" P- ?: D X( { - #include <linux/mm.h>
: k2 K* h1 P, w% |; m8 O - #include <linux/dma-mapping.h>. T# b0 a. A/ @6 }4 J4 o$ b9 y
- + Y0 K/ _& D% t% o- ~
- #include <mach/memory.h>
* f; v5 l3 k6 s' o' a' _& h" S - #include <mach/hardware.h>8 U6 l2 r b1 U. Q# L. e8 g
- #include <mach/irqs.h>9 y; P/ v/ @! U' H0 N' ]
- #include <asm/hardware/edma.h>
m/ x/ \: B1 N! C - , ]4 U4 N* b) ]: e& Z: g
- #undef EDMA3_DEBUG3 D9 L$ c, q4 {! M% j
- /*#define EDMA3_DEBUG*/% q6 d5 y7 x* w( h6 P
& a* b$ {( X0 D) ]8 U. d- #ifdef EDMA3_DEBUG
3 x. B8 Z/ j2 h/ `9 g! q, ?4 C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* \" p9 E/ P) [, L0 ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( {9 b% N) _$ P; [: b2 J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, D+ [' N! q' w0 M+ N" l' k/ m2 h - #else
6 p6 e( k. T: p) d" } - #define DMA_PRINTK( x... )' B) Y" o4 ]6 ^. v1 q( j0 h3 M* }
- #define DMA_FN_IN
3 z/ C) f) i/ [& \( g - #define DMA_FN_OUT3 F% T* q) g6 i9 ]3 r
- #endif
. F% H! P8 E! M2 @: g+ I7 b/ a& q
# y; ^, _$ `6 P y6 y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
}/ \. N6 N3 _ ~0 A - #define STATIC_SHIFT 3
+ A* Y" j, [; @ - #define TCINTEN_SHIFT 20
T* o7 o" I6 l( u2 W - #define ITCINTEN_SHIFT 21
) D: B$ m5 K' S9 z5 u - #define TCCHEN_SHIFT 22! }: h: T8 m1 R
- #define ITCCHEN_SHIFT 23
& ]: ~( f9 g8 `$ s: R - * n9 S, r( r7 b* y" t4 \" x3 h
- static volatile int irqraised1 = 0;
5 S& i5 {. ]! K( [ - static volatile int irqraised2 = 0;+ C1 N0 T8 w* J7 [& [4 ^
5 f$ B" |+ X3 i5 h* A8 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ i9 M) |! K1 x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G: h$ Z6 a! Q+ H- c% ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 e. C8 Q* |/ B# o+ U+ g7 W1 P3 d% w1 e
2 P8 g, A% e: r- H% B- dma_addr_t dmaphyssrc1 = 0;
( V0 n) u. a0 o( u - dma_addr_t dmaphyssrc2 = 0;
1 V# m9 l, w/ x - dma_addr_t dmaphysdest1 = 0;
& r1 U: X/ Y, I2 u; s# Q - dma_addr_t dmaphysdest2 = 0;) j9 N/ o5 f) t8 \* }5 `2 N
4 X! r) I6 J7 e% v4 N, {- char *dmabufsrc1 = NULL;
( @, v- L1 r+ T7 I: t8 F l - char *dmabufsrc2 = NULL;5 }% `4 ?8 D4 I- b. L- d8 z/ c
- char *dmabufdest1 = NULL;: }- t$ f, t N, w* ~$ y5 e6 S$ P6 h* N
- char *dmabufdest2 = NULL;
9 Y% W4 r3 d. X+ d+ y0 u/ g
# P4 p y1 c" \- static int acnt = 512;) _ q5 m( t& G0 v; \2 ^$ a/ o& s
- static int bcnt = 8;& `% o; p, k! c2 h$ i0 g; l
- static int ccnt = 8;, K, d2 Z/ G& l9 K& ^) j
- N# Z+ B9 M+ D: S) \5 K) o) \
- module_param(acnt, int, S_IRUGO);& P5 o- g2 m3 d! G+ Q
- module_param(bcnt, int, S_IRUGO);+ g1 y2 E( c. \6 B ?0 ]2 l8 `
- module_param(ccnt, int, S_IRUGO);
复制代码 " O4 Q1 R9 p6 o$ u
, _. t' W2 [4 X1 Z- i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ U4 Y, S1 x# u' y/ marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 G+ G( U, H# J* @: v+ d# a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" U: R8 J2 t0 I
+ ]; A! A; ^, _- s+ Z2 e3 i4 D& J1 C
|
|