|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ t9 l& ^4 F) [1 L, w- [code]EDMA sample test application# W+ X# W2 ]8 i; X! c
- /*
& o) [7 ~' f7 ?. a/ w3 m - * edma_test.c, ~& N7 F3 u3 a3 A) p
- *
' o2 i8 e7 [9 D7 ` - * brief EDMA3 Test Application
* G) x" O; G5 [# ] ]* q - *
2 u7 D) ^+ X. J - * This file contains EDMA3 Test code.4 w" \6 T) P* K1 a; S; J0 `
- * g1 e: R) l0 {* o' b! v- Q' @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. O+ r4 h4 `/ P' \" }6 Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( v s3 m- `/ r - * TO CHANGE.
& [+ y8 O: c8 H: R5 W3 n1 I3 \ - *; Q7 u6 L% V) f# \; ~- a3 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. a# {* B* N: X: K$ q5 r
- *- q$ r" P3 \ z7 v/ h
- * This program is free software; you can redistribute it and/or, Z8 U" |8 q/ h0 y: _
- * modify it under the terms of the GNU General Public License as1 E! I# F" ?6 @1 G, k/ t
- * published by the Free Software Foundation version 2.' ^3 y1 _$ N- P1 G2 C
- *4 h7 f* D J2 l/ P% x' I( Q3 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 d9 o* B6 U. T) l - * kind, whether express or implied; without even the implied warranty
; j! d- \& @! E' I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c3 k U* f, n. _2 \, l6 G/ W1 M - * GNU General Public License for more details.
3 u+ E* C: a4 z - */6 y L c9 [6 ?, d9 s7 J
+ M+ Z( I3 z' m& |- p; @( w) I/ V- #include <linux/module.h>
" L# I% r* R; _; W - #include <linux/init.h>
# k% h8 t# u; i- L - #include <linux/errno.h>) m% {9 v e" ]& M3 c X$ s
- #include <linux/types.h>+ u8 Q3 C- K ^$ ^+ e" I: s
- #include <linux/interrupt.h>% d" ^3 {& d, r4 k
- #include <asm/io.h>
* [+ Y0 S3 e9 j- P - #include <linux/moduleparam.h>" {# ?( [) Y0 }3 S- B9 c, _
- #include <linux/sysctl.h>: n x$ p7 g% y5 J- p/ m
- #include <linux/mm.h>
7 t4 c {" ^4 g - #include <linux/dma-mapping.h>1 |5 o& k: E" Q. U. X9 l. W
- * n- D h% Y% q; Y, ]
- #include <mach/memory.h>* U# y3 ~; I2 H# u
- #include <mach/hardware.h>
7 C6 {. v/ \# J5 N& J# ]$ q3 s$ ]& R - #include <mach/irqs.h>
" w7 J9 ?& V& @% ~' X0 O - #include <asm/hardware/edma.h>5 X. v) W: ?+ s0 Z8 ^4 Q+ a" v" R
, p/ c5 l* \1 p) V2 Z0 f0 j4 d3 L7 @8 D- #undef EDMA3_DEBUG$ Z4 l4 f; u( c' G: Z- B
- /*#define EDMA3_DEBUG*/
2 z" }0 b3 Q* j4 Z$ j- V/ Z
5 `9 N: h+ A+ Y$ F! S a- #ifdef EDMA3_DEBUG2 O4 _, b; | \0 z0 N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% W/ ^# S3 S H( U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* x( R2 g" {8 m) V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 j( l: X7 w0 T8 u; a8 V - #else
1 n6 m v k+ A# D$ w- M - #define DMA_PRINTK( x... )
1 L, M" }0 }9 h2 W; a - #define DMA_FN_IN {( p1 V# j H" Y) V" ^
- #define DMA_FN_OUT
* z0 F: m& P8 i! v - #endif& W- R) F3 ~- f) v3 Q2 `
- f) C3 t. S2 g5 A4 }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ u. r$ V5 M- o( K6 E& `% ?6 t# z
- #define STATIC_SHIFT 3
1 M3 ?/ S' A- ]! U4 a6 K9 y - #define TCINTEN_SHIFT 20
! I* A4 J( x3 E+ m4 |- |* M% j) Q - #define ITCINTEN_SHIFT 21
. V3 I$ m: y2 O1 B# W - #define TCCHEN_SHIFT 228 G8 b4 S- g& {# U
- #define ITCCHEN_SHIFT 23
- F* m, q2 {. E& L/ P - 8 @* [7 h2 t5 m& f, K+ U* ?& V
- static volatile int irqraised1 = 0;
. I8 b! [( ~' W - static volatile int irqraised2 = 0;
; F+ I1 h0 P n d, a - $ K/ ~! w$ r% A S2 a! E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 N. K! U/ u2 b2 ^( W" K" ^# \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 ]* @$ T8 A: t3 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 s+ B! U' p* W% v5 w - . B& ?+ d6 F) ?" V. a" B
- dma_addr_t dmaphyssrc1 = 0;8 o8 u4 l! z9 _. D) B
- dma_addr_t dmaphyssrc2 = 0;) S4 u' W, T+ C
- dma_addr_t dmaphysdest1 = 0;
. P& ^- E9 Y% a/ T! g3 K - dma_addr_t dmaphysdest2 = 0;
- Y8 a4 m3 d# O- z - - u2 }& X8 _. Y4 E
- char *dmabufsrc1 = NULL;( r2 O7 z% ~4 D5 I# q" T" x5 d
- char *dmabufsrc2 = NULL;
. T3 r) n8 M; v$ ^+ x - char *dmabufdest1 = NULL;! ^, b& b& o" R/ u7 j
- char *dmabufdest2 = NULL;1 y2 m& E9 c. |% S- O( M( q
5 \# X e: R5 n( o+ _. Y7 t1 y- static int acnt = 512;
+ z9 Z# K) ?3 z8 D" i* R - static int bcnt = 8;3 p9 k, b5 Q! B& p6 d% X* |
- static int ccnt = 8;9 \4 c, D3 N+ i2 z- A( w
3 R& _& B3 v. m" ~- module_param(acnt, int, S_IRUGO);
, ]3 l7 R1 v N" D; U$ | - module_param(bcnt, int, S_IRUGO);4 U& j& N$ j1 t" T. r! {$ U
- module_param(ccnt, int, S_IRUGO);
复制代码
6 d' b3 o8 R K' q& o8 N, Q2 E
% p% J8 W+ N- w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 m/ r; O( T' R0 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- X% d+ s/ N1 ~+ `( R v4 F7 l& Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 l: f2 l6 z! m- D4 m
. t- F9 S, Q6 h4 J. T$ h
0 G4 F3 B& d! |2 L4 s
|
|