|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 c0 Z( J4 U! ]; K4 ?" ]- V
- [code]EDMA sample test application* A; j0 P( h5 i2 O. n. w2 z/ P d0 {
- /*
3 X: V2 O1 D, g9 O/ [ - * edma_test.c
7 i! P p2 S/ i6 s0 ~/ e - *; H8 F( B$ a/ M6 b1 {
- * brief EDMA3 Test Application4 D* T/ }0 s9 n" N9 v
- *+ d- c B3 @2 v. _( ^- h+ r2 ]
- * This file contains EDMA3 Test code.0 |9 H/ t5 q; s" }& w; [
- *: C/ c1 a3 p% }; C. z0 V5 c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: M% I6 @' s3 V& n+ a1 S) k6 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 T4 P% n' ?5 ^ a0 z8 U/ x - * TO CHANGE.
) c! A" C; r4 N8 { - *6 J1 e4 O5 r% W5 c' Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* T3 J- G: i K: Y9 A3 f- ^7 S
- *
+ Y5 o# w8 e! [* c# F2 O6 P - * This program is free software; you can redistribute it and/or& ^ ?: H- @' A- p
- * modify it under the terms of the GNU General Public License as4 k$ F3 [( X8 [# e4 [
- * published by the Free Software Foundation version 2.- o/ k: D( o' T/ K1 S
- ** t1 G" _; B0 {; g6 b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 d* k! _( U4 i/ b5 K - * kind, whether express or implied; without even the implied warranty
4 D- N9 P6 i' M1 q, }8 o, j9 s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) {/ F) K$ }# q7 N/ O* }! \
- * GNU General Public License for more details.
% M5 t7 A1 X% {+ n, Z; M - */
6 y3 l+ A6 r+ d6 C - : W1 a" d3 m- k+ y8 l' g( J7 g
- #include <linux/module.h>
- J L0 ~0 a( `/ c' P( g - #include <linux/init.h>3 [" ~& N$ O! b, m# c) T
- #include <linux/errno.h>0 ~6 y" {1 x; q G" h7 U8 ^( q* L8 P
- #include <linux/types.h>* ~* V0 N. |8 F) F( k5 j
- #include <linux/interrupt.h>
u* W; _: H q/ i - #include <asm/io.h>2 L+ a/ B/ g1 l; U9 F
- #include <linux/moduleparam.h>4 u4 g# g- o: ^5 K- `
- #include <linux/sysctl.h>8 [+ ]- f2 S' [( D! t! o! E3 u
- #include <linux/mm.h>
! @7 l' H& c9 u; O J( J7 k0 M# N - #include <linux/dma-mapping.h>: P! i" ^, p$ F! y
3 p5 A4 G/ m6 ] j+ j1 s1 z- #include <mach/memory.h>
/ W; Y7 q3 a# M$ o. `; _: E - #include <mach/hardware.h>
; W( l, h' \- Q, K2 H: E - #include <mach/irqs.h>
8 T& x3 C" \4 Q7 D, m% n - #include <asm/hardware/edma.h>- I, a( S/ {9 W
' A( {5 f w- p! { N8 W- #undef EDMA3_DEBUG
. Y1 E) x( l7 o! }+ V - /*#define EDMA3_DEBUG*/
/ F7 u: G; `+ H2 h# f
( B. V/ ~* w- i. G3 n- #ifdef EDMA3_DEBUG
0 d8 I( T# h- o* P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( T2 L9 C$ i! \/ a/ m- [% S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' `# g2 p% S: e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, J( R; j( l Y7 _3 J2 u7 R - #else' u4 B1 X4 @5 L3 I
- #define DMA_PRINTK( x... )* L# V% w6 j8 S
- #define DMA_FN_IN
$ u4 I X/ _/ q# g9 Z - #define DMA_FN_OUT
( `$ g- Y+ f" M+ y" S - #endif5 m# [) Q; m$ C3 Q
- . U, C& `0 |+ _. S! U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 [# x2 R8 X3 |7 Z2 r8 t
- #define STATIC_SHIFT 3. }; m# y. D$ \# ^2 ?
- #define TCINTEN_SHIFT 203 D: P- I. W# o5 y/ x
- #define ITCINTEN_SHIFT 21
! e2 G0 K& Y- \ ?9 t5 H# F - #define TCCHEN_SHIFT 22" Z6 @$ C5 N4 v- i
- #define ITCCHEN_SHIFT 239 j9 I5 B* i ]$ W/ ]$ h
- ) F3 B$ ?. \" Z6 U( L
- static volatile int irqraised1 = 0;
* a/ c8 S7 ~2 X- i9 \' q - static volatile int irqraised2 = 0;# ]. H" B; \) F% C7 Q! S) m! Z u5 _
) Z- w' H4 a+ U( t, V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 h+ a% S2 R }' p) v) @; j* _" O+ u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- t! o) x4 h2 [ F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: b3 N F/ d p+ T
% R3 e5 E' R) n; x9 x, o- dma_addr_t dmaphyssrc1 = 0;9 }. d' U" b- g
- dma_addr_t dmaphyssrc2 = 0;* j& ]# A$ j- F' V3 P/ _+ m
- dma_addr_t dmaphysdest1 = 0;9 m9 X" }8 T- ^. X5 c4 d7 L9 l
- dma_addr_t dmaphysdest2 = 0;
: e8 ~. d' K. k) b$ K, T* r! h
9 H5 a/ Z' t& P8 w( L/ R/ e- char *dmabufsrc1 = NULL;7 Z' e. v3 Z1 n* ]0 a4 f3 J
- char *dmabufsrc2 = NULL;$ ~9 f) M: u# D+ D- P5 X% j
- char *dmabufdest1 = NULL;
& {" |9 M4 _/ P) Q7 S - char *dmabufdest2 = NULL;, F( X' q- J- j1 e( D5 x
- 5 b B. `% o9 `/ N, ]) d! W+ F d2 z
- static int acnt = 512;1 r% i/ X4 G; e$ @) r' r; \3 W
- static int bcnt = 8;
" ^% X. T8 j, M; T7 a. w( c - static int ccnt = 8;
/ Z+ D: a. r5 w+ C* \$ ] - + G# p# F& S2 V5 a; Q
- module_param(acnt, int, S_IRUGO);" D( [* F; U/ y
- module_param(bcnt, int, S_IRUGO);5 J( ^' t5 I, R& H7 V
- module_param(ccnt, int, S_IRUGO);
复制代码
o: U6 ]* |) i" Z8 O' r5 l1 ^
- b. `7 q. W- d) I$ ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 D* v8 B; Q9 H9 A8 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) F: b6 |- F/ F& k/ m6 J! ^) K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- _" T* f5 O- m& q5 \1 t3 z) c8 l2 s. {+ x
2 s: Y K# x; g, Y- O* D |
|