|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) y8 f7 L6 L! ~
- [code]EDMA sample test application$ H2 f! N$ o: e4 ]; Y
- /*% C8 e% j, N1 Z' }9 g
- * edma_test.c% K" F- p1 f/ }* a0 j
- *
/ n6 y0 d5 z0 z - * brief EDMA3 Test Application
: @5 R) c6 s- S! A1 T5 Y - *
7 T3 c0 Y6 u6 F! B - * This file contains EDMA3 Test code.
5 e( w' Z! f9 J2 Z6 u) s/ R& ] - *
1 U# }- ~) J+ `& z! e4 @9 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. F5 s- B# V$ M& i% c4 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 X, M& A, q. p L+ e# L6 w% }
- * TO CHANGE.# N/ @5 b4 r( b1 z3 m
- *
& g6 L { ^3 O+ a' `6 @. U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ L5 S8 D/ P# K* _
- *
( C5 d- g7 S0 d% y3 _ - * This program is free software; you can redistribute it and/or
# d% P. ?& M% w; } M( e* G- Z - * modify it under the terms of the GNU General Public License as
4 S3 y- L6 z% L; r+ [$ M% i# [ - * published by the Free Software Foundation version 2.
9 l" T# p" l3 `0 o - *5 i5 A5 }) Y$ \) L4 v$ \( o& d) q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& x- W, T! |& V - * kind, whether express or implied; without even the implied warranty
8 ?. A, J) w! y' ~* s# w- p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ U' l& J" G) T7 o4 Z6 |6 A" g% U# ]
- * GNU General Public License for more details.3 ]5 E7 c4 T, W. L
- *// @! J9 P) L8 |9 V3 O9 ]( ?
" {4 i3 o1 K) L; M) X5 A& V- #include <linux/module.h>% A" x+ W* V- D- m' b4 v* c% a
- #include <linux/init.h>
7 t- X% y9 d) ^) }1 a( ~' M - #include <linux/errno.h>
/ A5 E" O3 r3 q4 |) h* t - #include <linux/types.h>
( [$ [, t; \5 b( W6 T# [ Y0 s+ j - #include <linux/interrupt.h>0 B5 h( f/ \0 a6 n; w9 M( X; R7 r' d
- #include <asm/io.h>
6 I# L% a: e+ W& y' J* L - #include <linux/moduleparam.h>
9 t1 F! j8 p. C {% I0 ^. z - #include <linux/sysctl.h>
& i# p% o; h; e" J - #include <linux/mm.h>
( U. l3 m6 W/ H9 R - #include <linux/dma-mapping.h>4 i! x: H4 m, K- o
- 7 I; v# L' v3 T7 L# @3 t% O! {
- #include <mach/memory.h>
' m2 p0 Y& ~( j* `4 Y L8 ]1 s - #include <mach/hardware.h>
1 I# U* W) v5 V' ? r) K J. k4 e - #include <mach/irqs.h>
* o- D, l, _& j- s$ V. [2 l - #include <asm/hardware/edma.h>! P& P6 I3 C# {4 p! G0 |$ y( {
- # {: A2 t, u) v t# F
- #undef EDMA3_DEBUG
/ E, ~* c1 j6 k7 ]( P9 C - /*#define EDMA3_DEBUG*/* I2 j; G0 O" ^
( J, p3 g6 h) l' w- #ifdef EDMA3_DEBUG2 G) U0 G3 h, w, o+ u! C; D ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 X* m; i1 g2 ~1 v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! `- c+ r. C& ?. V" p9 n6 Y P7 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 [# A) C' a+ w l - #else
: l; i, b8 w/ c& e- R - #define DMA_PRINTK( x... )
* w8 ^5 |7 d- a1 w: t - #define DMA_FN_IN" Y# V2 J' t& |& x0 O8 N
- #define DMA_FN_OUT7 f7 m; R4 t2 |7 l7 L5 T# n- a" n7 Y
- #endif
# |$ F6 d5 W! _. d3 t& }
' a/ P2 n# g3 d3 [' H+ d1 F/ k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# \2 J% {' Z- s& [. P, K - #define STATIC_SHIFT 3
! J+ A) ^. L# z A' B - #define TCINTEN_SHIFT 20
& \1 K' x4 K$ L5 L" m - #define ITCINTEN_SHIFT 21
* v, Z6 m ?, @' L' Q- d - #define TCCHEN_SHIFT 22
8 k f7 z) p1 v& A - #define ITCCHEN_SHIFT 23
/ e) {$ b9 I" O K - & d$ e) H" I# ?' H0 d
- static volatile int irqraised1 = 0;* T8 T7 N; S. {8 \$ l* M: P2 [
- static volatile int irqraised2 = 0;
' z4 ^' w( B0 K+ T
" j" s6 @2 {. x3 r3 g- c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' j7 h& q7 a7 N: c# t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 d+ k- u$ y7 U; `/ q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 H5 O& Y2 P" P/ ]/ e& S1 j
0 V* C4 \6 a4 m5 l" ?" H) x0 T- dma_addr_t dmaphyssrc1 = 0;
) k! m# O% o0 w' ? - dma_addr_t dmaphyssrc2 = 0;
, T5 c3 n9 m3 P3 _ - dma_addr_t dmaphysdest1 = 0;0 u+ K- R0 f4 c: b4 @0 B
- dma_addr_t dmaphysdest2 = 0;
+ c. T; ~ B, Q - ' o$ S- \) v) y, Q \7 Z, N
- char *dmabufsrc1 = NULL;
3 M. x: _! D' t/ f) j5 [" z( } - char *dmabufsrc2 = NULL;6 V2 V6 F; A2 E+ H1 ?# Z6 R& j; z
- char *dmabufdest1 = NULL;6 b; f+ t+ n+ L" L5 F
- char *dmabufdest2 = NULL;/ }' J0 ^& G3 Z; M$ N9 J7 g
- m8 \6 d8 F) I1 }* B. {* H- |- static int acnt = 512;. L. e- u# o% ^4 k( v# v9 {$ x- I% C
- static int bcnt = 8;
( A+ z Z% t" L9 h1 P1 Q5 | - static int ccnt = 8;/ q9 ~) H4 L; Q3 _2 v+ P1 U$ z5 L
- - k; _9 t' U" o4 S+ r+ W. l, F
- module_param(acnt, int, S_IRUGO);3 E3 h, p: T6 K. g
- module_param(bcnt, int, S_IRUGO);* i5 ^) b5 F+ X5 c" u! R( r
- module_param(ccnt, int, S_IRUGO);
复制代码
; l4 g+ v+ [/ N+ d
% |# ?& H% o4 H( c) e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 {5 W2 s. e0 D8 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ~; A8 s9 F8 B7 b) d" ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* M/ ` A8 l- I6 P1 N
. D) B7 a* d+ _
; s0 A, O3 a% f |
|