|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 k( i3 Z) m6 J8 C
- [code]EDMA sample test application
. p* u7 `* Z# }- l - /*
U- a* w; ?7 Q$ x7 M) [: I8 l1 ] - * edma_test.c
, O; E0 h! ]9 B, n: { - *6 P. P* f( t0 K. \6 ?: v
- * brief EDMA3 Test Application- c5 `9 J! o+ L. A
- *, e$ Y/ f/ g4 B
- * This file contains EDMA3 Test code.
- W8 i0 s& C0 e( M+ C: \! v - *
8 H. r9 q- F- j D5 Z0 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 o6 r, |1 H. q7 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT Q! D# `1 d/ B3 [+ n* U. |
- * TO CHANGE.: u7 C2 j3 C# K& a# |
- *0 v, T. ]" G7 C- M! a: t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! `* N/ s* K: C5 n% T0 C
- *
2 ~, ?/ H \4 ~( m, P7 O6 h0 `4 [ - * This program is free software; you can redistribute it and/or
4 R0 d3 k ?* l+ u9 U - * modify it under the terms of the GNU General Public License as
3 r% c f* G# Z8 I* i/ p - * published by the Free Software Foundation version 2.. u- N8 z+ Z9 c( }$ B
- *0 W# Y& m' g6 S$ E# x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 \" ^) g* D4 h& n5 o
- * kind, whether express or implied; without even the implied warranty
& c: X4 n" K8 l7 `" r$ P* u q# l( Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) F# [% Y* ] R3 @: w/ S - * GNU General Public License for more details.* v& G- l3 ^& j: _$ b3 M4 h/ a
- */$ {+ P2 c" n( @* n" B! K
# q, }2 O) ]( V# u- #include <linux/module.h>/ K$ M. U. I ^0 m$ g
- #include <linux/init.h>
Y; W8 B# L! G/ b/ I - #include <linux/errno.h>
9 I# l$ Q; w. Y$ d9 x6 |& s - #include <linux/types.h>* h- E2 @, a# d8 k) O
- #include <linux/interrupt.h>
( O' `$ G6 v7 m6 t( l - #include <asm/io.h>
5 R, \; M, N1 [* A - #include <linux/moduleparam.h>
- Q% c+ |) m( O* M: x5 ^ - #include <linux/sysctl.h>
7 l: P& p$ B- _$ M3 t - #include <linux/mm.h>
: F/ N. g1 N! ]; \: J$ U" d# { - #include <linux/dma-mapping.h>
8 a7 z- d9 N1 }" T% G5 x4 b
' U5 z5 X5 }* `- #include <mach/memory.h>8 ?$ Y8 q8 j& h/ O
- #include <mach/hardware.h>" g5 l/ Y) |0 [2 f. b
- #include <mach/irqs.h>: Y1 N6 \1 P0 c0 M' e/ P
- #include <asm/hardware/edma.h>/ |/ {0 D# {& f1 m
. K; r. b6 l- U& `, _( m7 b- #undef EDMA3_DEBUG
: z( D/ e6 A+ B - /*#define EDMA3_DEBUG*/* Y$ B) C# j; v( i* r4 u
; U/ g$ d4 }* _; f- #ifdef EDMA3_DEBUG" Z. p( @+ O! ]/ s* L+ A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); g6 Y# z: g# a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) q, \- b1 P# t" z% h6 x6 a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! ?% t2 t+ E4 v$ ] - #else
' | j9 h0 X J( K9 H - #define DMA_PRINTK( x... )5 g* @5 U$ ]9 Q3 f
- #define DMA_FN_IN( r4 u, Y2 t4 o* e+ c# x: ?6 ^
- #define DMA_FN_OUT
& W9 Q! |4 o8 A7 I! a% {& m. X4 D - #endif
( l }. w+ E9 w Q8 c3 i+ L5 F - 7 p r" v0 c' b8 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. p- g; W, W, U% `. d: N - #define STATIC_SHIFT 3
; z! d3 C3 U! B( E6 W- v( C# i - #define TCINTEN_SHIFT 20: t, O7 l. v$ d0 O8 j2 n4 b; I
- #define ITCINTEN_SHIFT 21
. R! b- J3 E& P$ _0 L3 f0 ] - #define TCCHEN_SHIFT 220 Q. O2 j ]5 t3 q" B
- #define ITCCHEN_SHIFT 23
2 k6 y- ], S5 J2 i- }
4 e' C3 z+ [7 f, x% N! G* U- static volatile int irqraised1 = 0;
1 k3 T) }; w+ K7 S1 _ - static volatile int irqraised2 = 0;
" a! N0 y* ^, |7 |; Q4 {
: O, s3 D0 ]# }! k- }/ V u+ H8 M# ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* D" R7 N M- ^9 q1 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 j2 j0 M5 y# ~- s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. s( J) |/ h' c6 `1 R - 4 U8 v: E$ h) B2 ]% i% @- {1 r
- dma_addr_t dmaphyssrc1 = 0;" a1 L& M! }1 F. z% J4 ~, n( i
- dma_addr_t dmaphyssrc2 = 0;; ?% x N: r1 O2 i
- dma_addr_t dmaphysdest1 = 0;, n7 s9 B' m6 Q \
- dma_addr_t dmaphysdest2 = 0;
9 d1 R; r6 D! S
' O6 ]$ G* L6 r/ r- char *dmabufsrc1 = NULL;
2 c- m0 X1 I: K, j% H - char *dmabufsrc2 = NULL;
D5 `+ o( f; P# \- P1 @( e - char *dmabufdest1 = NULL;+ ~% ]; V& I. E- c
- char *dmabufdest2 = NULL;0 r1 N( ]6 y7 c# |4 n- i3 L
) }* F4 v7 x5 Z% O5 c$ X- static int acnt = 512;
& c& Z% i8 o) ?" D4 p( B, G# w - static int bcnt = 8; \( i7 ^8 R% \* k G; _3 J
- static int ccnt = 8;! P1 p( g' F! W
/ p( w: ~" {7 }$ D* `2 M3 ]( r- module_param(acnt, int, S_IRUGO);* O K: r. N) B2 i4 y$ f7 H! j
- module_param(bcnt, int, S_IRUGO);' q2 E# r0 O' W5 c1 H+ `5 u; |0 J7 Z
- module_param(ccnt, int, S_IRUGO);
复制代码
2 z4 G( A" _" Q) n3 t' W& \6 r" o1 [; V% S5 l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 ~, j0 U+ W; t# ?, y, b( W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ q; X* v+ E7 x$ E3 }7 w8 ?" v. _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& r6 ^( }. P0 [
" H2 e- `9 g% u6 ^* I
* C+ y5 ^, H4 U$ _6 D. a% u) m |
|