|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 Q: ?& l @9 X- [code]EDMA sample test application9 y t# k( i' I7 I% h$ o
- /*, I3 w; [7 X2 {& v, P( |
- * edma_test.c
+ h, Z, w) e( R0 K6 } - *: f& E) W0 ^2 y# q5 A
- * brief EDMA3 Test Application* I- C& T, Z) L8 A$ z1 a
- *' l) S1 ]* s7 q
- * This file contains EDMA3 Test code.) q5 a* o( d8 O5 M
- *
! Q% i% @5 }5 P& a" C" c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 r: v+ d/ U. @# b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 c6 g: e; g: Z3 ?1 h
- * TO CHANGE.( B& b/ V# p2 B5 G+ a- |
- *( ]; `+ V) c4 g, t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ J! e/ W5 l! j1 D; L+ A) B - *, s* o% o; x( L; ]5 `+ @
- * This program is free software; you can redistribute it and/or
' @( V5 {) X0 \3 J7 F% I3 B2 U) ]% o" I - * modify it under the terms of the GNU General Public License as$ {& h9 s% F# t4 Y$ J* M
- * published by the Free Software Foundation version 2.
% K0 k, X) g' k; `8 s0 t) ]1 Q - *
6 m ?; k1 |1 V% q3 t- P# C* d1 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' q$ ^3 j. ]4 Q5 H - * kind, whether express or implied; without even the implied warranty7 g& c, x" h0 o+ |" X; v+ T) ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 Y+ D# g- o% @" {2 i/ H1 e - * GNU General Public License for more details.- Z8 S5 h) X* V4 j
- */+ K* o' ^' V4 u# d' Z* ]& B
- 2 l: p9 r( Z3 D+ J
- #include <linux/module.h>8 o4 I% h4 `: i5 _
- #include <linux/init.h>7 f( s |* l+ M8 l
- #include <linux/errno.h>; L6 M6 v( x u! f
- #include <linux/types.h>/ I+ g: ~7 g' F8 y6 m$ u) @& K
- #include <linux/interrupt.h>
! j3 [' S b5 _1 _" Z$ y+ ~ - #include <asm/io.h>
/ ^2 D/ M6 n/ a; r+ L - #include <linux/moduleparam.h>
8 l3 h5 F& u. R+ v' X( q - #include <linux/sysctl.h>
* A4 Y q4 c& H1 s" N7 i& e - #include <linux/mm.h>* Q' a) @" }6 L% G/ p# o3 ? _5 X2 o+ A
- #include <linux/dma-mapping.h>" E% u( t2 Z- ^
- + {5 P2 `* K, P
- #include <mach/memory.h>: p' S, F: ?0 l9 C
- #include <mach/hardware.h>
! Z& F6 n' i i9 c - #include <mach/irqs.h>
" T: [8 R* x) {3 x4 @ - #include <asm/hardware/edma.h>- x8 e! D0 n+ M. {4 R
- c/ D0 t- R5 N5 x* H- D. M5 N
- #undef EDMA3_DEBUG$ x$ [& X. u0 c! Z# t
- /*#define EDMA3_DEBUG*/- i, G' Y9 V9 g" Y
+ p" A% H, H9 B. N$ M) c- #ifdef EDMA3_DEBUG: Z9 D' S* S3 S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 T; M1 q, c( q0 Z1 V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" |! @# e+ f9 y$ }( M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. |& o2 w* k& n% ]) x - #else, @7 {- N4 ?) F% E: N+ Q' E. s
- #define DMA_PRINTK( x... )9 D+ k* d* ?! M
- #define DMA_FN_IN0 H$ c8 x/ H g4 @1 `6 V
- #define DMA_FN_OUT/ Q( Y" ?# O o* t8 n
- #endif
& q/ o* @$ D6 y; |, F
: ]7 z+ Y' ^4 Q8 |$ ?2 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% n1 A0 t, u" L& @9 g. d - #define STATIC_SHIFT 3/ U. Y9 L3 l* I5 b5 d5 r3 f
- #define TCINTEN_SHIFT 20/ Q6 t& }6 o& _& j) Z
- #define ITCINTEN_SHIFT 21
- m d3 g6 s5 [ n$ u6 ^# o - #define TCCHEN_SHIFT 229 e2 }0 w/ Z5 Y# i/ `
- #define ITCCHEN_SHIFT 23
* K9 X" I2 N( ]2 d2 u( L( U - 0 r1 X/ [9 n6 C" g1 X: D9 \
- static volatile int irqraised1 = 0;
; `' W- e* k- A4 t8 G }* l$ u, L - static volatile int irqraised2 = 0;: h0 G. z7 L, G7 H9 K% {
- 2 {/ M- z+ P* [7 u! @- M$ }" J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s P8 f0 g- }, k7 e! e2 ]5 ?( L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 U$ y- z. y M) V% B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); c9 ^2 P& y) D+ `
- . O" o; ~5 u9 x- g; p4 ? A1 K( e
- dma_addr_t dmaphyssrc1 = 0;
6 \1 W* ]3 s) F2 p' R - dma_addr_t dmaphyssrc2 = 0;8 ?3 { x; T; r# c6 v6 F
- dma_addr_t dmaphysdest1 = 0;
# ~# r3 p4 Z% Z3 w& C( `2 y - dma_addr_t dmaphysdest2 = 0;4 {% n6 q. E7 ^4 j5 R0 z
- # ]+ D1 A: \8 @
- char *dmabufsrc1 = NULL;
1 U2 c3 d' f* R/ m- O. \3 z# |% q - char *dmabufsrc2 = NULL;
2 Z- o O5 G6 d9 s0 y5 [, e - char *dmabufdest1 = NULL;; r- e: u/ I! J B8 M
- char *dmabufdest2 = NULL;, X! @3 S5 [! ^
2 d6 v) v. U, K0 v+ w1 S8 x5 Q- static int acnt = 512;9 D. U0 V( u6 D O
- static int bcnt = 8;
4 A D( [$ a% n0 j" N: M - static int ccnt = 8;8 q% F! Q; P4 l& P |$ ]
& R+ R0 `' {8 Z" t" h- module_param(acnt, int, S_IRUGO);/ B! h- C8 x* \* r
- module_param(bcnt, int, S_IRUGO);
4 X1 @; d7 h' T k - module_param(ccnt, int, S_IRUGO);
复制代码
( Y3 B4 p+ M6 z3 V+ l( G7 E1 s* d# D
9 ]9 X4 M3 H" G. s" e$ } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' b' b- V, d& s: r y+ Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* u5 \# E0 h; U% T( z" m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: H) ~6 I' z f; l
, c. [' C" c# G3 \' F& q& [. U# v' B
! I) q7 C# S) y2 U/ ] o4 z- S# s# s |
|