|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 n( v' F! U; a X4 S
- [code]EDMA sample test application
4 i$ F9 D9 o' D" u; m0 U - /*
1 W- F4 ^8 n2 Y2 V - * edma_test.c" ^ T. A8 J" t1 B/ [
- */ M" U8 k; N6 F% Y# f' P- V
- * brief EDMA3 Test Application# |4 u. s' p1 H1 k
- *
: J9 f2 a4 {3 y7 p7 h K9 _* g - * This file contains EDMA3 Test code.' |" J) {; M$ o" r7 w9 U
- *0 k) g/ C. p) y+ K1 N- O# }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! t* t0 n2 s0 j( M6 ]* \* H. g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT Q! C, d6 T6 U6 {& y
- * TO CHANGE.
; {. W0 f8 W' @6 ]- R$ y! U4 ^ - *0 m* Z/ P& ]- T( s, s/ k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 V. I4 \- f* p
- *& V9 W$ R9 S- O( U9 c& Q
- * This program is free software; you can redistribute it and/or
& O8 u' [9 [4 _* { - * modify it under the terms of the GNU General Public License as/ [& x1 i! q# [/ P# r$ I
- * published by the Free Software Foundation version 2.3 X" K9 X( t) B/ j G
- *
0 M. ^5 }9 K5 Y( v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* h3 J- ~# G2 p: [( B4 G+ M8 j
- * kind, whether express or implied; without even the implied warranty
% O; p7 _4 @2 B& | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 V. h. d+ O; S- X' r: d - * GNU General Public License for more details.0 B# \$ U/ C+ Y X% h
- */
* `9 f9 u3 _* r' F* b: ^ a7 ~ - 7 O4 O$ Z! \+ y; D* ]
- #include <linux/module.h>
6 ^( v0 r! G/ B6 k# V; e3 M - #include <linux/init.h>0 b6 h( ^8 H6 h0 p% X
- #include <linux/errno.h>
6 L( h7 j. B; w! M. u5 B - #include <linux/types.h>
3 W }" \% [ _% l - #include <linux/interrupt.h>* C5 ?- {# L/ z$ ^8 @
- #include <asm/io.h>
5 a& f R5 \4 q6 C$ L& @- J: ? - #include <linux/moduleparam.h>
' F; e5 h% F+ O$ I: ~ - #include <linux/sysctl.h>! P* N. V$ Q" j0 {1 C# k; {7 ^
- #include <linux/mm.h> K/ K. u8 A* d% i1 ~5 ]4 u4 ?
- #include <linux/dma-mapping.h>
0 r0 }3 t# B. Y* J - " M# a" C- M9 s4 W4 ^4 [: ~
- #include <mach/memory.h>. Z" N' \ }% p
- #include <mach/hardware.h>5 H* z* q9 d0 g) y
- #include <mach/irqs.h>
- I! P4 ]; w5 c/ l3 t. d4 L7 e0 M - #include <asm/hardware/edma.h>8 [' z* y/ G8 V2 g9 O, L* B7 \
- ' O% `9 {5 K2 I7 x9 ?
- #undef EDMA3_DEBUG: a6 B0 W1 @4 r5 t0 y
- /*#define EDMA3_DEBUG*/4 p9 z# s" W# I; P. U+ x2 K9 ^
- 3 n0 ^' x, @: K
- #ifdef EDMA3_DEBUG
$ p) V) m7 j4 O3 a$ H8 r6 z' U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 @' F- s' g; }- m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# f }. f5 N* O' S; x% U+ x6 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). @" A2 _* d7 \! b1 z- T
- #else
8 S5 ^5 C: m% t0 i" M - #define DMA_PRINTK( x... )5 w' r- m8 ?6 e3 C; B& p
- #define DMA_FN_IN
! B: q/ [/ u7 f, D! x; k9 Y - #define DMA_FN_OUT
5 o, {6 k9 \. r0 o# s L# Q7 y: D" s - #endif
4 E: {! L: v, d* [. `; `% y$ i
) n" ]! G! `1 {8 I3 Q) D1 X; U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 H8 S. [$ m; C2 M4 e
- #define STATIC_SHIFT 3' A+ Y, d2 ^3 ^: ]; b) z! f
- #define TCINTEN_SHIFT 20
. J2 N* Y# o+ y - #define ITCINTEN_SHIFT 21
- C3 v( @% x6 v! X/ \* f0 I - #define TCCHEN_SHIFT 22' v# U( X8 _- k8 i) O& n- F
- #define ITCCHEN_SHIFT 23
5 l5 I% |5 q+ }- U - : ^" D% `4 D2 \
- static volatile int irqraised1 = 0;/ G5 k4 G& h7 G/ P
- static volatile int irqraised2 = 0;
) [# ]$ Q& l% x5 }- u
) L! o) w- P0 |( @' s1 I6 b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ }# e( z' ]1 y! T- p' D( q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 {% u0 V6 r/ [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ]# C' x, W8 d9 w1 u6 W* |1 C6 t ~
8 s4 o ]! V# A9 h- dma_addr_t dmaphyssrc1 = 0;
' w) V& |3 `2 H- X9 }+ W" i3 T) d - dma_addr_t dmaphyssrc2 = 0;+ v/ { {+ D! j l7 k. C2 K
- dma_addr_t dmaphysdest1 = 0;" t8 w9 b2 E5 r8 D+ G ?# c
- dma_addr_t dmaphysdest2 = 0;2 |1 ?$ [3 A4 a% ~3 \
- F0 N' Q2 ^# a4 E" \( i
- char *dmabufsrc1 = NULL;3 }- w8 d+ E# P5 d. o
- char *dmabufsrc2 = NULL; |2 Y. [8 Z! I; x7 W6 O
- char *dmabufdest1 = NULL;
! `3 o* @1 T! A% n- A - char *dmabufdest2 = NULL;! X& W/ P( Z7 v- C) d8 y0 T
- 2 j$ [0 T' t7 A% L' F
- static int acnt = 512;
" f! a3 T6 K3 N: I s0 G6 N' G8 @ - static int bcnt = 8;
3 m7 l1 p! X2 Q. \ - static int ccnt = 8;
5 G4 e5 k7 P" T, a" X1 D! h1 C
7 t1 W) `) l9 z L- module_param(acnt, int, S_IRUGO);
4 Y% P% P% G9 d1 D" b: S8 F - module_param(bcnt, int, S_IRUGO);, r( T# V8 e# x2 Q2 y
- module_param(ccnt, int, S_IRUGO);
复制代码
$ M" O3 U+ d" a& ^% Y. z* h7 [, D* H3 C6 k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; m6 I! u8 Z K/ D0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: m9 q# }0 r* U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 B: m0 Y1 i+ A+ \% Y7 d# p* I) M Q0 k. g) I# o
4 T, x4 i# E1 x/ C5 S4 n; U* S |
|