|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 K4 o+ ~3 N: S+ A* q0 g
- [code]EDMA sample test application) Y g; G/ g3 l8 n+ L; F/ Z4 X& x3 Q! N
- /*! j/ \& A7 g3 U8 k
- * edma_test.c4 R4 K6 n6 D- S8 @# I
- *1 z9 b% L4 N9 m+ N
- * brief EDMA3 Test Application+ K5 r' l5 {3 H' r( B3 V( m
- *
4 F: D" n6 O: E - * This file contains EDMA3 Test code.* q+ S0 \! x5 z. c! H# Q. `+ y
- *
: u ?" Z$ r5 A G6 l& @) A1 J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( s# h. {( g' E, d$ L! w6 b& e; l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 g* n: E9 O/ Q3 A
- * TO CHANGE.3 H( `! n' a. l0 E+ q: d
- *
3 f3 q) J' S( M. d7 Y( ]1 R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" r2 i- S: ?( m, E z4 e1 C - *
: p3 T( d! a; g* F+ _ - * This program is free software; you can redistribute it and/or$ z1 z0 C! S, _/ y7 Y8 ^
- * modify it under the terms of the GNU General Public License as3 z( w) h/ y* ~6 x. a6 N. j
- * published by the Free Software Foundation version 2.
5 s/ k" G3 G1 [6 } - *
: P4 h2 Q6 f' |7 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: C' l. i+ T2 T3 q - * kind, whether express or implied; without even the implied warranty+ Y7 u# {, |3 E, R- a3 Y( w! F; J/ x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 I& T, {8 A% Z }5 g9 b
- * GNU General Public License for more details.
$ C; k% Q+ b( x8 \. a - */% f4 |$ f* c: q6 e& I
- 7 s& L1 F' T Y( n& q$ T+ e
- #include <linux/module.h>4 Q- `+ g& a" q+ c0 x# M2 o! \
- #include <linux/init.h>* v! U3 G% }3 v K! P
- #include <linux/errno.h>! k3 A; o: ?8 N
- #include <linux/types.h>; N& H2 y$ O- l# D% h' [0 e) N
- #include <linux/interrupt.h>7 {$ I$ B- V2 ]( j$ f2 E5 J" `) U
- #include <asm/io.h>
) y7 a9 y B& W A/ C - #include <linux/moduleparam.h>' p) P2 d8 h t2 ]
- #include <linux/sysctl.h>3 l h1 F! R- |' u% {" R
- #include <linux/mm.h>
8 m, @# t& d/ e6 j7 ~! U/ s - #include <linux/dma-mapping.h>
9 U6 {2 A8 {& S v4 w8 E
$ K2 W9 B$ ~ m2 G* V1 S. Y0 d- #include <mach/memory.h>" k& y* P, W8 i4 t4 f% P: s
- #include <mach/hardware.h>
4 I3 F( f3 o6 D8 {$ u! v# L - #include <mach/irqs.h>( h0 y. `# P" [' J4 H# U! Y* _
- #include <asm/hardware/edma.h>: \! T) e! S ^# l; H( v" O) q1 M
3 O+ M$ d$ K: H% S- #undef EDMA3_DEBUG d+ J! K7 B4 ?9 \" t
- /*#define EDMA3_DEBUG*/
4 h5 f( T7 x6 z - ' Q7 H" T) x1 V
- #ifdef EDMA3_DEBUG
2 y0 a6 I& ^) c; H% ^. G" F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 o! F3 D* |6 H! a z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; s8 |1 e, O1 t: ?# [+ M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- f& q6 z! l3 K5 a4 ?0 f5 G. v
- #else5 R5 U" W+ [" {& p/ B
- #define DMA_PRINTK( x... )% B( R/ |/ o3 ~* A( i; R: T" Z! n" k
- #define DMA_FN_IN
/ u5 |! D5 P) p- ?$ m3 r - #define DMA_FN_OUT) Y, p3 |. m- R
- #endif
/ B. ~7 Z9 J$ \, p3 b |
* M4 P2 O; @9 ^! |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 U7 D! u2 u2 [ - #define STATIC_SHIFT 3# M" F( i3 |0 U9 f' |/ T" X& ^
- #define TCINTEN_SHIFT 20' M4 V/ Y8 {3 L+ c! }" X
- #define ITCINTEN_SHIFT 21
3 q$ q3 J& ~: J8 R+ ~( G& I - #define TCCHEN_SHIFT 22
, o6 l! O1 f9 Q; Q - #define ITCCHEN_SHIFT 23& N; m; A. H% x! y m( d
' d/ e% @6 b0 U& T/ _- P+ S- static volatile int irqraised1 = 0;
( D/ ]& a. f* P - static volatile int irqraised2 = 0;
/ g3 }% P4 @' J: `- { - 5 G; ?% t3 h! o* V. O2 M' y5 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! d( u; M. \# }1 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* z" }8 v( e# c" \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 n, M6 H& [2 |+ C1 X" {7 |
- # v) }) z2 D7 X& C# l9 H
- dma_addr_t dmaphyssrc1 = 0;
( {. b3 V$ w9 I, K* u* Y - dma_addr_t dmaphyssrc2 = 0;4 p T1 {" B- z/ @; s
- dma_addr_t dmaphysdest1 = 0; x5 o% [) n( V% ]3 }
- dma_addr_t dmaphysdest2 = 0;- u, V- }+ V' T! H/ ]& U
- ; p/ }# U+ T( R- D0 t1 g9 O" {' Y
- char *dmabufsrc1 = NULL;# R! \) e- C. ]( H+ `+ m, Y
- char *dmabufsrc2 = NULL;/ c8 w: @' V# D R: M, B
- char *dmabufdest1 = NULL;
) t* a8 Y4 a# M/ B+ e - char *dmabufdest2 = NULL;1 o9 O0 z& n- O* v, q
- ! Z0 z, L: l) p3 ~& p
- static int acnt = 512;9 T3 x- `4 _2 h" j# i# N
- static int bcnt = 8;
/ y3 \7 e4 U. G0 J5 ]/ Y+ T - static int ccnt = 8;$ q: U7 c [; Y( K/ b. E/ d
/ U( ^! B' F7 m; _0 `8 m1 W1 j" d- module_param(acnt, int, S_IRUGO);
' _" _- ?5 T/ p6 a+ V8 O5 X1 d, m9 l - module_param(bcnt, int, S_IRUGO);) _0 K! o/ l% B' @. H4 M
- module_param(ccnt, int, S_IRUGO);
复制代码
/ F- O/ ]0 v+ X) b7 G. j# ?$ Z9 a4 z, }$ y4 S" F* Q8 @" g! ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 g b/ ~% f9 E# y1 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: W* s7 _* x) C( b: B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ G4 Q4 g) P) V; y3 L. G. A1 P/ T7 V! c7 x9 K- X
$ A" W1 S9 b9 k7 K! ^# n |
|