|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # p, w0 L5 R1 o9 s1 \0 R
- [code]EDMA sample test application' ?! p' ^, t s& d% T# G
- /*4 V# ^' o$ l1 m8 G
- * edma_test.c2 F0 N0 v; ]$ N( q) q6 I l
- *
# u% B2 d8 J B - * brief EDMA3 Test Application! Q7 K' {: l- }3 j$ x% X. B
- *% {9 I/ Z+ r* y3 T# Y
- * This file contains EDMA3 Test code.- L( B7 J4 ]5 _" d/ q* G) ?# `! [ y
- *% _; U9 {+ M% ~( d" G; t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ A1 y+ @1 t* Y' W3 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! d3 z0 k) M4 O - * TO CHANGE.+ @; \6 ~1 x. o- E% @" J
- *
7 P: ]/ R8 s( E6 L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* h+ m8 T+ N8 a) @( y
- *3 M- R5 o, V+ p, s7 D4 f4 s% P
- * This program is free software; you can redistribute it and/or
9 A; n8 C$ f9 _ w( F - * modify it under the terms of the GNU General Public License as% k0 S5 d8 P+ V
- * published by the Free Software Foundation version 2.
3 f4 T( W0 j T. X( r! w# X. K - *: Z6 b4 I1 p+ @7 t: M( p$ ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) i1 p8 M, @+ j& n' ?, _
- * kind, whether express or implied; without even the implied warranty
. }* q# I( i9 N$ i; N& i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: G0 Z9 S# z- [; b
- * GNU General Public License for more details./ n1 m9 V( a B, C. m) C6 {
- */: O1 V- u: E' V; u6 \6 l& }. [
- ) N0 P, Z2 e" y0 k, s8 M
- #include <linux/module.h>
4 s" B1 K" E* o% U - #include <linux/init.h>6 |8 A( A, P* E0 p1 d% h1 J `
- #include <linux/errno.h>
6 S; Y* ?# v1 k6 t: h& W - #include <linux/types.h>% `: Q; l: S" G0 i. @
- #include <linux/interrupt.h>* Z% e6 r1 d# u; S. b
- #include <asm/io.h>
6 S. w/ X( Y! J2 {0 p7 z - #include <linux/moduleparam.h> ?" l1 f% n" n% B" [7 K
- #include <linux/sysctl.h>
: R- ?/ L# C$ ^0 k3 ~( R: V - #include <linux/mm.h>
& r6 U: G5 E3 P3 d+ I5 V, W. E8 v - #include <linux/dma-mapping.h>$ E' l- s. d, W- w u* G
- * N8 l7 a9 m* {3 _+ H' L/ i% m$ d9 ~' d
- #include <mach/memory.h>1 b M4 e2 f6 |2 S1 N
- #include <mach/hardware.h>
3 W& `! \/ L+ P5 x3 T4 C& T - #include <mach/irqs.h>5 J4 ^9 E6 Z- ]/ J
- #include <asm/hardware/edma.h>( W% f o5 F7 K9 P$ G F" @3 K6 ^
0 t5 K7 ]! g5 d* B" t8 V' ]4 }- #undef EDMA3_DEBUG
/ @. u6 r7 }6 P3 k/ z - /*#define EDMA3_DEBUG*// V/ ]0 [8 F- N$ Q+ f
& v3 ~; V N0 [0 i Q0 F/ I- #ifdef EDMA3_DEBUG' ~- x1 c# B- {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- g/ I/ A F0 O" G- e" N2 u$ ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) L( Q/ `3 t3 N1 m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). R; p+ Q$ W7 b9 G: X! Y, I! j1 a
- #else# o7 H; J7 ]9 r5 }! S3 ~& E
- #define DMA_PRINTK( x... )
6 j7 ~# s6 E+ |! F - #define DMA_FN_IN
6 I3 g0 @ G3 u- [ - #define DMA_FN_OUT( b# ^2 z' G9 ]6 c/ ^! p9 R9 _
- #endif
* ]0 W( ]9 U5 \% W
9 V) i) _' m% p$ D1 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 d, ?7 V! K1 V1 Y# D
- #define STATIC_SHIFT 3
8 L& y3 R2 D. v/ p3 W - #define TCINTEN_SHIFT 206 b* J: k* B% _3 p# r! l, u
- #define ITCINTEN_SHIFT 218 ^, d7 B' a2 ^' k; _1 T7 @
- #define TCCHEN_SHIFT 22
3 F: ~& I/ k/ ]- g, v - #define ITCCHEN_SHIFT 23% Z4 [! W& q8 f
: U) }4 f; E8 B! @* Q- static volatile int irqraised1 = 0;) s' B8 Q' O5 F1 p" K8 c) m
- static volatile int irqraised2 = 0;
# U. E3 _4 Y3 Z" h - * ^) n7 S9 ^9 U. m3 X' C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- x3 C+ N& X/ y1 b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. s0 }+ U7 z8 j3 y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) x$ }, X0 Z) g% W- P - 4 U7 q" h7 Z0 _. x8 R8 W
- dma_addr_t dmaphyssrc1 = 0;
9 O( r, A# t/ O Q5 R: P - dma_addr_t dmaphyssrc2 = 0;$ ~5 _3 @1 |8 [$ }
- dma_addr_t dmaphysdest1 = 0;
( }' \" h/ {# k( S$ b/ P+ _ - dma_addr_t dmaphysdest2 = 0;
, }3 n9 x3 a. d5 n* ~2 A - ! U9 o7 p5 a* i% q4 u
- char *dmabufsrc1 = NULL;
3 h# S0 V# ]5 ] J) `1 `$ r - char *dmabufsrc2 = NULL;
/ Y+ { c# }6 c. R7 X# y; I ? - char *dmabufdest1 = NULL;
+ ^0 [3 x. n6 S9 C9 B - char *dmabufdest2 = NULL;5 X6 {6 y* _# j, j4 R5 y7 w
- . S. g9 u* y R3 l7 n0 `% F7 d
- static int acnt = 512;
* {0 n4 h5 q2 D' u" l - static int bcnt = 8;
( t6 ^' ?- ~$ z) a0 a5 \2 J - static int ccnt = 8;
* J6 R& D6 a$ [" L5 ^1 A1 F& o - 5 j0 o8 O6 j0 y; C8 }2 E
- module_param(acnt, int, S_IRUGO);
% v( V1 a- h1 p; X4 F - module_param(bcnt, int, S_IRUGO);
1 B, u+ c; p2 G8 E - module_param(ccnt, int, S_IRUGO);
复制代码 : o# H& h1 d+ @- p7 g; G+ W3 E+ |5 p
3 M2 H* g8 n ?0 C- y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 P( S6 C$ E; D/ Q: darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ I* x/ x* Q! ^/ h) {1 ^/ J& l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 k2 \+ r0 z; G+ p0 d
. o6 i, b, u4 _7 n% r" z( O, o: B
( z2 L! F" P- O8 ]2 x7 p" | |
|