|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 D0 f7 s9 q( I! m. @; v
- [code]EDMA sample test application$ E4 X% O, F) V0 M$ @
- /*9 d5 f! b6 |: N3 ~( B/ f
- * edma_test.c- P4 W0 }0 |! r; s( ~: S
- *2 U4 B7 {" e& H( b6 i
- * brief EDMA3 Test Application
+ s k* c# ~5 T - *# w( i" ?! z' U; g8 i4 U
- * This file contains EDMA3 Test code.
0 y+ L$ u5 t3 h1 j8 H3 K) N' U3 L - *
- X7 s: a) y! Y T0 m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) f# [+ ]0 T6 \, c; L( D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% u: K8 }! u1 ?: r# V w- p1 b( C. u - * TO CHANGE.4 H D1 l a6 {. l. y& f
- *2 p) N8 w, s& d- Z! c. ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ g5 V( X$ {5 h4 b
- *
; T/ O) r6 o/ [% f# N8 L - * This program is free software; you can redistribute it and/or2 c0 `9 k( N- T
- * modify it under the terms of the GNU General Public License as" W) C) W0 O& J# c
- * published by the Free Software Foundation version 2.
, {0 [8 V' B( {0 H. R# @ - *4 t# U) x) [( {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 E5 L; T, A1 X4 p3 Z" M% | - * kind, whether express or implied; without even the implied warranty, J7 m" z& J f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 m1 F I$ \0 H7 N) r - * GNU General Public License for more details.' f$ K- H: o: d; D& b& l
- */
2 y% i2 |2 |3 u& W, K0 f - 2 V8 W d, X5 n2 f: Z% g
- #include <linux/module.h>6 C2 r# C4 |2 x7 }- R
- #include <linux/init.h>
! B2 |+ i: ?4 t4 u( i" e - #include <linux/errno.h>
) I) @/ c6 R0 a- I" k - #include <linux/types.h>1 M! k8 C9 a: y% e2 B. F8 ^
- #include <linux/interrupt.h>3 p( w- ~ t) F3 g6 g- z
- #include <asm/io.h>
5 R: q9 Q: B$ g- w6 S( C" d - #include <linux/moduleparam.h> j" F' v, m s' R n
- #include <linux/sysctl.h>
" G5 n2 N7 u3 t! [" D" W - #include <linux/mm.h>7 N/ E# v* n, g: b
- #include <linux/dma-mapping.h>
! D7 A. k) e4 e" I) Q. U, { - " J- U0 `. b; }0 \4 O; p; S4 w& {
- #include <mach/memory.h>
( v7 B- Y" m2 p4 C6 F3 X2 `8 D - #include <mach/hardware.h>. e5 ^4 u1 l8 C) C
- #include <mach/irqs.h>" i1 Y8 l/ J! k' u
- #include <asm/hardware/edma.h>
^3 \* A6 o w- J( x" p1 S
6 A' r; a ^) I1 F$ k- #undef EDMA3_DEBUG
7 X6 E6 ^, P* d* e2 F# T - /*#define EDMA3_DEBUG*/
) V) C' _1 r1 U- w& r( u/ J# ~
( \8 `. O7 j9 J; S S, D3 n" _- C- #ifdef EDMA3_DEBUG
9 }7 i7 |* M9 Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 I2 u( U. o2 x3 i" q( { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& Q' {4 u( ]0 d8 H# G- Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. W# v# K7 D B! I - #else! }! Q6 o9 K8 s! Y! O2 D
- #define DMA_PRINTK( x... )
, A* z# r1 I5 }. J8 m- ]2 o! J2 N - #define DMA_FN_IN
f; W! J, G; O6 h6 \ - #define DMA_FN_OUT
* \6 W2 M- Q" V# C+ G, p% _9 w5 u/ M - #endif
' |! T& H* V: \5 E5 c: S/ O( R - ( T) y, s0 F5 S- b" N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 F- W, u# C l. R! y6 ]
- #define STATIC_SHIFT 3! t! j) b y# K) w" j8 ^: R
- #define TCINTEN_SHIFT 20
3 e. n$ J& @3 }2 D: F5 M - #define ITCINTEN_SHIFT 21
) b, Q4 z9 a* j+ _3 B% Q - #define TCCHEN_SHIFT 22
- `+ F- |7 f4 L% C$ m0 k - #define ITCCHEN_SHIFT 23
% t% P. u8 f6 C% x0 ` H" t" N- b - 3 N5 \( ~* U' c6 p1 ?
- static volatile int irqraised1 = 0;- C3 Y: i: a1 x* W/ U7 F: T
- static volatile int irqraised2 = 0;6 L5 s9 f0 ?! U
' {2 g" |) _+ ~; }) |1 K7 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 z6 k" h1 s' T" y; M( N! @, W0 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, O O. A3 o2 G, G) ]7 t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( { J4 A1 I9 i, @+ b
- & K3 c8 c8 X7 W- u& p' l
- dma_addr_t dmaphyssrc1 = 0;
$ @( }0 u" W' _ - dma_addr_t dmaphyssrc2 = 0;( \' I8 B9 I+ |( c6 M( o% \
- dma_addr_t dmaphysdest1 = 0;
0 v' O* ^2 ^& D+ E: c& i6 I - dma_addr_t dmaphysdest2 = 0;
. i4 K* q7 p0 h$ K7 ^4 H
, S5 R0 U( a5 D2 w$ X- char *dmabufsrc1 = NULL;
% d& P, q. h+ B9 r; G% G$ L - char *dmabufsrc2 = NULL;
, L6 \# x# V c, f4 O: ` - char *dmabufdest1 = NULL;
0 t$ x' ]' w, o1 v - char *dmabufdest2 = NULL;' H8 t0 \/ e0 L# Y: x
- / G; @4 }! }! \& U5 e' q C3 j
- static int acnt = 512;2 l! u, p# z8 h o
- static int bcnt = 8;; k1 y0 o' |2 @4 b" ^3 c z0 H
- static int ccnt = 8;
" n4 A h* n! r) W3 v( G
, A) U/ q! k$ U- module_param(acnt, int, S_IRUGO);
" Z' r: ~* d/ O. l+ X - module_param(bcnt, int, S_IRUGO);. A; P9 p, z+ Y$ \4 G
- module_param(ccnt, int, S_IRUGO);
复制代码
8 i: z9 x2 J0 M/ [6 f( q+ M# t |6 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 g4 }( j" S/ M+ iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. F8 |+ O$ k& S7 D# C, |9 G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 T4 ^# A- \* U9 j% ]" f% h5 P
, ]0 X8 ^# V( y$ d# ^* [- j* M4 `) u2 m ]
|
|