|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - u# ~0 V; E! T% I/ V
- [code]EDMA sample test application }, o* B( Y0 v* g* T
- /*
+ ~- v7 {$ o3 o8 |$ V1 Z - * edma_test.c
1 h. ~! D+ K1 a5 I+ F - *
* b* E) L2 k- V9 r7 y/ \ - * brief EDMA3 Test Application
* W1 w, y" e2 v; J; k; v0 b- \8 U - *
4 X2 e* R2 X5 j3 C" ]0 J. p - * This file contains EDMA3 Test code.
' y3 n+ V b B# n7 A' U - *) l/ B$ r; [1 W% S3 A" l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 {3 h/ B( _2 R& w9 s; p1 E' [* X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 P- k2 }5 w' I* z% t8 G - * TO CHANGE.
$ ^& R/ @" o0 p/ b& K* [ - */ P/ c2 d* O3 T8 f& _9 u) E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 j0 A4 S. |# T4 v( _3 ` - *
& ~6 d' |% V; Z% { - * This program is free software; you can redistribute it and/or/ }8 c6 ?$ l" o
- * modify it under the terms of the GNU General Public License as
- U5 c+ Q4 x! G" x/ a" Y - * published by the Free Software Foundation version 2.7 U& E) h* N0 L' E
- *
$ M3 D' p6 W i* p, I" e/ p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) m# H! j* L6 o3 s. z4 R2 g - * kind, whether express or implied; without even the implied warranty' `0 j7 o3 k4 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 L+ s- v7 w1 {; Y; }; I - * GNU General Public License for more details.! v( u- {" p# `8 r; R
- */
# ~. S; D: E7 l8 Q' _) g$ ]1 { - : ~8 X& ]- r4 G( ?) L
- #include <linux/module.h>% J1 k* F# s) ]5 u t
- #include <linux/init.h>
! g' N4 r( l" t - #include <linux/errno.h>
# I0 r( w" |/ S, E- _: y; N: n - #include <linux/types.h>
+ y. U. J& ^5 X0 J: Y% R" B, e6 y - #include <linux/interrupt.h>
+ j5 W! v/ A1 G) Y& C- e u, l5 M# Y3 o( m - #include <asm/io.h> c$ R# c' {& I
- #include <linux/moduleparam.h>! w% r& q& o+ c1 r2 o+ ^
- #include <linux/sysctl.h>
6 Q; ^4 H* E& M! V# N- S - #include <linux/mm.h>, |" f5 d$ d$ c8 `% U
- #include <linux/dma-mapping.h>
* Z& k! x) E2 w& k - + Z- }/ Q8 o0 z+ }) G
- #include <mach/memory.h>
% @. `/ [8 I% Y - #include <mach/hardware.h>
. ?3 S; p$ m1 L, b - #include <mach/irqs.h>
2 C- ~4 q" `, A' O" G' y - #include <asm/hardware/edma.h>
$ \- l$ |* T" j( P e5 K) B - ; Z( N0 n' Y8 l, |$ r+ v
- #undef EDMA3_DEBUG
- C# N$ @: L. c% M4 w c - /*#define EDMA3_DEBUG*/0 M* M: s- T0 r u Z
: a! n9 g, F, E! o, ?: m- #ifdef EDMA3_DEBUG+ | t, N: ~; P9 J1 }* K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 H' T- Y7 D( `( O: L) b( J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: E8 j, j+ M/ ^$ j D4 B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: c* Y2 R0 m: R$ o" U6 {7 Z! m. @ - #else
$ U7 y2 L' x. O; O2 ~7 E* U - #define DMA_PRINTK( x... )
2 M( n& @% X9 q# F4 J1 ^0 r - #define DMA_FN_IN
. E" O- c- x$ P2 n - #define DMA_FN_OUT( e8 q2 k( q- |3 [
- #endif! {5 [3 @$ l( b& K
6 q; ^# F7 H x& b" N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 c/ e5 E- d( I$ [; @1 \9 D - #define STATIC_SHIFT 3
9 Y% }2 y* m, @) S/ y/ T - #define TCINTEN_SHIFT 202 J% W* W% E) J* a' C) `
- #define ITCINTEN_SHIFT 21/ o$ o1 b/ D. Q0 l. c
- #define TCCHEN_SHIFT 22% g* A# r* X, S& M0 B. T
- #define ITCCHEN_SHIFT 23. E- n5 e* }" N( I* |* H
+ C9 V6 Q8 g: ~) N$ q \8 v- static volatile int irqraised1 = 0;
6 g5 Q3 N2 a/ b1 Y. Q - static volatile int irqraised2 = 0;
( y# V" e9 k# Q, D - 1 \6 [3 n' m' ]9 u, W3 Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* U- l! q$ l7 J: |3 i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 r* |3 E) J# G. u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 d6 I$ F- d: E7 D' h
3 r: U) z7 I, G' i2 R- dma_addr_t dmaphyssrc1 = 0;
1 t/ P3 }9 q7 a6 j) u' p& q5 I( c - dma_addr_t dmaphyssrc2 = 0;7 z) r o! ]% ~: q' @# s
- dma_addr_t dmaphysdest1 = 0;
9 v; H) O) g- K6 S* ~ - dma_addr_t dmaphysdest2 = 0;
( }) X% i' Q( } I! K% l+ P& E. e+ h
* G/ D c' Y0 ?; a- char *dmabufsrc1 = NULL;- u' q- `7 }$ V8 t% ]+ T" |$ O
- char *dmabufsrc2 = NULL;
2 z) [' L, y" o: X9 Z - char *dmabufdest1 = NULL;! j/ H! O( E9 R5 X S! u9 O8 v
- char *dmabufdest2 = NULL;" p. s9 P) x$ c( w5 T+ c
2 X @7 s- [2 V! I9 j& H0 J- static int acnt = 512;7 k" r- L; y1 R3 j, P
- static int bcnt = 8;4 f$ F9 ^ ^# ^) j; E$ j' W
- static int ccnt = 8;# f. A* s# k) p/ w, A( W! o
0 G8 F6 ?/ A- Y1 Q/ P/ K' b* {) u6 k9 U5 ]- module_param(acnt, int, S_IRUGO);
$ P4 Y! y) z" f0 \# b$ j) }% Q - module_param(bcnt, int, S_IRUGO); C! ~8 ^! C1 f4 Y7 @5 c! G$ b, n6 |; F
- module_param(ccnt, int, S_IRUGO);
复制代码
' [8 c6 N. M0 B& d2 i) P; N
9 @5 Y6 p. _( _3 U! r8 k$ S: T8 _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 c n' }1 N# l2 ?5 b% a q% garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 r: ^" k; e. N. k% h+ [2 T9 M6 f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. ^; E, W9 S. s7 U! X* B' _' f9 I( K, { o
p3 j. G9 A0 [( [1 g% J, a
|
|