|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& O/ C" r% L; l1 z0 Y3 \- [code]EDMA sample test application1 d! k) [* M( L% ^' {( h0 G( ?
- /*' _5 h6 ]3 `2 V
- * edma_test.c: P$ |$ v: d% { x6 F
- *
; K! D+ T$ S1 b2 C2 `" W( ?- O4 U - * brief EDMA3 Test Application* I' ?% e) m+ X; _# s1 G
- *
, ]+ U$ F+ }- w - * This file contains EDMA3 Test code.# d: m) G; ]8 }9 L, }+ r9 P
- *
% i; @. [7 O! P! k1 A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% w* G5 n/ W. Q9 `3 H) o/ F: K+ H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ V2 k9 @, ?5 H# [5 d5 A - * TO CHANGE.
2 t& P% l9 D$ c - *
7 C1 r: B% g, K+ V8 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) W/ E. @7 j1 G) f8 a) r, o
- *& s- ]. O: Q, E, F0 k' `/ t
- * This program is free software; you can redistribute it and/or
1 Y0 v5 y h5 A0 \% F' d" i4 k - * modify it under the terms of the GNU General Public License as( e: W4 E5 ?5 B: ^: O
- * published by the Free Software Foundation version 2.7 d0 o( F( U3 V& \1 A: r
- *, R& e" z* m8 e# p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. v2 U0 Z5 D9 [8 h
- * kind, whether express or implied; without even the implied warranty
6 c. H4 y* Q6 G. M/ j" ~9 W0 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 g" ~6 N: p4 q# Y - * GNU General Public License for more details.' d3 P( v# J6 x" A0 S+ M/ r
- */& e8 ~' r0 b8 w. O
" g8 j9 J& q3 w( }- #include <linux/module.h>
9 r: t9 e$ K% I! {# _$ R - #include <linux/init.h>
/ o7 N s& O5 s: X% M% C8 e - #include <linux/errno.h>* d3 P9 N& y# Z
- #include <linux/types.h>! B+ O. |6 y8 ]4 u) l
- #include <linux/interrupt.h>6 `( F" u+ ^/ o4 K. j' k7 x
- #include <asm/io.h>; x4 E8 p" Q% s' `7 C1 Y& G
- #include <linux/moduleparam.h># \! X4 M+ M2 M' w" `
- #include <linux/sysctl.h>
# }* _; ~6 P7 A X6 q- ]& r/ C - #include <linux/mm.h>: ?0 L- K8 L& Q) v
- #include <linux/dma-mapping.h>
! x7 N/ t- k" Z* A9 z# F- o+ A" _
1 e$ \2 x1 r2 `- #include <mach/memory.h>3 k9 ]5 s# @) G( N6 A" G# k
- #include <mach/hardware.h># ?' }1 E t: J
- #include <mach/irqs.h>; C$ F) G b" N# x, ^1 g
- #include <asm/hardware/edma.h>
1 m, T' R; V4 |; p2 L - 6 Y- q4 i; d0 T1 w
- #undef EDMA3_DEBUG& a" q* C( ?. K7 {# o9 r
- /*#define EDMA3_DEBUG*// w* ]8 p7 F3 z
- ; i6 ?& o. I' y q4 y1 M5 O% w
- #ifdef EDMA3_DEBUG, ^2 _4 _/ A( }4 a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! }' j1 t# v" h, J) T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ u3 c% q6 n+ a- ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; P. F3 D) A {* x1 v0 N5 z - #else( i# Y0 }: |# ` D w0 p$ |
- #define DMA_PRINTK( x... )
# }3 h5 t% [: }9 _& @0 U: C( u! N - #define DMA_FN_IN
& c' D7 B4 A ~( T8 Y" `* s% ` - #define DMA_FN_OUT7 F4 B e) {3 b
- #endif
7 r4 u' ]2 E* Z. E7 x4 [2 f: [, |
( m: ^& _( \& q3 Q/ S. u- #define MAX_DMA_TRANSFER_IN_BYTES (32768), U9 y1 v+ c9 [5 W
- #define STATIC_SHIFT 3
, w$ f' Z; w- G8 d - #define TCINTEN_SHIFT 20, P5 z0 l$ s) |8 o" J |& e4 F$ M
- #define ITCINTEN_SHIFT 21/ V: u1 z. m3 S
- #define TCCHEN_SHIFT 22
5 w. J4 x A& Z' ^: F - #define ITCCHEN_SHIFT 23
9 A7 G& i$ l8 y( r: G1 [
: _6 b! x+ A/ R! o; `( }$ A1 G- static volatile int irqraised1 = 0;
2 _: O2 D4 p" F - static volatile int irqraised2 = 0;
, I9 |6 ~" ]7 L, g: @0 A
7 Y! J, I4 R5 c& f7 D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 k' {$ j) {: B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) H) c: g: v# b( A2 D! E0 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) \' l7 E! _" y8 g
- 8 q/ T4 Z( T- M. h" }: M9 `
- dma_addr_t dmaphyssrc1 = 0;
3 {7 e/ z$ E/ n, x: ` - dma_addr_t dmaphyssrc2 = 0;
+ k' e7 O% o8 t7 Q% e8 p$ J# s- ^ - dma_addr_t dmaphysdest1 = 0;
+ F8 d* O; W$ s8 F9 ` - dma_addr_t dmaphysdest2 = 0;
2 i2 ]# O9 g. `$ K* C7 R
0 p( Q& X& v9 m8 J+ R# V2 |) C- char *dmabufsrc1 = NULL;
" \2 l/ y- j5 j: J5 B* d- O2 ^( c - char *dmabufsrc2 = NULL;9 L, P* P6 D* h4 }( |( }
- char *dmabufdest1 = NULL;
5 K& R4 I% @7 {, W0 ~ - char *dmabufdest2 = NULL;
+ A6 j3 k! R* ?6 N/ ` - - z: g' v+ C T
- static int acnt = 512;
# G9 N/ W4 w2 B, \ - static int bcnt = 8;0 O+ j8 W0 s2 Y* s) `
- static int ccnt = 8;1 }/ C! O) p9 m0 h5 J* y, {
- 9 O2 y$ ~6 g B: \9 e+ t' Q
- module_param(acnt, int, S_IRUGO);6 H* v" `7 ]. ~3 }. I, m
- module_param(bcnt, int, S_IRUGO);
! p0 H: ?3 O6 Z2 x# I - module_param(ccnt, int, S_IRUGO);
复制代码
1 A8 ^$ }3 Z8 K( E" `8 I( P6 j! v- U1 h- \7 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, y: N5 u ^% F! [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- Q6 B% N8 m( |. K4 O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. k* D1 K/ A! V4 o
% ? |0 B/ h" J0 ^+ a
: R. ]; e0 |' Y0 x |
|