|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; l* M' C i; Q& T# B. r7 e o- [code]EDMA sample test application" Y! B1 M) {: L! ? i
- /*$ P; @2 Z" y. O8 r* f
- * edma_test.c5 o$ {) {$ x; r8 M
- *4 J9 ]+ I2 H6 [ K# P a+ F' b
- * brief EDMA3 Test Application
0 D6 s/ _- L- E& I6 q) V' \( x$ z - *5 |8 }8 f' n5 D3 G% I
- * This file contains EDMA3 Test code.: s/ m9 s9 p5 }
- *
; ? N/ p8 |* P0 S+ V, _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 c+ `/ i9 m3 L* N8 Q3 q+ v1 A! N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 X7 G, S K- _$ m% J; ]! `
- * TO CHANGE." t( E* _. S8 ^
- *
- [6 ~( L @2 s' W% E { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 I4 A* A) @# k' ]# j - *
3 ^. T/ x2 U0 M' X5 z# n - * This program is free software; you can redistribute it and/or! d, S# M# _% X5 P; A% u N
- * modify it under the terms of the GNU General Public License as6 J7 @& @; H# V( i
- * published by the Free Software Foundation version 2. M" b" }( l- ?& `: m1 Q. Y3 }# \! Q$ T
- *4 E) }& x/ h& J8 j$ @3 U; I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 I* o: d, Y: p - * kind, whether express or implied; without even the implied warranty( P7 _6 }& C" ]! i" ~* B9 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. b% W9 A7 R' V* l3 d - * GNU General Public License for more details., {; V7 d5 S% Z, }; A4 `
- */& D( N; P) K" x1 \8 i
- $ H. W7 V+ m# ?- J5 w' b8 ?
- #include <linux/module.h>
; s0 a8 j% _1 W j - #include <linux/init.h>
! c6 S" P9 a: k/ J9 v# O6 F9 ` - #include <linux/errno.h>
[4 @; C6 ] O' [7 J$ D - #include <linux/types.h>; K1 p% a& [* |' c Y+ [
- #include <linux/interrupt.h>( F _# S0 D! X3 X/ z6 v6 O5 t; y
- #include <asm/io.h>
7 b- o0 x: W& h - #include <linux/moduleparam.h>1 Z% C9 V) l' o
- #include <linux/sysctl.h>
, t6 W) \; h% T% v - #include <linux/mm.h>& R, e4 W% i8 o0 G8 a2 F. ?0 a7 \) X
- #include <linux/dma-mapping.h>
6 t1 s9 w8 ]( e; y7 a - . B% k9 L4 c: ^ m% }! g2 m
- #include <mach/memory.h>
1 M: c/ z3 E+ X( B" [1 q4 G - #include <mach/hardware.h>
7 @) Q: Q! P% ?0 y- `/ j( R - #include <mach/irqs.h>
5 K8 v5 u2 B' q" M; t! v w - #include <asm/hardware/edma.h>2 G' \; s$ P1 s
+ `# c8 Z: S& g8 ?0 W/ \) n F- #undef EDMA3_DEBUG4 B; n9 F* `. S. j$ z3 Z
- /*#define EDMA3_DEBUG*/
( t" }" D: J9 J5 D' R' o
+ D, O- M1 e3 _% d' j9 I& r- #ifdef EDMA3_DEBUG
4 B5 s, \; [6 T+ l* f. L& |4 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 e H: n7 F ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% X( \% y1 A3 q2 n! Y; d# K# L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ N5 j5 b6 Y: b: Y - #else& j- q+ i% _8 `: S9 w- M' p
- #define DMA_PRINTK( x... )
. I) l7 o: N( J$ c& w/ p( B3 K - #define DMA_FN_IN$ F# ?' \- p5 G0 O5 J
- #define DMA_FN_OUT
, j/ {4 G3 i; D2 F8 C - #endif
' u$ H$ {7 v; e* Z6 F* _ - + P* g% ~% b7 ?, H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 Q( j' c/ z7 w0 [$ J8 X - #define STATIC_SHIFT 3
7 }& i) U% T* O% d+ ?( `- [ - #define TCINTEN_SHIFT 200 H6 l- h% H& r. X
- #define ITCINTEN_SHIFT 219 T; s. p3 i9 X; z7 c
- #define TCCHEN_SHIFT 22; e6 R4 ?8 n* B4 Z5 q
- #define ITCCHEN_SHIFT 23
6 i& S& Z! E: ?$ @! V - ) j9 X6 j3 q2 | s% L
- static volatile int irqraised1 = 0;
% V8 }9 o# x0 w' O- G - static volatile int irqraised2 = 0;8 t, o+ M% m0 R' s) z
2 _9 v7 W# J$ _* g/ Q0 G. _% w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( L0 @) e3 Y: T% _+ f7 o& ~& j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ~ }, g# W2 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ }: C @! n7 ~" E" _+ o! `$ b0 E
6 u, F& D& }6 {2 m) V H: G- dma_addr_t dmaphyssrc1 = 0;
+ e. l% J( A2 K8 b8 d% L8 i - dma_addr_t dmaphyssrc2 = 0;
$ }4 ^6 a( t9 X/ n7 Y5 T - dma_addr_t dmaphysdest1 = 0;
& R0 @# e- O$ ~1 v& E - dma_addr_t dmaphysdest2 = 0;3 B5 A' K( j! V- T. d" Z6 ?- T
! B& d3 o0 z- l" @: A- char *dmabufsrc1 = NULL;
; v5 G9 m Z7 C( y3 w5 b - char *dmabufsrc2 = NULL;2 [* J2 S" p: Y
- char *dmabufdest1 = NULL;
; X3 i; e9 ?7 y" b$ T - char *dmabufdest2 = NULL;# ?' @+ l" ^5 |1 h
. Z2 @4 e9 y+ ]* D+ G; V- static int acnt = 512;
& ?& l8 B- A4 Q# C, i - static int bcnt = 8;
- R k4 N: J' g) } - static int ccnt = 8;
8 }: \1 {# V. r8 D2 P9 k
1 p# H" v8 \! H& @0 v5 m- module_param(acnt, int, S_IRUGO); x) I6 l$ w4 T+ w& U7 X/ i" b
- module_param(bcnt, int, S_IRUGO);$ b1 b+ x! O1 { v y
- module_param(ccnt, int, S_IRUGO);
复制代码
. K4 g! z6 }1 X/ q" J5 [7 J2 t1 a/ i0 t3 o# z3 i9 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 K% g! F( u% H/ z: Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' v5 i! I4 A: s8 J/ K! d/ \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ?4 F2 S' [( t: I% E
0 [$ {- \" C8 \3 p0 ]- F* o' K# u! E) V$ V# }8 `3 n% u
|
|