|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 W; N3 T8 x' J4 }, E8 _- [code]EDMA sample test application. V [/ L8 L8 S: v- f* W7 [. @
- /*2 j+ U; {# {4 x* {
- * edma_test.c3 u. v& A. @' `7 c
- *
4 |! u: j: t0 h! Q - * brief EDMA3 Test Application
" ^2 O3 N. d1 D+ I# p - *
1 l$ u/ f7 C) P. b+ X+ g: {5 b6 o - * This file contains EDMA3 Test code.$ H- n, v% k: b# N: P7 q! B# u
- *
: M: T* e; a) d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& c$ a: E4 y g. c$ |; n9 E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 L ?9 U/ f V/ c. d. G/ c9 s
- * TO CHANGE.' j8 [" v! g3 o- W1 I( E
- *' c/ p6 U& {- y$ \1 o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* c: Q3 }0 p/ @* r4 X8 u) Z3 ^# v
- *
# z' R l$ M, I; B' R1 c- C1 \ - * This program is free software; you can redistribute it and/or0 w% Z! u2 m& H% m/ \7 a" Q
- * modify it under the terms of the GNU General Public License as
h3 L- V; {+ {5 h# ]6 T5 \ - * published by the Free Software Foundation version 2.
9 u9 ~6 R, C* x; [1 |' Q5 [* O - *' ]1 F8 g2 z) }# w2 J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" v0 E8 y) u- m& j - * kind, whether express or implied; without even the implied warranty) d7 K/ j7 S d. l4 J7 m5 A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, [ U0 @! l, X
- * GNU General Public License for more details.
0 p& y c/ g! \ - */
4 P ]$ T% d# n3 n S6 w - ) t, V# t0 d; d& \3 V/ t
- #include <linux/module.h>
* j F9 F. O* u. N5 f. P4 m, X - #include <linux/init.h>5 k1 C- o! ?; w% }
- #include <linux/errno.h>7 b; t+ d% U+ a! }8 V& N9 Q
- #include <linux/types.h>6 x, s4 K$ W5 n- Z E
- #include <linux/interrupt.h>; X0 g w8 O2 t2 \ |
- #include <asm/io.h>
% M( [: M; b' v' ` - #include <linux/moduleparam.h>- k0 X1 d- M6 Z) ]8 X5 o) j
- #include <linux/sysctl.h>
6 u/ R/ \1 g! C5 x7 H4 i- ~9 t - #include <linux/mm.h>
1 G0 R( [; D- F0 B5 W0 | - #include <linux/dma-mapping.h>9 R- |0 ~7 L+ h" t9 z
- * w; b* @, C+ F; x/ ?3 x# d% \% f
- #include <mach/memory.h>' w7 a3 Q. U5 U
- #include <mach/hardware.h>0 u6 l N0 m) W8 a, g( G) Q2 x9 j' X% V
- #include <mach/irqs.h>
- }& N& v) d2 H+ K) b - #include <asm/hardware/edma.h>
5 D/ D2 C/ A6 O - 4 t7 O- R/ q j
- #undef EDMA3_DEBUG+ I4 g) {4 E! U
- /*#define EDMA3_DEBUG*/
; I( m6 r8 }- I/ ?$ ?: E - 0 M& e6 A1 C) Q0 j* L
- #ifdef EDMA3_DEBUG+ A8 c2 L! q. l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 y* ^$ R6 Q4 ]3 s4 g( A( C5 ^# F) P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& ^. N" x7 o$ q! `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( @5 y) |. B' E- t r1 h
- #else
" `' m( H8 E( M/ P8 I, y - #define DMA_PRINTK( x... )
" q# }2 O6 o/ r1 z! h - #define DMA_FN_IN: u: h3 }8 N. m8 W
- #define DMA_FN_OUT4 w: j! I4 B5 B, Q/ r7 S* x3 _; j
- #endif
3 I9 Q4 ^9 l V/ h/ D T3 b - & R# I7 q) u4 o" j D% t5 u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 a! m2 z! Y4 N/ S+ r - #define STATIC_SHIFT 3- C# [1 q+ ]5 y4 v! D
- #define TCINTEN_SHIFT 20
6 c+ u5 l9 O1 E: S4 @ - #define ITCINTEN_SHIFT 21
/ n; f, a8 _8 w7 F9 r( i# m - #define TCCHEN_SHIFT 22
, Z2 @7 o1 l. u# S! o - #define ITCCHEN_SHIFT 23
+ g: N2 l% o$ X. ]4 f) t
7 D, s; S' ~( f+ i6 \% X1 O- static volatile int irqraised1 = 0;. `/ Z1 G% K5 ^6 @ j0 A
- static volatile int irqraised2 = 0;
# L: N7 c4 J3 ~0 J$ Z7 h
- { X. T: N1 d4 M6 \ D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a9 Y$ @/ J- A! r& L0 l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" c; f( |2 y; Y, X( }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) q' b3 W B, P. ?, W; T
! f% y6 }! g i( R( g* o' a- dma_addr_t dmaphyssrc1 = 0;
7 K/ h& B! A% Y1 }4 B - dma_addr_t dmaphyssrc2 = 0;
( T8 \7 Y) E9 L" w% X: y - dma_addr_t dmaphysdest1 = 0;
5 U- d3 q* u/ H9 I' N - dma_addr_t dmaphysdest2 = 0;( H# m8 B! H! W) H4 ]
- 8 T: W @8 ^" d; F
- char *dmabufsrc1 = NULL;( F" l4 m1 Q9 t
- char *dmabufsrc2 = NULL;
) \4 c7 h; Z5 n5 i" t/ X8 k0 `. G - char *dmabufdest1 = NULL;
: I6 v) O& C/ j0 } _ - char *dmabufdest2 = NULL;. {6 T& X+ ^5 F5 {
- + D2 D) }2 s f4 S
- static int acnt = 512;" c# ?* h6 Z: _6 u0 o; v- N8 _
- static int bcnt = 8;
) L( K. x) W0 {3 g) R( O - static int ccnt = 8;
' X" T/ ^* [" J - # P* V0 u: A3 O. a h+ o9 U1 l
- module_param(acnt, int, S_IRUGO);& V! C) r3 M3 M l* V) S! y5 F
- module_param(bcnt, int, S_IRUGO);* \4 F" x0 `& a9 [ f
- module_param(ccnt, int, S_IRUGO);
复制代码
+ c8 h7 G# H6 l# a8 ]3 \- M3 m4 R7 @# z( L5 C: J V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% [( E( j( ^% s% z7 y7 d9 t' ?9 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, p; ?' M/ c. C2 i5 \ V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 {, \0 f5 q6 v1 U7 k8 o5 q
) z' k2 A+ H1 z7 X: k
6 T7 v& H; Z1 P" g* @ |
|