|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# I& T, G t# S5 k, Z; E- A4 M- [code]EDMA sample test application7 i3 U0 Y& |7 X$ o
- /*, i1 F8 G; w! Z% S
- * edma_test.c
7 ]* k; K8 }% a3 [$ @8 N - *& c: T& _5 t& k# K$ Z& C9 F5 r
- * brief EDMA3 Test Application: ~* H, f- P* W: U8 R# O
- *& G( z6 y4 c# d3 W/ d
- * This file contains EDMA3 Test code.! v/ k& t, g2 Y" m# _4 ?6 L
- *6 x9 Y5 { d" f0 a, O3 D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) _! A) R5 X5 F- B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 g$ U- R0 w/ g - * TO CHANGE.
; C- R% s7 b3 u; K9 C; R4 ? - *
" _" ^) u. D1 C" K$ T# E, j2 c7 q, V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ g; b# S4 d& x
- *
1 i" C; E4 N% \- i }4 V - * This program is free software; you can redistribute it and/or, J; u9 N4 O. w% A& ?
- * modify it under the terms of the GNU General Public License as/ z! R1 u; s. L/ X% h
- * published by the Free Software Foundation version 2.
- {/ O7 }2 E8 M# o# k7 V - *
6 v+ r# \5 G9 P F3 Q, Y; R# l% A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, U+ }; i: ~0 P; A5 c& l9 t$ ^
- * kind, whether express or implied; without even the implied warranty
9 P7 R4 Q" z/ }" _0 m* v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" m/ o) L1 {, b% f ^! L3 L* u - * GNU General Public License for more details. \$ ?) l& m( Z% c- D/ z8 s4 I
- */
/ u1 ]" [# g/ A) u1 s7 N
( w: H* v; K7 b- #include <linux/module.h>4 |! R# Y$ m+ _: }0 f' ^
- #include <linux/init.h># G, J* c8 h3 m& C3 v; [
- #include <linux/errno.h>5 @4 |3 Z+ Z5 Q; D( n
- #include <linux/types.h>
4 F8 O3 T$ u' f - #include <linux/interrupt.h>
7 S5 B' l @* J4 f0 P7 |" f - #include <asm/io.h>4 b- i& P9 B, u+ f8 d# [' b
- #include <linux/moduleparam.h>3 I" w1 w$ x8 l8 X( ?9 I1 ]0 G% U
- #include <linux/sysctl.h>
, A. Q& ]( M* Y- i7 ~6 }7 Q6 ? - #include <linux/mm.h>9 w- d+ C4 X9 t) v
- #include <linux/dma-mapping.h>* v, O4 c b% k& ~7 a
9 C& i6 ?( V" r- #include <mach/memory.h>
! B# z2 R. x K, U$ | - #include <mach/hardware.h>8 V/ R2 W7 ~$ q# u: Q2 L$ c
- #include <mach/irqs.h>. Q% p ]8 {( g; F* J8 A! p
- #include <asm/hardware/edma.h>6 E8 v O& f9 H5 H8 r9 E
- # s3 H* w+ B+ h& J, v+ r" G
- #undef EDMA3_DEBUG2 ^8 r- v, }* b; B g
- /*#define EDMA3_DEBUG*/
. c, O3 M% N, [) g1 Y% x - ) V8 W6 x: `8 w! ]+ B
- #ifdef EDMA3_DEBUG
. a7 o& G+ b1 x8 w2 K) y1 { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 | s: L% y+ ^% Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 H; N, j9 a- g! C* X+ o0 j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ P- V4 M# D/ R2 [ [4 l - #else
: `0 g k& Q# I7 a. y6 R - #define DMA_PRINTK( x... )5 A* ?9 R/ s% v. [) `
- #define DMA_FN_IN
) k: i& A, H+ ?, P/ b; \ - #define DMA_FN_OUT
# _' f$ H+ B) p0 _5 |' @) v - #endif
2 _5 V& v7 `/ m9 e( t) T4 T3 ^
$ R0 m! p; c1 O6 [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 m" l5 N8 d- H- M
- #define STATIC_SHIFT 3
' j0 `; A9 A! q+ c0 i* ? - #define TCINTEN_SHIFT 20
2 L/ U% E1 P, A4 @! c) E - #define ITCINTEN_SHIFT 21
- z4 P3 U& o" b0 u - #define TCCHEN_SHIFT 22- ~! W( u3 } ?% u" F+ N; l6 G6 d
- #define ITCCHEN_SHIFT 23
! K1 ?0 T6 A( C - 9 k- Q; P5 `! S' E# I
- static volatile int irqraised1 = 0;
% l! g! T$ O K {0 e+ x2 h - static volatile int irqraised2 = 0;) @7 E) s' l" p9 W
- , P+ h( _$ I8 I5 o k! r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ u* Y$ y1 S; d% F# j. i5 A$ A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: y2 m# K, x+ l! ]; b& [9 v# C0 I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ {$ k1 r2 \6 b0 U1 ~% `
# z5 F2 @2 N3 y2 v; r- dma_addr_t dmaphyssrc1 = 0;6 A# H- x1 _& w5 x5 r
- dma_addr_t dmaphyssrc2 = 0;
- O! ?4 @, q$ H8 I% w" K @ - dma_addr_t dmaphysdest1 = 0;% d* E' H) H6 p7 U
- dma_addr_t dmaphysdest2 = 0;
! G, u% n e- F" o6 B7 _ - " t ]1 P# T" f/ Y
- char *dmabufsrc1 = NULL;, d' s! ?3 f' G$ V* E
- char *dmabufsrc2 = NULL;& R6 `6 ~# L: G7 Y* Q
- char *dmabufdest1 = NULL;
0 U& S {# S5 C - char *dmabufdest2 = NULL;
: M, [4 @5 }& [9 C
+ R% W, M; w4 A/ P6 Z! n- static int acnt = 512;
" q7 n9 c3 c" @! e - static int bcnt = 8;) R" K8 n& B% E/ T( q
- static int ccnt = 8;
: k! f. K) l& z) F+ ?, ?# m - - f: t4 C# v6 r
- module_param(acnt, int, S_IRUGO);1 W4 j8 S2 f# g" ~: N
- module_param(bcnt, int, S_IRUGO);
$ b, @+ ]8 Y3 O& p5 | - module_param(ccnt, int, S_IRUGO);
复制代码 9 Q4 u2 ^6 B9 ] b/ v0 G% V: ]9 a2 e
, _; U2 L6 e& C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 x! T5 D* u/ X- |* l2 A- J3 Z# ~ y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ r: y- ]' O, Z0 o/ ]% t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ t) W$ i& K- `: P, H' F" X$ a
, H+ B s9 A4 ~# @! W/ K& ?; i/ v! v- z8 e9 ]' C, j' a
|
|