|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# M9 C. e( o6 p' D7 `. E2 a- [code]EDMA sample test application, G; |% b1 {+ i; V" O
- /*
# P6 [+ a V/ G - * edma_test.c6 m8 b8 W3 E9 [9 p1 x
- *
( v1 _% c0 M9 G* V! q! [6 b - * brief EDMA3 Test Application' z1 Q6 H7 {2 o5 D
- *
- T* }/ E" f- F- }0 B; Q - * This file contains EDMA3 Test code.) X& z- g& U, n& `0 j" r, G+ O! T
- *
* N8 ~6 y$ `+ o$ ~' r7 \& a9 F/ J) k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. q5 k# A& h) g! G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 H# F7 } @3 f0 q6 y - * TO CHANGE.5 f# j2 ?3 V& Z3 w0 l
- ** S# w! q8 k. M. u8 ] t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, Z, f6 s/ _, {* @ - *
: ~5 v2 l, o* q. j2 e - * This program is free software; you can redistribute it and/or
& o, c6 `7 g* h' z0 v; [ - * modify it under the terms of the GNU General Public License as
' c) m9 Q" a# f, N7 E - * published by the Free Software Foundation version 2.) x' \. v& Y: X% N
- *. G7 W: A ^3 a2 S( x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 B, E$ U5 Z0 C - * kind, whether express or implied; without even the implied warranty0 H! u( u/ {4 \' @5 _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ s8 T8 a2 q) y% H9 c9 z/ |
- * GNU General Public License for more details.
: a3 @5 e) s' b9 y& j$ H - */. l, [" D/ H& a( Z1 _
$ t$ x* t; q3 i+ s _; P- #include <linux/module.h>) }8 l3 O1 q( M- Q
- #include <linux/init.h>
3 S/ p* L6 a p# D1 ? - #include <linux/errno.h>
/ H* \5 t) n" V0 t& o - #include <linux/types.h>" ]1 R; w4 H, N- h8 F) [
- #include <linux/interrupt.h>( a. [( v- `% Z& D" x. d
- #include <asm/io.h>
) e+ c" E# u- r6 T7 ^- R - #include <linux/moduleparam.h>
8 X3 k8 [, Z# I6 f3 } - #include <linux/sysctl.h>
' K6 d1 j! z+ e0 Y2 |% V - #include <linux/mm.h> M! N& A* A/ Z( n* H6 p, X- Y
- #include <linux/dma-mapping.h>
2 \' K+ @/ n1 l) x: @/ t - 0 Z, s, U! e4 `7 N( N
- #include <mach/memory.h>
, w7 H. h+ m+ T H2 A8 d - #include <mach/hardware.h>
$ O h$ b t9 m. e0 H - #include <mach/irqs.h> l1 S! R8 i& i8 i
- #include <asm/hardware/edma.h>& R# {9 ?4 l" _3 X
, g8 i! S" c$ k1 q+ d# H& B- #undef EDMA3_DEBUG
6 L9 [1 {& D1 |- |- K. v% z6 a - /*#define EDMA3_DEBUG*/* S; d6 Y9 L: s' t
+ B' C U7 y& g8 z( g/ p- #ifdef EDMA3_DEBUG* H1 d& a! c& N& b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. M( g6 G) r4 T; h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* }) B! e# u, f* e. y# h/ ^# O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ p) o- W4 f+ \. U: A - #else
~9 x7 u; t+ D' } - #define DMA_PRINTK( x... ): L% u+ A7 z% p) U$ P+ N- N
- #define DMA_FN_IN
# u/ c: W v7 H' C9 g - #define DMA_FN_OUT5 G8 W& H; x/ w" y1 R
- #endif, Q7 p2 v- h0 o; Z! F, I
- 0 k$ h- X) S9 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( b: a8 \3 V7 V4 g
- #define STATIC_SHIFT 3: i6 P4 M2 q4 o- C; y
- #define TCINTEN_SHIFT 20
; |' K: G. N# e% I - #define ITCINTEN_SHIFT 21- |2 k- @+ E8 x
- #define TCCHEN_SHIFT 226 J+ d4 P* m/ h* }$ N! g2 k
- #define ITCCHEN_SHIFT 232 L7 U4 e0 W# r* X8 J7 S% B) Z' G+ s
; N6 Q9 \) |) d- static volatile int irqraised1 = 0;
4 l( C- J9 ?: S' N/ L7 | - static volatile int irqraised2 = 0;
, B1 C: v+ |6 V - , E' G) K/ U& d3 p) s; L9 `) @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 B, k' y4 w# R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Q8 K# `/ l2 Q* i4 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T' P5 @1 U' y! S. G K
- # U: p9 Y& S6 p$ M r+ e' j2 @
- dma_addr_t dmaphyssrc1 = 0;
3 R! a& \ Q( Z& l! X - dma_addr_t dmaphyssrc2 = 0;8 J, M/ n4 T. Y
- dma_addr_t dmaphysdest1 = 0;1 K; P0 f- a+ [; R
- dma_addr_t dmaphysdest2 = 0;3 P! r& `3 ~- x' j* t+ h% R
- 8 d h+ \0 b4 u. v: ^& [
- char *dmabufsrc1 = NULL;
) \7 ~. Q4 K1 v# ~; b6 U - char *dmabufsrc2 = NULL;
4 v% i2 |+ }0 F1 y: w% e - char *dmabufdest1 = NULL;
1 {0 d/ n \( e- Y, | - char *dmabufdest2 = NULL;1 u( z. e U0 `$ w
! J1 U! E: P6 E4 s' |& Z- static int acnt = 512;
" E, z& Q ~4 _- D# l - static int bcnt = 8;/ o P e/ w% ?" Q" G, @
- static int ccnt = 8;! q! J# I& L+ h8 n9 s1 g( C
$ J5 \, [& M5 P; E8 D- module_param(acnt, int, S_IRUGO);
+ j% l# b: F# g, d& ~7 V9 v8 ~: ^ - module_param(bcnt, int, S_IRUGO);
& P' c% i& e& Z, _ - module_param(ccnt, int, S_IRUGO);
复制代码 $ y9 q/ b4 X! O8 f$ u+ x
/ o5 z. a2 A# G( S/ E* o5 R4 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& R! @: v! C# @. K |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 A3 l7 ^% R: e+ ~7 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! B0 ~9 d. G" l' [6 m
1 ?8 u$ D4 J' B2 v/ P+ ^1 `
6 K) j: @2 }7 R U4 } |
|