|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 t0 C; z6 ~1 }. W" D6 e1 K
- [code]EDMA sample test application% H' b/ I+ j6 E8 F2 U+ |& K
- /*
3 E, N! i3 v7 J$ H( a N - * edma_test.c, Q" [7 T1 e. V
- *
$ y( `" m4 a5 J6 Y$ n6 o - * brief EDMA3 Test Application H5 c% b* g6 w9 k5 L; L
- *
+ S. W6 a1 b% V6 n( x - * This file contains EDMA3 Test code.8 T+ t. j1 u" A0 U+ P' }
- *9 k. |9 J$ ~5 Q( h! H g4 s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 d( R s- e6 i; r% U- `4 x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 i* a* ~7 z2 N& H1 _" K
- * TO CHANGE.3 ?2 [& O; d) J' v) |
- *+ r! A u8 z% y4 O( h& e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- E5 j/ U6 @& O6 l; @$ j$ ^. g# ` - *
4 x% z) X, W! Q; J! S - * This program is free software; you can redistribute it and/or
0 V! t8 Q& l+ X - * modify it under the terms of the GNU General Public License as2 J. j% g9 L/ O" M# R% {4 }9 t
- * published by the Free Software Foundation version 2.
/ b3 f3 s9 B H - * U, d4 Z1 e3 a3 `( u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 T4 x+ o' a0 d( d4 f
- * kind, whether express or implied; without even the implied warranty
, k- S! i* E9 s1 {) o) t# ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* n/ ]1 I0 u# ^- M* ?) Y - * GNU General Public License for more details.
- ^6 L: ~; k) n( U0 J5 r - */; O% a3 h- Q$ D- n* p5 k* I9 F
9 p1 O2 Y' w; t- M1 x' Z6 k' R- #include <linux/module.h>* D# l& f; W1 l7 u& z9 O
- #include <linux/init.h>
, v2 }- c. ~$ J6 D - #include <linux/errno.h>
6 t0 A! |' L3 t9 m$ ^5 X4 O" n - #include <linux/types.h>" Q& _ ]' b3 s m1 [9 B* O$ e
- #include <linux/interrupt.h>
0 V5 L' z' X5 S7 C3 C - #include <asm/io.h># T# z& l, T5 h2 k& P
- #include <linux/moduleparam.h>
& G# L# x4 y* }4 v1 [6 C - #include <linux/sysctl.h>
. u. m" j/ D- B- Y - #include <linux/mm.h>, S- p) ?2 ]9 S4 _" T B
- #include <linux/dma-mapping.h>
# W7 l- l4 ~5 S: V - + ?( ]2 L; n1 X
- #include <mach/memory.h>
7 p3 }4 y! f) b: N3 d& ? - #include <mach/hardware.h>( M& D3 f2 L/ @5 L. ~
- #include <mach/irqs.h>: e8 o0 `* V6 O, v
- #include <asm/hardware/edma.h>
; e% ~( Z/ i6 L, ]$ }/ ]; Q/ S) z - 3 N+ O& O% a$ c" h( d) E& |4 o8 S
- #undef EDMA3_DEBUG* \1 g3 F8 f$ Q9 h5 v
- /*#define EDMA3_DEBUG*/
! |3 O ]$ F s" l; {$ x% ]
9 \5 j. v/ U4 A- b8 n# N! y' E4 e8 {- #ifdef EDMA3_DEBUG" ^# R1 c* ~; M8 r$ R" q! I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 e& }. [6 \4 O) T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! m$ I% e* K2 g4 |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 N' F' e" z8 ~ - #else
6 k+ f! p- x! M0 q/ Z* w: ~9 a6 X - #define DMA_PRINTK( x... )! q. B- I" S' f4 |, P3 [: b' D
- #define DMA_FN_IN
5 j3 M u ] V) X8 \/ X' j - #define DMA_FN_OUT
; J) k7 e( e8 J - #endif$ ]7 ~# |: L* D& S \' i- o
1 z f, Z0 C; e" Y0 P) x, E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 e# j2 _7 A. B( X! v" g! C
- #define STATIC_SHIFT 3
" p3 _& Q0 r$ B, V, P - #define TCINTEN_SHIFT 20
6 u' ?# B0 y2 r( V - #define ITCINTEN_SHIFT 21
; _6 I! a7 S, K. o$ ` - #define TCCHEN_SHIFT 22
& B* i6 G- i: |8 v, J - #define ITCCHEN_SHIFT 23/ T, M9 }2 Y* e4 U; J
: \: }0 G# O) d9 c- static volatile int irqraised1 = 0;
/ A1 `, n, o; o* T4 X- d. W0 a - static volatile int irqraised2 = 0;9 U+ Y m- W* H# I
- , f! `) C! `5 Z; t7 }* p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i2 M9 l& x/ u7 h4 [% B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) _6 L3 D F) |0 D. z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& K$ I/ U/ C, D" R& i' T( V4 c/ c - q1 l) r3 K! b0 p
- dma_addr_t dmaphyssrc1 = 0;
) W( Q! Z5 r3 f' [; {6 I - dma_addr_t dmaphyssrc2 = 0;
7 _2 z- d8 `( S# I - dma_addr_t dmaphysdest1 = 0;
* U) c: M' c: ~: h4 H - dma_addr_t dmaphysdest2 = 0;
+ [* f7 T; n( U' C9 F1 U( t
: j% k) f$ x c- F2 a( A- char *dmabufsrc1 = NULL;
0 h8 u j7 i# Z - char *dmabufsrc2 = NULL;2 b3 A! ~; L1 O+ I
- char *dmabufdest1 = NULL;
6 {5 G, }0 u5 Z- c/ B - char *dmabufdest2 = NULL;
6 H5 n ~0 W9 m* b- H: Q - 6 {1 q* t, Q8 g- p0 C! C
- static int acnt = 512;
" N. j+ _) X8 j( m1 a9 P+ @0 K% c - static int bcnt = 8;3 @: Y: i2 ]1 o z
- static int ccnt = 8;
1 X% A. q$ s. V7 r, x - ( I' ~4 ]; f, g8 T1 ^7 U. ]+ s9 B. j' a
- module_param(acnt, int, S_IRUGO);
* |2 |; t4 [" F0 I - module_param(bcnt, int, S_IRUGO);5 R9 j- D2 W1 E# ^% w% ^& V
- module_param(ccnt, int, S_IRUGO);
复制代码
+ K* f+ ]4 D# S* j1 C7 @- q' q2 k) e1 U* e2 [, c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 n6 g* W4 b8 C! q! O: h$ Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* p7 d9 Q" I9 c; y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- c, I2 ` ]! h* N! b; c
Y1 m5 c5 @+ ]1 \ M" S+ \6 ]1 D( m
* W# U' L9 ~! x6 ?& J% V! n |
|