|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) t! G. z/ G4 `- _
- [code]EDMA sample test application, }4 i; J/ z- i- Z8 p4 L
- /*
1 q1 _& T0 U2 `0 v - * edma_test.c
1 k+ ]5 _2 j; {" t) I - *
' X1 z, A9 ~/ M( V" Q# j9 L( @ F - * brief EDMA3 Test Application9 Y! ~( i9 Y6 N9 F- @
- *( ]1 |$ E1 O( F7 x
- * This file contains EDMA3 Test code.. R, {- f" [8 G# J$ ^1 R
- *, t _ U1 F( D ^4 b7 F6 J w( H. v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 G; \+ O# _( h- V2 L" g. [1 n+ W3 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 ?* D" l0 V# A! `! q: p
- * TO CHANGE.
1 ] h# G) I+ r% R - *
5 P, U6 s6 d: |% ~; J0 v. I' h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% g4 b# Q( w+ R* x
- *& w$ J( Y, ?0 d" ]. o
- * This program is free software; you can redistribute it and/or
! t9 \5 V7 q( D, m - * modify it under the terms of the GNU General Public License as, d- n$ z" _' l- h3 t
- * published by the Free Software Foundation version 2.
8 m" T) B/ k% v% C - ** ?; w- J( y. O4 f$ b$ T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& z# E+ }3 N0 [, v
- * kind, whether express or implied; without even the implied warranty' q5 @& X& S( o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! } J) c, B& n8 Q
- * GNU General Public License for more details.
( l4 G; I0 R) |. W - */
: f" M- z8 w& [ - $ w6 }4 S( c( X3 W$ t9 d/ L
- #include <linux/module.h>
- M0 M/ J% F, [1 P- l& @ - #include <linux/init.h>
; S9 U" m' Q0 c0 N2 \4 c - #include <linux/errno.h>8 W3 L1 k: r. Y
- #include <linux/types.h>4 n) \$ u# I* y s8 O2 p3 G* g6 x8 l
- #include <linux/interrupt.h>
# z) [1 s* B8 ~8 g, O - #include <asm/io.h>. M, J( `! b ]
- #include <linux/moduleparam.h>
0 c2 I) N" ]+ Y - #include <linux/sysctl.h>
@! D" ]) x2 t0 ` - #include <linux/mm.h>
% Y3 s. `1 P7 J" L3 o - #include <linux/dma-mapping.h>. D9 E$ k' {+ \/ s5 q! m0 s2 v
- 5 O) z( X) n1 J
- #include <mach/memory.h># X8 z7 `! R& G" `
- #include <mach/hardware.h>
3 R! u+ o% g$ H7 t7 x, U - #include <mach/irqs.h>8 T; k; u6 {; d! Y
- #include <asm/hardware/edma.h>
" x. @. _ o$ Z+ q
0 B) _( s+ P+ O/ w1 S6 K- #undef EDMA3_DEBUG
; y" L: o6 G8 R5 _5 R4 z( ^ - /*#define EDMA3_DEBUG*/
# E4 g s" Y" {- q/ S0 o7 _8 R9 j - |$ G% Z! e1 m# g
- #ifdef EDMA3_DEBUG6 t7 N# V8 }2 B) A; P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) |# F! z. e4 o# `! \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 C& ~8 i4 T* `0 b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- ]3 U9 A4 ?+ q - #else- o& o) W B6 W( v1 t2 y
- #define DMA_PRINTK( x... ), ^4 {' M! C2 ]( T+ z' \
- #define DMA_FN_IN! E- W; `' b" x5 ]0 B( X4 K# n; N4 _
- #define DMA_FN_OUT
/ r6 Z8 n8 Y! u" n- _+ C. ~ - #endif
0 G3 e2 y5 e u/ b' t
9 q. G8 G3 S0 R6 R% b3 D0 G- #define MAX_DMA_TRANSFER_IN_BYTES (32768), P* J1 s) `& H9 M: F* N
- #define STATIC_SHIFT 3# L( ~' a9 t+ d' p# f u
- #define TCINTEN_SHIFT 20
/ E! u5 x* I- z9 M" l1 {; Y( C$ e - #define ITCINTEN_SHIFT 21; V/ P9 f: j3 B. r8 n) \2 g% M
- #define TCCHEN_SHIFT 22
* T$ b% w1 R: s: I7 j/ Z - #define ITCCHEN_SHIFT 23
/ O4 ~! D7 M. U/ z8 s/ V1 k% ~ - , t; e a) W3 M& q7 s
- static volatile int irqraised1 = 0;
+ i# e- Q. n) X% m* W4 b1 H - static volatile int irqraised2 = 0;6 l% q2 w4 w, {2 w% ]8 W) H/ ^. t
- 7 p6 y! J# L4 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ c. k# c( @9 w' S& g, s, ]0 X. A* H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 J; F, \/ X, g5 [% n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! p3 Y! b4 j' P' d
* `; z! _8 E7 ^- dma_addr_t dmaphyssrc1 = 0;7 i8 T& O+ N3 b
- dma_addr_t dmaphyssrc2 = 0;2 f/ S! g* t' o6 t
- dma_addr_t dmaphysdest1 = 0;" o0 E, _- l5 w/ }# u0 f' f
- dma_addr_t dmaphysdest2 = 0;+ ?+ c, {4 Y" v
- 2 q( u! H. c! N; J( _
- char *dmabufsrc1 = NULL; s0 s1 d' V! W6 p, s9 S8 W$ a$ E/ t
- char *dmabufsrc2 = NULL;
" j. x3 l' @7 Q9 Y - char *dmabufdest1 = NULL;6 i3 ~! _' J& s% G3 }
- char *dmabufdest2 = NULL;
( }! d0 U$ k' X: B - ' D. O& N$ u7 M0 T9 `1 u
- static int acnt = 512;7 f8 K1 u! j3 W2 Y% c! g( ?
- static int bcnt = 8;/ X6 `4 o9 J0 D* p" L3 p) o& C
- static int ccnt = 8;2 T3 i4 M$ N# K4 N8 F1 T5 v
# j% }/ ]9 q+ ]/ G5 P2 M- module_param(acnt, int, S_IRUGO);
; L7 O+ Z! Z% ~/ B4 X - module_param(bcnt, int, S_IRUGO);' ]) g, i A- [+ q' c: b9 D) U; B
- module_param(ccnt, int, S_IRUGO);
复制代码
5 K3 m; M2 Z' A j: A* h" m0 D& V, p P' n! T5 m8 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ N3 K: R; ?; K( X* t; S, A. P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 j% k$ U- _( t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( ~1 U( V+ R/ X" U8 V
# L# g, h2 s0 v2 X% k1 v+ _* h3 A" m; G* c& y3 ]
|
|