|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( q% h b' g9 S) m! t6 l
- [code]EDMA sample test application
9 f% D/ W2 E# z9 s% R - /*
5 {8 j; M. d. x, Y - * edma_test.c6 a# D7 H6 f7 b% k2 u- I
- *+ s4 ]5 i' T: D2 \( E* ]6 U ?
- * brief EDMA3 Test Application
" ^/ d- P/ G9 u- Y - *
k& o2 ]! T# D1 r - * This file contains EDMA3 Test code.
$ b7 U) Y5 o5 F, l+ P! \ - *
# Q9 Y G* F8 F8 k! w q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 S, N( W9 d7 o) n8 S) K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
T0 ] `; g' {( a - * TO CHANGE.9 b: h% _: l* e' o7 ?
- *
5 g; T# M/ J4 I" u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ j6 w5 s; o; r/ h$ h
- *5 N# L+ S$ c |
- * This program is free software; you can redistribute it and/or
& V0 l9 z, B3 S3 o' | - * modify it under the terms of the GNU General Public License as
. T) K6 s+ Z& J - * published by the Free Software Foundation version 2.0 J2 b- a8 m" x
- ** z/ {. e( Y% n2 C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 [2 l5 A [& |4 t# m0 p v
- * kind, whether express or implied; without even the implied warranty
% j" `. }0 G2 p* H* m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) k" |% W/ Z0 u9 Q$ r0 {/ M3 j - * GNU General Public License for more details. j, _( Z; N% E1 r/ t
- */
9 T2 g( n9 F3 a: W t& [ - : O& ~/ `& _, q6 a
- #include <linux/module.h>' r* x( {% d/ w4 ]) F
- #include <linux/init.h>$ a1 j/ i+ |7 n1 l0 m3 D
- #include <linux/errno.h>
& a& ?4 L! r4 M9 W# O - #include <linux/types.h>
2 b8 g( `% R6 s+ ^ - #include <linux/interrupt.h>
) ^3 l$ h5 G" ] - #include <asm/io.h>
! D4 f* l3 S8 R" f( F* m - #include <linux/moduleparam.h>
+ ]4 r& B( f4 | - #include <linux/sysctl.h>, H0 n& q J: B8 {
- #include <linux/mm.h>+ i- L3 i9 F1 a: R+ z/ W/ n
- #include <linux/dma-mapping.h>9 V8 A& L: ?# H d ?" g' a- j
. @% S r' h2 X+ C# q: f- #include <mach/memory.h>
/ G1 w( P9 d( z1 L4 g3 r - #include <mach/hardware.h>. [& V7 ]# k* c, h# {+ q
- #include <mach/irqs.h>
}' l/ ^$ u3 l( |5 m! g1 P - #include <asm/hardware/edma.h>, t3 j2 O+ I: b, @( V& [: }
8 `" x, |8 W# n* l- #undef EDMA3_DEBUG
! [8 K2 M) m# { - /*#define EDMA3_DEBUG*/
' v! I& I! P$ {" a3 z; o - ; B- b/ C4 _5 @6 k' y, Z" o
- #ifdef EDMA3_DEBUG3 [* [) S& c$ k+ F: c/ E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
l8 \ o4 q W* e$ \9 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& E8 [8 i$ a& ~8 ^- ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) f( G% U" S2 |* z4 I3 F - #else9 e2 e" G, d9 Y3 W) l
- #define DMA_PRINTK( x... )
4 K# V- |, z" s: h' R - #define DMA_FN_IN
) m$ P9 F' `$ ~0 i- O* C' {3 Z - #define DMA_FN_OUT
+ F& J4 U) l5 |6 U( l - #endif
+ @( v1 e% T4 n" U! n - : s$ M f; X( t! M8 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ A Z; V# `+ ?' ?( T C6 N
- #define STATIC_SHIFT 3
& E. s7 T: Y* a* l2 A0 x - #define TCINTEN_SHIFT 20% A0 _! r( ]$ S' l" |
- #define ITCINTEN_SHIFT 21/ E1 i" I; T& F& e7 `, x
- #define TCCHEN_SHIFT 22) N5 S: `: c( Q+ v2 f
- #define ITCCHEN_SHIFT 23 U* Y$ Y' j% p g3 I
- # y% u5 g8 X6 x" ]; D
- static volatile int irqraised1 = 0;: v, Q5 _/ h% y
- static volatile int irqraised2 = 0;' m2 K# }/ D; `1 n6 x9 I
, c. U4 }* a9 G6 ], y. I3 n2 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i7 m# \2 g! T! f; ^3 f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. |0 g3 S9 [. p! y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; i+ `4 L" \% z2 P6 j( z5 ]+ S
$ h& P9 x* L4 a3 i- dma_addr_t dmaphyssrc1 = 0;" A1 E; V T/ Y3 A
- dma_addr_t dmaphyssrc2 = 0;; c+ I. h0 _9 M: L7 w: ~/ E3 b4 Y
- dma_addr_t dmaphysdest1 = 0;
* ]( {0 e5 T" q$ m: E - dma_addr_t dmaphysdest2 = 0;( Q# q. P8 l! f
6 P9 l f; J* C+ |, y" \. k' T2 Y- char *dmabufsrc1 = NULL; i9 d2 `. V, h) Z
- char *dmabufsrc2 = NULL;% A ^7 \7 b- ~/ [% Y' q# b9 ~. j6 l
- char *dmabufdest1 = NULL;
( O: b, A; l& F J4 q* G - char *dmabufdest2 = NULL;
5 ?" t5 o% ?* O) a3 h
+ q( p" x- o' n0 T- static int acnt = 512;
+ Q' `" v- Q7 l8 Z* h5 j - static int bcnt = 8;
& n; B# L7 Z( w. J! {2 c, \ - static int ccnt = 8;
" r b6 k5 ]% W; t% n! o/ v7 k - 5 S$ v# L/ [! Z: h! m& ~
- module_param(acnt, int, S_IRUGO);6 a3 o2 C, g4 s7 l- `
- module_param(bcnt, int, S_IRUGO);
9 ?/ e# x, Y/ I* S - module_param(ccnt, int, S_IRUGO);
复制代码 " w: p/ r8 J+ r" s- ~* i; j; \
5 G7 R" ?1 {% E- P7 N. n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ~% j, D0 s- L! u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ H1 d' V5 ]1 M5 x1 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" n6 \" g# G0 ?, {5 l
7 w0 N, f2 Z% o0 \% a Z5 h- O k- X( }9 Q- c0 f
|
|