|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 N: w" V. f5 Z7 P& F- [code]EDMA sample test application/ X# k# ^ H. H$ B; z5 |% d' |
- /*
+ j' N+ _0 B4 G& G7 I C; r - * edma_test.c
# @. }. } {) x1 L# p5 G' z- ]# F6 o9 v - *6 }& ]9 [4 K4 F2 J
- * brief EDMA3 Test Application
0 V% G8 z/ ]) P9 Z5 C( ? - *# J% h7 d6 x; a: t3 I% ^
- * This file contains EDMA3 Test code.
7 z8 |8 J7 M' D' [7 D7 J - *
; t, L6 ?8 S& P3 m3 |. X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 h6 t+ y" y# j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ h! F! ~2 J( l) f) V. s: i6 j
- * TO CHANGE.
3 d) [2 d* v! c - *+ k& M. M' d' T2 N) Q' t" ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 f A4 ~; V. B9 S- B) W- t
- *8 g" }( x! e& I& N9 f$ `6 j
- * This program is free software; you can redistribute it and/or$ x5 X% I' v& ^# i, @8 k
- * modify it under the terms of the GNU General Public License as5 f( V( K) u( i9 f. [0 X
- * published by the Free Software Foundation version 2.
6 a0 @- {9 ^2 m - *
~' W$ n j* W- ~* S- Q7 U5 v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 S# L4 v. I K
- * kind, whether express or implied; without even the implied warranty
" ?7 V- U/ M- a1 E) G9 v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 B( Z9 A. j; Z2 @ N - * GNU General Public License for more details.: n8 Y8 U5 N" t4 P
- */9 h5 N; L6 }5 `
- 6 u3 J/ d n7 L( p2 J
- #include <linux/module.h>7 K! _+ ~2 F. K& V2 ^
- #include <linux/init.h>
# u9 \" ^2 z ~; D: h4 u& W- J - #include <linux/errno.h>
* d# I' d% X; _2 \7 s! @ - #include <linux/types.h>7 r/ g$ c2 z0 O# }: x/ \
- #include <linux/interrupt.h>1 o; f6 S) ^9 G1 k2 F5 s$ j% {
- #include <asm/io.h>
! `: F9 U4 ^; W% j - #include <linux/moduleparam.h>1 _# R% `+ W/ X; H) A
- #include <linux/sysctl.h>
. d+ @6 z5 A& |1 U6 L - #include <linux/mm.h>( v7 Z* z7 I5 {# e) \
- #include <linux/dma-mapping.h>
7 f. z# Q; d ? - 6 X y( B6 S& ]# r6 c# ^; K- j# w% \
- #include <mach/memory.h>
& J0 r: l" c4 ~# K$ i( V - #include <mach/hardware.h>
: E! M, \' A5 Z1 U - #include <mach/irqs.h>
+ s2 C0 k/ v4 d* C7 z$ Y( D - #include <asm/hardware/edma.h>9 f0 F! r$ a4 l9 C9 q1 d, n o
$ z0 Q2 D' L; }% n! M. K' g( f- #undef EDMA3_DEBUG0 y% d6 H/ w4 \, \6 E, f
- /*#define EDMA3_DEBUG*/
* }& w$ ?. X& J1 v5 v! ?& R( f5 v( o' D - 7 r/ G- `2 U% r6 n; L. V" P, R4 C( |4 x
- #ifdef EDMA3_DEBUG8 l3 O1 |' O5 R% t9 j8 V, O2 z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 p: U: ^6 T0 L Q3 `( @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: g' ?' I+ q" _+ d! Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' D# L0 n" R) M7 j' }# b" S - #else
. I" |- f. |% }2 [$ E# P - #define DMA_PRINTK( x... ); A7 V6 n( M1 P/ G0 L0 |; o
- #define DMA_FN_IN l- s7 o6 i9 k0 o( M* m4 F
- #define DMA_FN_OUT
2 _2 h' q7 R# d7 J& @' P - #endif9 S3 ^$ X; D$ O% n# U8 T
5 Z! R* G* k _2 P5 u4 ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768) z0 V8 r# k9 _# c5 e! K% c
- #define STATIC_SHIFT 3- Q+ r( A8 X1 Q2 U$ i7 o) [
- #define TCINTEN_SHIFT 20
3 u( e& \; m- H" p# J - #define ITCINTEN_SHIFT 21' d- s, ]4 n% v0 o
- #define TCCHEN_SHIFT 22
' y, K4 m4 {: V; F" e- D- R - #define ITCCHEN_SHIFT 23
' B1 U3 F& n) {* T, A% e+ ~* f - 2 C0 I/ ~! e: e! c8 n
- static volatile int irqraised1 = 0;
/ R' ]) N' M7 X/ }, P# r q0 V - static volatile int irqraised2 = 0;+ P" t5 K- `% Z5 P" m
- ' V9 b( _& R) g' b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" C* y( Z; C, D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 s+ M" {! a5 z6 A9 v Y4 T* d: L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" }2 c7 A" w' h+ L5 ? - 7 @& B# @& o3 s6 c8 o
- dma_addr_t dmaphyssrc1 = 0;1 a& V8 i I8 A: q6 \( p. _2 ]
- dma_addr_t dmaphyssrc2 = 0;
7 H6 Y% \1 u" M/ R - dma_addr_t dmaphysdest1 = 0;: W9 \, w. {8 e
- dma_addr_t dmaphysdest2 = 0;& Q; h2 Y: Y0 _% E% H
- \; c; ^" d& {) g3 i4 a
- char *dmabufsrc1 = NULL;6 }" L5 B. j w9 F+ f
- char *dmabufsrc2 = NULL;
3 @$ l, O1 W* u, J; ? - char *dmabufdest1 = NULL;# o, B5 X w, k A
- char *dmabufdest2 = NULL;
! f" q1 R& s9 F - * l! R: }7 v5 c' [
- static int acnt = 512;
) r+ j+ A# t9 w0 |4 j/ q4 v - static int bcnt = 8;
' O6 Q. y: e! E% [8 u R - static int ccnt = 8;" s: N7 j+ y6 Y$ ~# P$ j+ s. b
: M4 E( w/ ^7 d2 F1 j( C. J# \/ X; A- module_param(acnt, int, S_IRUGO);
, }% q) L. h$ v5 s0 W- J4 Y - module_param(bcnt, int, S_IRUGO);% `3 R* Q6 m( ~
- module_param(ccnt, int, S_IRUGO);
复制代码 3 X( z& M* c, y
' w0 E% @3 a0 } H' Q5 w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ H) ]% g2 `' m4 X. U7 D# ^" c) e
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; g( D' D9 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- }& e" i7 ]) G) s" B, E$ l2 {& u) U' J' m+ F) a
% i6 a+ X' b2 q% G, f4 N0 a
|
|