|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! J: d* Z9 o8 j$ K) L" [9 ^! D- [code]EDMA sample test application
6 ?/ f: n# L, x/ p6 ~ - /*: u" ?' i% y0 g) e$ \
- * edma_test.c1 T" ?* \4 ]: ~9 V4 j& h/ H9 ~
- *
; {8 ?; t: A3 ]/ w' H - * brief EDMA3 Test Application- P$ n$ p- Z1 Z3 ^! S/ P) i: E: Z
- *9 Q: s2 R) @& b- t9 X% Z
- * This file contains EDMA3 Test code.8 V1 i# Z" o( Z4 b9 {- `' V+ D% b d
- *
/ H8 I+ c0 v- I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ [% i- k: b# k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" ~2 r- o/ S( T( P3 d$ A: h - * TO CHANGE.
$ o+ d2 W3 ^& Y4 x: k# e - *
+ @7 A' @$ o2 q. P9 o- ?/ z" x z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// m% V* B- U' X5 ?6 n
- *0 k, d% U7 }/ H
- * This program is free software; you can redistribute it and/or
5 [ l! B+ |) Y4 b7 F - * modify it under the terms of the GNU General Public License as
3 ^ V: t# k5 E2 J - * published by the Free Software Foundation version 2.$ g3 a, @- `- N
- * M6 U% z! x# A5 i7 d) o; N3 e& G {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 g. f* M' M0 Y% V6 ~* a8 h
- * kind, whether express or implied; without even the implied warranty4 l$ k1 V5 s0 C: t6 N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; E# D& c0 @/ _. M3 `/ @6 C. K
- * GNU General Public License for more details.
( t+ q( S) ?, ~ n% O! [ - */
* v7 z& Y% q2 |4 q
a! q* n! F) p% B- z3 L0 H- #include <linux/module.h>
( P( \6 E7 j- R' p, R8 ~- e - #include <linux/init.h>
2 ?0 B( @( G, |+ @ - #include <linux/errno.h>+ J( V/ M* r" N& _: R+ U8 Q0 i4 G
- #include <linux/types.h>
! A7 _- Q* ?5 C, Z* `! q I - #include <linux/interrupt.h>7 C5 H0 k: M7 y R4 A" i* A* f
- #include <asm/io.h>8 N3 [4 o6 q' L9 r. g: t5 D/ k
- #include <linux/moduleparam.h>
; A5 D0 T. G3 a9 \4 {' D" M - #include <linux/sysctl.h>
2 W2 H9 ?8 |* _9 o - #include <linux/mm.h>
. e, C# N, H: i. `; @9 M% }8 i0 q - #include <linux/dma-mapping.h> Q) r# z) N- C* b- Y
$ g/ n M: b. X7 k+ x- l- #include <mach/memory.h>: O' d6 ]; @( ?% Q3 J* H
- #include <mach/hardware.h>6 f# r% K, m* \) @, E
- #include <mach/irqs.h>' S' h+ o0 f! ~
- #include <asm/hardware/edma.h>
5 y& V0 |7 J9 H3 J% _
# j7 A( t9 w. K- #undef EDMA3_DEBUG) O! T* ?5 Y# h; M% P, e* k
- /*#define EDMA3_DEBUG*/
5 o: J5 }) q, m( G+ o5 q
# Z2 W. r# y) D, ~! G& A Y* G- #ifdef EDMA3_DEBUG' M6 m- g ~5 V- `- l( A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 n, a: V) C( P" g( o" @7 ~9 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# j2 P3 V7 m: I: J5 I) ?4 ~7 i; ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' {- T+ w) D$ W- t8 @ G. I
- #else
1 R3 @. h# ~ @ - #define DMA_PRINTK( x... )
5 s7 s( P0 ?9 t' l: p; T5 p' L; P5 P - #define DMA_FN_IN- y6 W1 [. z+ B2 t
- #define DMA_FN_OUT4 ]8 m7 ^* N& Y0 A) h% b
- #endif
5 C- s; D& l% U7 p1 N( |9 [
- c& J& n" X3 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 @5 G, T8 l0 P; [' [
- #define STATIC_SHIFT 3. Z6 y" y2 o9 j9 X) z3 t* ?
- #define TCINTEN_SHIFT 20! |7 g- J9 z' [; m3 N
- #define ITCINTEN_SHIFT 21
! w X" {' @/ Z* w3 a - #define TCCHEN_SHIFT 22) v4 E; |9 H! Y3 ^# G
- #define ITCCHEN_SHIFT 23& c- V8 L2 g8 e
9 H) T/ G/ k5 `6 [: t& O- static volatile int irqraised1 = 0;6 |3 j, R' C7 D- E( @
- static volatile int irqraised2 = 0;
3 O# q1 O0 a* H7 H* I6 f" l - - h) {4 p2 W' K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% p( {3 f$ O6 i5 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, m0 z; C9 t' u* M6 f' \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ f# H3 u0 ^& b: q3 E
9 d! K0 l* S; t$ ~, h) x- dma_addr_t dmaphyssrc1 = 0;
% @& Z3 p0 h5 H - dma_addr_t dmaphyssrc2 = 0;/ D1 B0 b/ L$ j3 R, r
- dma_addr_t dmaphysdest1 = 0;
! [( p" C" ^' Y5 ?* d7 K h: f - dma_addr_t dmaphysdest2 = 0;. q; a0 s, \& j% U/ h" {
5 l% t- v6 C/ ~; Y; x* `- char *dmabufsrc1 = NULL;
! C1 S6 F( f; O5 y; P7 Q+ } - char *dmabufsrc2 = NULL;
2 M8 y* _7 u5 N! T. m D - char *dmabufdest1 = NULL;
7 ?, {& D4 Z" P8 r, n+ Z1 u+ a - char *dmabufdest2 = NULL;. Q: t: n/ x( b5 c' E: t Q! A3 o
+ q6 } Z. G6 B, }% s- static int acnt = 512;) O6 m; D- d% z, o2 g- }' Y% o
- static int bcnt = 8;' x5 f) h Q, i, F- M
- static int ccnt = 8;
7 C3 M& I% S# Q$ E. Z" y- E. o* { - 9 Z. j! G; {. z w c! I
- module_param(acnt, int, S_IRUGO);
7 s8 q! d# g" C5 B& H5 l1 R% p - module_param(bcnt, int, S_IRUGO);
1 q* O' V C! j/ a9 g8 ` - module_param(ccnt, int, S_IRUGO);
复制代码 9 O5 i, P# v# V1 y
1 C! `. C! G( L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 T% k5 h% |, tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" i p' W. Y' I/ B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 P# r9 ~9 Z; ?/ K# g" L+ `
+ D! `; w" _; ]0 c
& Q l' Z/ F9 ~& W) i/ ?1 @ |
|