|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) E& C/ `8 {. J5 V% L9 e0 z; ?3 h- [code]EDMA sample test application2 e+ J/ r- Y- n
- /*
+ C. b: }% c( b& B& q- B X - * edma_test.c9 t2 g4 [0 c, m- U3 o- D7 `1 v
- *' ]/ D7 H7 e J0 C
- * brief EDMA3 Test Application
2 f }4 o. ^, K' ?4 T; G$ v - *
9 V' ~ j2 g! v - * This file contains EDMA3 Test code.
& Q" y0 C1 v$ \+ j - *
+ f5 Z2 e9 d' k& A- v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 n0 g, Z0 l: ~7 w' c: S+ p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ ?% a( O! O' D9 v) Y( b
- * TO CHANGE.( e& \& w/ t5 d
- *
[3 C# k V# H: f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' ?- o, R! Y) A/ I% ?6 s - *, q, a0 n' d' b. _# B
- * This program is free software; you can redistribute it and/or( z8 V( D- n: o4 Z4 j
- * modify it under the terms of the GNU General Public License as' p3 Z M% m, n( U& G9 ]; c
- * published by the Free Software Foundation version 2.
. |8 I/ T/ p& Q/ X( X8 Z- S' G. C - *" u/ _" K' t# E1 i3 l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ b) b8 o% }4 U; J8 h; ^ - * kind, whether express or implied; without even the implied warranty
: z9 g; v1 K+ ^( f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 f/ y0 B: F0 U! ^
- * GNU General Public License for more details.
) G/ K2 K4 w+ J0 V - */- }: P5 K4 P/ a v
* Q4 I- x) j+ j7 a. m. C! W- #include <linux/module.h>
* s' c1 `: h3 [0 N6 | - #include <linux/init.h>
- \) G! Z( s+ w% D. U' _! \ n - #include <linux/errno.h>
4 C0 d7 h6 }$ [ - #include <linux/types.h>, u$ F. m! h. x+ ^
- #include <linux/interrupt.h>1 k: |8 r1 M# C5 u8 g& Y
- #include <asm/io.h>( ~! e# U) `8 n2 q
- #include <linux/moduleparam.h>& Y5 {3 i ^' W" a7 x) T! u( u
- #include <linux/sysctl.h>
6 U" j" O$ T. F/ {0 K1 Y/ L - #include <linux/mm.h>( h% Y1 B5 _2 @" U* W0 c
- #include <linux/dma-mapping.h>
) @- W6 Q4 h' U" C - $ H! o2 a; J+ e0 I2 T4 D
- #include <mach/memory.h>5 V8 t" i) S5 w" k u
- #include <mach/hardware.h>6 C8 e6 e+ T% C: ~8 x N' d, ?, K. N
- #include <mach/irqs.h>
( R. k; @* q6 |- M - #include <asm/hardware/edma.h>
* A" M! d/ \6 z- m - " v, j, V7 l7 W; j
- #undef EDMA3_DEBUG' x: g, F7 y) Y& f
- /*#define EDMA3_DEBUG*/9 E3 _. x4 x9 c0 [
- 2 Z4 b, d; V$ f/ S! a( u) L
- #ifdef EDMA3_DEBUG
' |0 @/ ^, g9 } W# z* I5 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ `$ `: K4 J5 |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 U' @. u6 z. j1 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 k# y5 {) ~, ^7 B4 b - #else/ c' l% f, _& c6 Y9 ~8 ?8 }8 Q
- #define DMA_PRINTK( x... )
T' P) ^! g( `& E0 q% B9 z - #define DMA_FN_IN! e ^& g- j! B: |1 s6 I/ c$ G: d
- #define DMA_FN_OUT0 G+ k7 q) u. [' O
- #endif8 F4 ~6 d! b; P1 q
' x; z4 Z" A. c+ E7 o" W2 f1 N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 ?% g$ ^5 A: @( T, K" g* [$ V
- #define STATIC_SHIFT 3
0 t8 A. Y3 ]' @! k2 j - #define TCINTEN_SHIFT 20
2 d3 `* N W- M- C - #define ITCINTEN_SHIFT 21
/ c' T/ g5 D1 j8 Q; f a" g - #define TCCHEN_SHIFT 22
, j( X: M& P3 o - #define ITCCHEN_SHIFT 23
" V) [& b5 E. ]0 X1 b - 0 n5 r4 j- M) H
- static volatile int irqraised1 = 0;
$ T4 n8 ~0 l6 m; `0 k - static volatile int irqraised2 = 0;: e, H" B+ ?; e0 D! Y
4 e: ^" [# W, t4 H r" F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ ^5 K1 q1 I( x9 F, z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# A; I, I H6 E& }) W* _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# }% a8 |" R t* v9 c, y* j - ' v$ D/ F1 m+ F/ K ]
- dma_addr_t dmaphyssrc1 = 0;
% G3 l3 Z0 l% Y0 u" G7 X1 A - dma_addr_t dmaphyssrc2 = 0;
+ r+ k8 S N0 f ^; ] - dma_addr_t dmaphysdest1 = 0;
% S5 @7 |& n. q2 B! ~ - dma_addr_t dmaphysdest2 = 0;
& N, `1 g3 J; B$ ] - ) z4 e& K! E6 G0 e0 d& c
- char *dmabufsrc1 = NULL;+ ?4 p5 j; p( _. F1 R
- char *dmabufsrc2 = NULL;
( X" {; k4 ^$ e; U - char *dmabufdest1 = NULL;
6 c5 m4 y6 F7 j - char *dmabufdest2 = NULL;* B9 v5 _$ W9 s" K& A+ ^1 ?2 E* K- W# R
% @# Y+ \; ?; U% M# t( c; F. i- s9 H- static int acnt = 512;
; B' v" k. s6 c0 p - static int bcnt = 8;
5 w- a, H4 C) i" ~8 n6 T. E - static int ccnt = 8;
9 S% O4 y+ s1 A4 Y$ w# ` - 8 T# o+ \4 V7 ]- M" R( o: k
- module_param(acnt, int, S_IRUGO);' p0 |- a M% G# P( F: s- W
- module_param(bcnt, int, S_IRUGO);3 J, r5 }+ Y* X, o+ G$ f! d
- module_param(ccnt, int, S_IRUGO);
复制代码
0 n# d& Q" B9 t! T' H9 u
. m& Q- W) d' n8 e- L5 [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% _0 [+ v( E6 M: T: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. Y% |& N+ z* D2 ]$ ?2 y0 T6 ^: s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 K) O) A- }8 Z5 y f
, d- D+ Y8 T% m- N( y; ^: M) D+ s& r; s7 e
|
|