|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* g8 d' l( W$ k2 O4 s6 h- [code]EDMA sample test application
% i1 B" l9 j/ q6 y$ } - /*
: `$ |, F4 @" L - * edma_test.c% P7 `% l2 i$ ?5 A( |8 C/ l- K
- *; J3 B. }, c \/ E' o
- * brief EDMA3 Test Application
3 u0 T. B% E. n% u3 W" _7 N - *
) M& q. K5 n/ ^/ f! x - * This file contains EDMA3 Test code.
4 s: u4 r% |2 S$ A - ** j9 w/ }" g7 F; M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! v1 Q# k7 p! S# @: J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 `8 |3 n! E ^( H/ G2 A4 z - * TO CHANGE.
- ]/ F7 {- z4 q$ P y0 p5 e& F% D, R - *
0 |0 n8 O+ O \- N0 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) I4 D$ S7 Q( J" {' D/ |
- *) W* z0 i3 B' m
- * This program is free software; you can redistribute it and/or
1 f! q. x% X- x - * modify it under the terms of the GNU General Public License as% M7 L% H5 U$ \' `7 k: B
- * published by the Free Software Foundation version 2.! Q8 W! k4 T4 d0 D; A& X x6 g
- *. H9 D% x( s* ^4 j5 S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 c0 a. V, s: }8 ^- R/ [4 } - * kind, whether express or implied; without even the implied warranty' Y+ q8 q4 E5 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& D( v4 Y, ]4 S2 M/ I# ]
- * GNU General Public License for more details.% S) g0 x% [' |: S1 p; m
- */( L, L X" L/ I9 {4 g
- : ?5 k* P5 H, a3 o6 n) d
- #include <linux/module.h>1 U, [* F& {: e5 x
- #include <linux/init.h>
' r0 h$ `/ C' f. x$ Q. C: I - #include <linux/errno.h>3 T3 T$ v S' ~: C- C; S1 C
- #include <linux/types.h># P: ]) ^6 p, U" z& O! ]6 R, n1 y
- #include <linux/interrupt.h>. \0 u0 Y) F/ T9 r/ y3 q& ^" o, S7 i% H
- #include <asm/io.h>
! j2 ~& ] h" \ s: Y# N: a4 z - #include <linux/moduleparam.h>
+ F8 u* b) s/ X8 X - #include <linux/sysctl.h>
% m# k! v6 {* S) `8 Q t - #include <linux/mm.h>
. D$ I3 g7 A' e4 [ - #include <linux/dma-mapping.h>3 i+ O5 Q. c. y2 G: W) h$ C
6 k5 d7 n# R+ ^/ {- #include <mach/memory.h>- b+ c3 I: i- y
- #include <mach/hardware.h># Z3 Q* c. p8 ^- U
- #include <mach/irqs.h>* J1 y6 q Y3 M, d
- #include <asm/hardware/edma.h>
. O) u0 @3 U p% C - 6 q' r0 K; C* \+ ^+ P3 ^) E4 N
- #undef EDMA3_DEBUG
4 e' L4 H# g; T5 d# b7 D - /*#define EDMA3_DEBUG*/
/ L: m, A# P! N3 i, e' ~ - N" `5 l& |7 _6 ^
- #ifdef EDMA3_DEBUG% D# a1 b/ I5 `9 ?3 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ _/ j5 a/ l2 w0 I9 }2 Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 ?! C( V3 U( z" f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ?+ N& Q! H; D- u
- #else2 y7 |0 S$ X0 b: r0 V: A
- #define DMA_PRINTK( x... )
8 X' o- X, w$ q5 T1 E1 M3 D0 g - #define DMA_FN_IN$ L# E( w K% c4 y8 e* m
- #define DMA_FN_OUT
. i( o6 f2 l9 R/ A9 \ - #endif
% Y+ j9 O/ m2 s8 y m - $ [! g( e4 D# S, B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% y/ D- p9 }" o
- #define STATIC_SHIFT 31 z/ ~( ^' c9 n" D# ?
- #define TCINTEN_SHIFT 20) Y* Z, D8 u7 z0 |3 Q
- #define ITCINTEN_SHIFT 21
' E, L; {) g3 u* d! p# ^ - #define TCCHEN_SHIFT 22
0 R# i1 M, X3 n D3 k. T& m - #define ITCCHEN_SHIFT 23
" X8 o6 S! U) c; ^: \1 m! b - 1 H) G8 [' B; N! w
- static volatile int irqraised1 = 0;
- z1 P! p' k1 t8 z4 Y( ?3 m - static volatile int irqraised2 = 0; E; \" g; s( x8 v5 c
& k& V k, C- t4 U% ~( Y* _9 X. _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! x7 Z- F& d4 P' @" ?+ b* s: F: ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& d# d. D% k2 w# Y8 P; d; ?; E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Z \! B$ a* K
0 a! _* b+ {$ w- dma_addr_t dmaphyssrc1 = 0;
0 U! [1 i# ]6 S- W/ S - dma_addr_t dmaphyssrc2 = 0;
, V7 ~# U7 G, D - dma_addr_t dmaphysdest1 = 0;! Q- H8 A5 V( c
- dma_addr_t dmaphysdest2 = 0;
. x `' u- }1 S. |( k0 [6 p% m
m+ V S4 e) [& T: [4 j& m0 x- char *dmabufsrc1 = NULL;. b% Y, [: D# G" _! i2 l6 J
- char *dmabufsrc2 = NULL;
3 o+ x( s" W6 a" i, W- ? - char *dmabufdest1 = NULL;
: X4 Y) ~! n1 Q6 z - char *dmabufdest2 = NULL;
6 q; ?9 H, l* K7 A0 z - 7 H2 p8 O; K7 j
- static int acnt = 512;
, \( J% V& r$ P) C - static int bcnt = 8;( W2 V; d4 T; L; i) [
- static int ccnt = 8;: A- G& j" f. y+ K, c, I
- 5 G3 n) G8 D, z: Q3 S+ s9 @& Z
- module_param(acnt, int, S_IRUGO);# ] y& y+ t0 w# G% W" {- L
- module_param(bcnt, int, S_IRUGO);% H7 I# q6 C: X/ d0 J: x3 x7 {
- module_param(ccnt, int, S_IRUGO);
复制代码
$ N8 q/ `, z! D& J7 `& ^6 S5 P s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 ]- R% v; @7 n, \- J; Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 s) R* B* A3 h: x5 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( j) v2 o; d8 g* q) `2 B' F. ]
$ C4 J! {! c8 _( m9 }! s6 m( t- H* U w
|
|