|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & ]- }& Q6 S2 k8 T" E" n1 x- }4 Z
- [code]EDMA sample test application
3 J: E& i, ~' [' ?& |# m - /*
, Y; V( Q* t5 I4 B. n - * edma_test.c+ A$ _. ~) a% X/ V1 e
- *, U7 ~! K: y) M1 e
- * brief EDMA3 Test Application
, r# ?$ P0 C' s4 N! @# Z% o3 b6 q - *
2 u: n; p# R# C- T - * This file contains EDMA3 Test code.
: s( O* p! q' g# ]; T2 }" K8 A/ ^ - *
( F' v) p ~9 N/ F5 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 B( P9 j* _, Q- ]' s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ e F) B3 }9 |9 x - * TO CHANGE.. W- c+ a7 k3 Q. f
- *
# g9 Q$ V) H3 [" p3 H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) V4 e, n" R! m. G$ L5 p Z: m
- */ m8 R( o3 }' [9 h' L5 F8 E3 q& }
- * This program is free software; you can redistribute it and/or0 U# S% d/ T7 E
- * modify it under the terms of the GNU General Public License as( z2 j2 d6 k. L( ?% T9 g0 P* ]
- * published by the Free Software Foundation version 2.5 o7 g2 T# D( Z) \* |! E7 h, A
- *
- U$ m/ R3 a( e4 T( R/ V$ P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ N% ]5 y8 A" y+ b: H - * kind, whether express or implied; without even the implied warranty1 d* ~# v: b9 j. C& B2 H; h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% U0 y" R/ e# G3 w - * GNU General Public License for more details.
4 ?& ~& ~' }! k( M1 S$ C$ p - */
' `) |0 u/ u) K& b8 d
& X6 g, }1 ^% E$ W6 f- #include <linux/module.h>
7 y5 r8 t3 Z3 Q8 ~1 } - #include <linux/init.h>
A1 }7 a) i' p, N0 ^" T - #include <linux/errno.h>
& d* ^* c' C+ o7 p, }, m - #include <linux/types.h>' i9 ]* x' ] r% s" n/ p
- #include <linux/interrupt.h>
4 m9 n. W: m. q A8 U* b - #include <asm/io.h>
" A ?1 }* f& g" R1 J) n - #include <linux/moduleparam.h>
! }/ w! |$ T+ U9 J. Q T7 B - #include <linux/sysctl.h>
, Y4 Y m/ S# n6 o1 g! ^4 ` - #include <linux/mm.h>
+ R' O2 e( }; Z3 z ~1 p# g - #include <linux/dma-mapping.h>+ _6 {" N5 D! y# ]1 n/ u5 P
# w) Z4 n. v- f% C6 Y- #include <mach/memory.h>2 l1 J4 Q) l: D3 m4 y" {3 R0 U
- #include <mach/hardware.h>
' a, k* L1 y4 T - #include <mach/irqs.h>
) v$ y: k" ?/ s6 w' I - #include <asm/hardware/edma.h>
% S6 i2 U! R$ s* @1 @) B% e
' N# `* r# h; Y, f, w: |- #undef EDMA3_DEBUG
3 Z+ z9 Z+ D+ a. w - /*#define EDMA3_DEBUG*/
, D) H' J# w1 Q/ W# ~
+ n9 D: Z7 i k7 }- #ifdef EDMA3_DEBUG6 a6 {! t: e; O/ E) l- X8 N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* e3 F& N6 `+ J2 K; d& H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 y" L9 W* k! W% x4 o; X7 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 A# X J8 ] v9 w3 v3 i
- #else
. Q9 x3 Z5 I1 a7 {, g8 B0 K& I/ ] - #define DMA_PRINTK( x... )
" N' m' ]8 G; Z4 v$ R) I$ @ - #define DMA_FN_IN
1 e5 W, k: I+ K! R* ? - #define DMA_FN_OUT% r" d% Y; F [: T0 T% j6 C
- #endif. g/ F% _; f" j' Y" J( S# g
" p$ |2 A, k: x2 c0 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 q- X0 N! O- z0 e - #define STATIC_SHIFT 3
4 A; d) Z" J7 \6 s - #define TCINTEN_SHIFT 20
$ `5 \. A5 [) C" D8 y- l5 d - #define ITCINTEN_SHIFT 21
: L: c1 h- Z0 t! e - #define TCCHEN_SHIFT 22- M1 ~" Q- s5 v9 A% O6 w1 g" {7 U
- #define ITCCHEN_SHIFT 23/ k2 P& P% p. [; q# z" S% B$ @
3 m* I, |6 u- `) j- static volatile int irqraised1 = 0;: T* H' R4 M( A# c" ^: x2 Y+ E) q( Y
- static volatile int irqraised2 = 0;
: l5 `1 v5 a& i
& P: \) P. i4 h* `$ ?, c$ ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ i# n# x% a- a; g& g$ z! J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! |+ X! L `+ X, w4 U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 t8 q7 c; ]7 b$ t3 C; _
: V6 y: x: E+ O8 ~- dma_addr_t dmaphyssrc1 = 0;
1 t1 T. p A, [! W# r - dma_addr_t dmaphyssrc2 = 0;( K0 K. O2 E1 T. _% s A' @
- dma_addr_t dmaphysdest1 = 0;
4 p( t% I5 b7 E - dma_addr_t dmaphysdest2 = 0;8 y* [8 `% A) ?1 k- A
- & @- Q5 t+ t: {- b2 I: p) p+ a
- char *dmabufsrc1 = NULL;
% d% y0 M. ]# M/ j) u. c; p I - char *dmabufsrc2 = NULL;. K" V |- ~: Q2 V
- char *dmabufdest1 = NULL; s7 @% ` N6 z' F9 B+ C! q1 t
- char *dmabufdest2 = NULL;4 K) U! E# M4 b6 x
6 O; z$ d6 n) i% P- static int acnt = 512;* X' D2 P4 C9 u$ e
- static int bcnt = 8;
7 d0 T) X6 {( B - static int ccnt = 8;
/ I( {5 V7 S& g3 U9 X
& S3 g% o8 a* Z$ @( r4 U- module_param(acnt, int, S_IRUGO);
2 }" `3 G% Q) K/ o2 q. J - module_param(bcnt, int, S_IRUGO);7 H6 M1 J/ A% Z/ q' I7 B
- module_param(ccnt, int, S_IRUGO);
复制代码 : u X5 \7 C' e& |' P
" ]0 z! J" ~# {9 F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* G8 N f& a1 c6 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ j6 Z! V# m& H' S" c5 a) _+ @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 T) q- Y, [+ B
4 X. p+ k: T9 A( [
) M2 P- P) ~( P# v( ^
|
|