|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 U6 [( `' U3 h2 z- R- N# |- [code]EDMA sample test application, u, `' c# I9 e8 z2 o
- /*5 ~ R# P2 f: g% r% k
- * edma_test.c
; v' _# m0 b: j7 M - *( N7 A' | b2 U( k0 F4 }
- * brief EDMA3 Test Application- d6 Y- ~) A! ^/ ?) _4 Y
- *
. u* u3 B' ^- c: {! C - * This file contains EDMA3 Test code.
1 G! J8 ^: a7 K - *
& S6 _4 U9 `: h, s j: f7 w: o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( }' U Q& e! }" m. |5 O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 p! _" d0 E* p0 `, u9 T
- * TO CHANGE.' l+ E t6 [/ Q6 g
- *
: V3 {+ q: r& ]! T5 p9 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) x8 p- \, `0 m$ V% q% a - *# X1 F4 B2 B* }, e
- * This program is free software; you can redistribute it and/or5 p; C$ @" ?, R. C2 [. M
- * modify it under the terms of the GNU General Public License as
+ Z+ v0 L# x! n3 A. m# X - * published by the Free Software Foundation version 2.
) H, @! g$ X4 K( e) V - *
T( X; @/ d) e6 ~5 I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 `0 m2 M9 C" N0 p: m+ \8 r - * kind, whether express or implied; without even the implied warranty5 |# e' n3 h! e: L% K8 A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ c2 M9 o! |2 [" L, x' E& G9 ~
- * GNU General Public License for more details.0 e- N/ w6 t. l% Q
- */7 M7 A h% y$ C7 L
- 1 n" t, D& `4 V$ y! K
- #include <linux/module.h>" z0 O: I+ L" F+ }
- #include <linux/init.h>" f0 S9 e( J0 Y+ ? l' F
- #include <linux/errno.h>6 ?9 r, T, V- Y: a6 M, Z, a
- #include <linux/types.h>
+ a( B _1 F7 S( A* D - #include <linux/interrupt.h>
* s1 R: N$ W% S2 e9 _ - #include <asm/io.h>% Q0 y+ }9 n: p( [! } e0 @) ~
- #include <linux/moduleparam.h>" n9 D( b# A1 m+ g) z. _5 L
- #include <linux/sysctl.h>( | ^7 T+ C9 O/ f8 g
- #include <linux/mm.h>
1 u) l D9 a% X5 i1 G5 b - #include <linux/dma-mapping.h>; o! C/ O1 E' a% u" Z ^
2 _0 E5 A/ q( `# ]1 P' s- #include <mach/memory.h>
+ J! H* y3 o9 ~, I! U - #include <mach/hardware.h>$ Q" b1 w9 Z' Z6 l6 F& R
- #include <mach/irqs.h>
% B! k4 G: R3 J9 r) F) t0 o - #include <asm/hardware/edma.h>$ S; m1 Z% i, W" f" s
( @7 g2 M z: a4 a" [* i0 z( B6 }- _- #undef EDMA3_DEBUG
. }" a+ K' J6 P J+ K0 R - /*#define EDMA3_DEBUG*/* m7 s2 y- G7 ?0 {
+ Y1 T8 n% v" ~- d1 G1 v h- #ifdef EDMA3_DEBUG6 J8 m2 H+ F% E7 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 x2 Z7 L6 f9 z( G6 X5 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" J' c. W" y" L% }% _, ^) i+ v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( o# I! y2 p0 M5 k
- #else/ K5 H' n6 E# D% G9 E, A
- #define DMA_PRINTK( x... ); d, Q3 L% }, d' F+ e# R
- #define DMA_FN_IN' {( s: O! o# B1 `( O% m
- #define DMA_FN_OUT
+ ^: ?8 v& a& Y7 O9 L# c! Q - #endif
2 z- {- r8 h+ x% J - ) M" I" |$ O) b: C0 O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- S- d3 i! ~# R' P. U/ w - #define STATIC_SHIFT 37 C" J- d2 w2 M' s. t
- #define TCINTEN_SHIFT 20
3 o; k5 v# W" u: P2 S3 h4 [ - #define ITCINTEN_SHIFT 211 D# U' {2 {* J3 i9 B
- #define TCCHEN_SHIFT 22; r6 ]' X9 x* f% u6 s4 A/ ?, q3 T! B
- #define ITCCHEN_SHIFT 23
8 X8 u3 v3 x9 R& }, i& h7 c - 7 k; R' x& W2 j# S3 j9 z# ^
- static volatile int irqraised1 = 0;
7 ?; O3 C8 p/ L' j; X - static volatile int irqraised2 = 0;
5 o, P; O2 a; ]6 W - , f0 P) f* {9 ~0 J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" b# Z8 c4 |3 Q# q0 ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( q. b) {! }% }. Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 u9 s f! q# k. [# G& |' \ - / W+ f* u+ y9 Q# {$ ]9 \! w& m( b
- dma_addr_t dmaphyssrc1 = 0;
$ `( f- _ i8 C$ G - dma_addr_t dmaphyssrc2 = 0;
& `( V3 [% ~* O1 J! _ - dma_addr_t dmaphysdest1 = 0;, R3 g8 V5 ?/ S: t) s. k
- dma_addr_t dmaphysdest2 = 0;
6 ^ Z: G+ {3 ?' h
9 W3 X/ A+ J# `/ F- char *dmabufsrc1 = NULL;- R: }5 S! n, N. f
- char *dmabufsrc2 = NULL;8 A' a+ a- b1 d! o6 j) y& {* D# M
- char *dmabufdest1 = NULL;- Z! I4 j% X3 Q1 z
- char *dmabufdest2 = NULL;
& q. R6 c7 j& c% h S- J - , V+ V# E# ]5 ]; O V" ~
- static int acnt = 512;
% s p. C5 ]4 l7 o5 S - static int bcnt = 8;
/ z! Q# I& J! o5 P - static int ccnt = 8;
7 ]- H7 {& h) p- F( f$ f
: M( P% C0 @) q' b6 o2 \- module_param(acnt, int, S_IRUGO);
5 I0 [, G' {8 u# X3 m - module_param(bcnt, int, S_IRUGO);( M. v' ^+ l/ S& g
- module_param(ccnt, int, S_IRUGO);
复制代码
0 w7 x( Z! h2 [) N$ e$ @
+ c# A6 h6 O& o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ?: y: a* Z, t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& i0 f5 Z7 i! u1 A: b/ m$ }( P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. H2 m* H, C- z$ p0 b' j
" o8 D: A5 E2 y" h" s! ?. \( t- N% h
& Q6 }# S, K- j/ }* z* K |
|