|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 Y7 |9 C# D% {0 {# O8 j6 H! |+ ^
- [code]EDMA sample test application: \, I: Y6 U0 t- c) h; Q, V- _
- /*. h8 ^* C. o* P( y
- * edma_test.c" N3 S9 H, _7 C. F$ B1 M
- *
3 t9 F5 G7 ^) q. ]9 v - * brief EDMA3 Test Application
* Z3 q7 r- c5 r) W. v' z - *& \7 Q0 S; f1 Y" J& {6 K
- * This file contains EDMA3 Test code.7 {' W8 K7 c2 l, z \) ~2 d; {% K' s
- *
6 W9 j1 m; z( j* H6 } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. Y5 T! R- A$ B" p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 n) X" K, E. S% l: X- Q! B
- * TO CHANGE.0 r4 E- ~! d3 E* |
- *& ]( P8 `; C6 |9 A* M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: m' R9 |- K* B3 }4 |# c* ?2 b! H - *
! F1 k2 A$ d, Y7 G - * This program is free software; you can redistribute it and/or0 x2 \7 {& N1 Q& m
- * modify it under the terms of the GNU General Public License as
5 h. q; K! u1 }; J1 k - * published by the Free Software Foundation version 2.. R1 S+ }: X& G$ O
- *
5 E" s0 I- C! _& x& B4 ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# h# l# t& ~7 N1 f% J9 ]
- * kind, whether express or implied; without even the implied warranty
4 \7 Y, ~9 K3 @1 u# T3 P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 u+ w+ x4 T+ I; H9 ]. { - * GNU General Public License for more details.
9 `* p3 @% {! a* v' | - */- V& V3 j: g; j" v2 s6 ?
* k" @5 [5 c! D$ q, S9 s3 j+ p* @& x- #include <linux/module.h>' u. c; X" K1 l0 C3 |- q
- #include <linux/init.h>
" ~* ^4 k+ \' w- i! Q: A ~ - #include <linux/errno.h>- `+ i6 r+ D1 ~
- #include <linux/types.h>" r, \& q6 b, F7 W
- #include <linux/interrupt.h>
6 b7 Q% v. o- S - #include <asm/io.h>
( A* E* x. g* Y# i) e- | - #include <linux/moduleparam.h>+ R" y# V, F# W: u8 E" Z6 l g! ?
- #include <linux/sysctl.h>
- F1 l* N8 z2 y6 e# I D/ O - #include <linux/mm.h>
, K( s7 b8 P- e7 Z/ I( v - #include <linux/dma-mapping.h>1 G$ Y3 m. Y$ s. U
& u: b/ k6 D" V% n- #include <mach/memory.h>
) o8 a9 x$ p( e - #include <mach/hardware.h>, x6 B, O/ t* }$ ?7 Y5 y1 {
- #include <mach/irqs.h>( W; h) u. l2 X# a" [' h
- #include <asm/hardware/edma.h>
/ v0 _4 A7 S: A! g2 C
& h+ F: X$ C' c* ]- #undef EDMA3_DEBUG# _$ s" M$ O; _0 l. r; ?: g, A! K+ g1 W6 e
- /*#define EDMA3_DEBUG*/ Y: o# W* |/ I. ^# ~+ S" W
. _4 m- t: m6 S- #ifdef EDMA3_DEBUG2 ]! W! Q }3 C8 m2 {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ H% k" }3 U' M, `2 v+ \& a: ?3 H' _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 f& Q( a; @* P. o& |' k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- [3 O, D1 n, Y2 `
- #else& z4 T: c( a$ e+ T' w& p! o
- #define DMA_PRINTK( x... )
- g* Y$ Y! r& ^ - #define DMA_FN_IN# Z% D* z# J9 p# J0 J" A
- #define DMA_FN_OUT2 u3 S" C2 g, C" z& L+ m# H# D
- #endif
l8 a. d4 a+ t3 o q7 J$ {6 F - ! G; z* B' y6 k/ e4 q: e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 I- N0 a x$ Z% ^5 r& U - #define STATIC_SHIFT 3
8 P' f) B% S; { - #define TCINTEN_SHIFT 20
0 X m0 E1 I& y - #define ITCINTEN_SHIFT 21( p6 @6 f6 ~* { I/ s# f# |
- #define TCCHEN_SHIFT 22
: h) R- T$ V* V2 g$ Q% ~3 J1 r4 o - #define ITCCHEN_SHIFT 23
' D9 b8 ~: y. g6 h: Y - 0 j$ a& H6 F' ?: Y
- static volatile int irqraised1 = 0;
; @7 R; F) `3 K7 A7 `8 @ - static volatile int irqraised2 = 0;
+ h* @/ T) O5 |! c/ }6 U- i - 9 d% M' o; s$ Y* _: g) X, k( V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 X, y: ~( m( [, C0 c$ \, r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 F6 @5 Q+ m( K& h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ]3 }1 B; U8 W/ b) V& h- v1 `
- 2 }9 i5 F2 o8 Y( n r) _' ^, [
- dma_addr_t dmaphyssrc1 = 0;9 y8 a+ Q) f4 H) ^/ K5 T( r
- dma_addr_t dmaphyssrc2 = 0;3 k8 s& E% g' I
- dma_addr_t dmaphysdest1 = 0;
: Y/ _- k. I+ \+ j - dma_addr_t dmaphysdest2 = 0;, e) G# ]* ~. N+ c: E3 {
- ) B8 _% |8 r) k1 | v* y1 P2 I" V
- char *dmabufsrc1 = NULL;
4 a3 ?7 s0 n! Q' p5 u0 I" F - char *dmabufsrc2 = NULL;
1 T3 N$ S3 d; a# {9 |6 } - char *dmabufdest1 = NULL;
: l) U$ B8 u9 D) E' ?! G8 S0 l - char *dmabufdest2 = NULL;# p4 [2 Y3 Y; ~5 G: s5 z* Z v
3 J4 j$ K: @5 `. c+ J- d0 m. t- static int acnt = 512;
# ]# ?/ h$ C# x+ |/ k* O - static int bcnt = 8;, D# d* u2 E. m
- static int ccnt = 8;3 E$ A9 ?2 C+ _* ^9 \9 H1 Z& Q
( ~1 F7 W1 ]$ y% D% ?/ y g- module_param(acnt, int, S_IRUGO);3 H8 f0 \$ \ [6 n) M! z! |: }9 X/ V
- module_param(bcnt, int, S_IRUGO);' r" j/ b1 ]$ S
- module_param(ccnt, int, S_IRUGO);
复制代码 & J3 D5 X# z0 b" m/ f: I
, [+ k8 {3 Z) R; Y! e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! }7 g" {) C+ S* j, ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 c5 J& y9 [8 S. D, [) t+ I; p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! Z7 n6 z3 O$ \8 v: Y7 i
) ]0 j" p \; ~- t
* G$ D2 O6 i8 e: J% o- G
|
|