|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 U4 G" v* Y" c" C9 l) m
- [code]EDMA sample test application9 K9 d& R4 i w9 J. [
- /*( ?- A1 S1 I8 N
- * edma_test.c. {# h9 [* |( _; q, D% K& \# y8 F8 J
- *
* Q; Y; j9 d; g7 y M& a$ x/ ^/ } - * brief EDMA3 Test Application+ t& S" p; M, @ o' D) T6 d& q
- *. Q* k! V5 A7 C' }
- * This file contains EDMA3 Test code.
, g0 |- T1 i. i% N2 }9 E+ B9 I - *& w* I1 j: a. ^7 V0 \2 s5 R8 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 D$ f, r5 r, L5 I$ ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, l6 I0 J8 \& X1 J - * TO CHANGE.4 V, G. J* M! G6 Z8 z* q
- *
* i; X" y- ?7 h8 Z' f2 c2 X- s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; L, g6 q8 |9 ?" q
- *
' ~8 B% e3 h0 E9 i - * This program is free software; you can redistribute it and/or
3 |3 Q) M: q- k) {! z1 l - * modify it under the terms of the GNU General Public License as
" _! h# a' r5 ^, r8 p) A - * published by the Free Software Foundation version 2.
$ y1 g; X# s3 L9 \+ T6 r - *& k2 J" @" |! j$ R& `; k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( d) i5 T% i6 J8 K) l0 P
- * kind, whether express or implied; without even the implied warranty
$ K0 l# s6 C- d0 [: ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
O ~3 _0 }$ ^& M# ]5 H7 e - * GNU General Public License for more details.
# w% F" v' D2 @- k" b2 r9 R - */
! k0 S" B& w% A, @1 ?4 ^& [ S - 7 e) I& f" \% U7 @/ S
- #include <linux/module.h>
L1 S9 M" @4 e, t2 I7 \ - #include <linux/init.h>
B0 d! J( w4 u6 r2 Q - #include <linux/errno.h>8 H- b$ ], d9 P4 r; _5 @8 B% V! H( L
- #include <linux/types.h>
; l+ Q F* _9 m, Z8 }9 } - #include <linux/interrupt.h>& \/ S) P; s S- S" Q4 y& u# y |0 K# A
- #include <asm/io.h>
6 W8 g# d; D! T" u- w% D' K/ h - #include <linux/moduleparam.h>* f* H/ ]/ Q1 e# K" s
- #include <linux/sysctl.h>
# q. ?6 w. Z A6 ^0 [' q1 O, e - #include <linux/mm.h>
/ m2 p. w/ S* S) Q, u - #include <linux/dma-mapping.h>! [- h) P$ b* U5 z# u+ \
- 3 p& `0 ?9 ~& S8 ?
- #include <mach/memory.h>/ l2 E5 E8 m% w: a9 S
- #include <mach/hardware.h>
8 U& j" e- g! w# n1 Y - #include <mach/irqs.h>
, A: x! H) D8 A6 @! }$ T, v - #include <asm/hardware/edma.h>9 L8 n+ R# G$ ^9 b- K3 U
9 W2 }* T- t0 L- #undef EDMA3_DEBUG
/ a. e* g$ H |1 g |" R P8 ~7 {6 { - /*#define EDMA3_DEBUG*/; o; k" P' {0 ]! a
- $ i- y4 f. Y' q3 ], a4 |' r# [# t
- #ifdef EDMA3_DEBUG
4 k( @8 [6 N- R; G, f; [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) B1 s+ |4 c- ^& z. f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ D% ?( Z, `% L6 `% E# p: @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" t( R& i) W6 Q0 _- E4 c - #else
: N: \7 \8 R t1 R% O4 [' r - #define DMA_PRINTK( x... )
) k3 F# Y+ p. O4 V - #define DMA_FN_IN
+ @& C: j! F" F% ~, p% V+ [ - #define DMA_FN_OUT" ` [; B# |/ U P
- #endif+ [$ q: @* \2 N4 K( m/ v# |) {
- 4 c" U" j0 P% o9 Y, b+ ]/ G: f. V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) J5 l$ @5 `3 x+ d, O
- #define STATIC_SHIFT 3 x3 G4 F T' z Z* \
- #define TCINTEN_SHIFT 20; Y9 x: Z) P# v
- #define ITCINTEN_SHIFT 21( C( l' f7 i% V& D# j2 G& s
- #define TCCHEN_SHIFT 22$ d" A5 `: q+ i( s& e8 c L5 D
- #define ITCCHEN_SHIFT 23
, W. n m% I: c. A V& ]. f- t - 4 x. a* a6 t9 l% k& ?" G
- static volatile int irqraised1 = 0;
4 @, E$ |! P+ ~4 s& ? - static volatile int irqraised2 = 0;% L) O# k r5 \1 h; M4 m3 }
1 ?1 s/ O# v7 T# E0 O! Y; i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! L. a F1 v% B/ f ]! m: V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 } Y% h1 w2 p! q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 s! m1 [, u! N6 s. Z! Z/ X
+ i" K: K. a2 g+ J; U% i6 X Z- dma_addr_t dmaphyssrc1 = 0;/ ~# G& `, w! u& J
- dma_addr_t dmaphyssrc2 = 0;) Z' z. P6 A4 g8 R5 s6 Q
- dma_addr_t dmaphysdest1 = 0;
+ g6 I4 D( T. P9 f; b4 L - dma_addr_t dmaphysdest2 = 0; t5 D4 ?; C/ p
1 `# ^+ _! S* _. H! _2 T- char *dmabufsrc1 = NULL;4 ~# V8 W2 k+ t
- char *dmabufsrc2 = NULL;3 h3 @+ ^8 `0 \
- char *dmabufdest1 = NULL;
& k$ z1 T- H- T* r; V. p - char *dmabufdest2 = NULL;
+ ~# d9 Y, P( k2 q' k5 I6 K8 m- `' L6 \ - % J) z& }* N5 V$ U* `
- static int acnt = 512;
* t$ V/ }# Y) W6 Y9 u7 E - static int bcnt = 8;
' D2 `3 p+ J" w; @! [ - static int ccnt = 8;5 K# D+ I7 m& d. G% q
- 7 m$ M/ [) O% G, `2 ~
- module_param(acnt, int, S_IRUGO);
' O; q6 M* j+ i% U6 L3 U - module_param(bcnt, int, S_IRUGO);: G5 h8 ~6 c( R3 f. g! ?3 w i
- module_param(ccnt, int, S_IRUGO);
复制代码 : `* H+ D% \2 s3 \& P1 h
' T$ M5 ]4 F$ ~' w0 Z& c3 n" p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 X. J- f) O" p. _; [# {5 m0 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" j% `' X% p% y" q& p' ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& V% z- q1 o7 z
b* m0 z8 ?% z
: r' ^. g7 A/ [
|
|