|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 @8 k, n7 b4 n' T: Q" w- [code]EDMA sample test application: G3 |+ c w& y0 [- K1 Q% [# O
- /*
2 @$ R( D6 Z0 Y9 a& ]1 E- @ - * edma_test.c
8 e2 t, }' T/ d& V9 |' [8 i - *
1 m$ H; e$ w( y2 ?) I' ^2 C - * brief EDMA3 Test Application( i! ~4 i7 l3 s) O+ m9 N7 b
- *
+ U a7 g" t0 y* K8 n0 q8 V - * This file contains EDMA3 Test code.
: A& k8 j* _& j, g K$ W" W - *
1 q) S9 n0 k4 a# E" m A; J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 H7 M( B2 k) U9 g7 v8 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 X( \8 k4 }: F. N0 j: H3 J. L/ Y& ^ - * TO CHANGE.8 i4 Q; j- L! P& F
- *9 l% p0 p" a5 w5 d5 H; i( z0 Z% }, h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) x7 Y( e' Y) M9 R1 ^- {
- *
3 D1 o1 y X" w# X% A8 b% P - * This program is free software; you can redistribute it and/or5 x: g3 ~3 M8 `3 b: ^
- * modify it under the terms of the GNU General Public License as
. \2 F7 o n# Q4 y9 u% | S - * published by the Free Software Foundation version 2.
! x: Z/ R. W: y4 A- F, ~6 M5 [9 r+ b - */ p6 B6 V$ E( j+ z! M2 w! i+ |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 Q+ {- {+ ^& B% i6 t; j - * kind, whether express or implied; without even the implied warranty
5 N7 b; [: {6 a/ e- J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& a* Q$ v! x& }- \6 T) w
- * GNU General Public License for more details.! p! R* N1 f/ f* x# S1 }7 n- ]6 Q' d
- */# V+ z1 w( W4 l; s R
- 9 @1 G S. `$ ~1 G
- #include <linux/module.h>
/ c# C- w) [ d: @7 Y - #include <linux/init.h>. F3 l! L' C l- w
- #include <linux/errno.h>
8 v, E" [% u7 y2 t& z - #include <linux/types.h>
3 c; s0 _& f6 u8 B8 b' w0 q - #include <linux/interrupt.h>
+ C2 @5 a- ?/ k# h6 o5 V - #include <asm/io.h>
3 l4 L! q; L2 t$ C7 M) F( G - #include <linux/moduleparam.h>
, `, }5 \* q |$ w - #include <linux/sysctl.h>3 U6 o% f7 d) k; h9 D9 U
- #include <linux/mm.h>
0 h; ^. P! T7 E5 { - #include <linux/dma-mapping.h>. U6 S$ s0 F- _/ R" b
+ r p# e6 t5 @- #include <mach/memory.h>7 \! Q8 `/ l; S
- #include <mach/hardware.h>" ]3 G$ [# M. [5 {5 \, o0 n) h
- #include <mach/irqs.h>
, z2 K1 c3 H: d - #include <asm/hardware/edma.h>
7 \4 _5 G8 d- t4 s# T5 `6 }3 K
! C* B% h4 ~$ E6 G; O3 P- #undef EDMA3_DEBUG, r; U' U( y) h# G8 Z. x1 G, _/ }
- /*#define EDMA3_DEBUG*/" e6 D, b0 e# i! ]* ]3 m/ d- [
6 C# U; L. e# N |% u- #ifdef EDMA3_DEBUG# s( S( P4 ?; S/ e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ c1 i2 n: M" ]8 `1 I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& V7 ~7 i* \; \& j7 J: W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ o; K: r6 n' E" o+ l6 {9 S8 e - #else8 H M1 W- n0 O
- #define DMA_PRINTK( x... )
' @. N7 }9 X7 T! b/ v& S - #define DMA_FN_IN* O% \5 a/ s- M0 a
- #define DMA_FN_OUT
! s& ?% b% e8 t# p - #endif& ~2 x+ f2 r; `: M8 P
9 t3 W( O; c: p; V/ M* b- #define MAX_DMA_TRANSFER_IN_BYTES (32768): j1 h5 J- P& J0 F
- #define STATIC_SHIFT 3
: g" o# A5 \1 [ - #define TCINTEN_SHIFT 20
% J0 V+ r5 q: `% }& [ - #define ITCINTEN_SHIFT 21
& Z* ]+ M$ c+ [# C; L4 x% s4 L - #define TCCHEN_SHIFT 228 p5 w* F0 l4 T+ B
- #define ITCCHEN_SHIFT 23
% E- J; M, Q5 b+ k l' J
0 @& K0 k% ?& X9 L5 `8 h- static volatile int irqraised1 = 0;
- \3 W! T) j/ W' V: I - static volatile int irqraised2 = 0;
* h" h, ^. |3 E) A
- A* B" i6 o" q0 |0 p7 u( C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~4 J3 V- V# m' m9 N. b5 z! v! y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( k% ~3 A9 Z- `# w2 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" `* V( p/ f' v$ b - ' q2 t- Y* u& s9 M
- dma_addr_t dmaphyssrc1 = 0;. a5 Q4 D, U E) Q( F
- dma_addr_t dmaphyssrc2 = 0;* r9 H4 P8 t2 S7 J; n* ?% d; _/ m
- dma_addr_t dmaphysdest1 = 0;
& H. t8 Q7 }! l+ o- M! h+ O2 j - dma_addr_t dmaphysdest2 = 0;* o1 }/ n O. X& T9 H
- + _, E& L# Q* o8 A* ^/ Y) r
- char *dmabufsrc1 = NULL;
: f( x# F$ h/ | - char *dmabufsrc2 = NULL;
1 A. D1 T$ x& p8 s0 B1 n+ [ - char *dmabufdest1 = NULL;
! g3 b# O2 S/ B% |' G A - char *dmabufdest2 = NULL;
) k' b" g8 x. t8 J! M0 N* M/ A
9 W( M$ T' ~& ]9 ]: }; Q- static int acnt = 512;* k; x* @# b7 V+ q( V# z- N
- static int bcnt = 8;
# R( a" o& ^0 Q6 \9 R2 m - static int ccnt = 8;
. T* t5 b1 P/ d5 ~
5 h3 Q* [' j* i- module_param(acnt, int, S_IRUGO);
( }# k' y1 W3 R0 e& O. z& a - module_param(bcnt, int, S_IRUGO);
- X; H/ I( l/ w - module_param(ccnt, int, S_IRUGO);
复制代码 5 W4 d9 w' }5 t
5 ]+ ?7 v4 W0 ~. ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. C3 B: y2 N8 h. M C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& D5 r7 s" L+ C* h$ A$ i& u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
]5 {2 X2 S0 Z8 u, E, M6 i4 L% t3 k( _$ o& \9 ?# ~* q
' m$ B$ r3 W( T& x6 ^7 q6 @7 a |
|