|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ G7 \& y5 ]) \; h, i; H8 a* D/ K- [code]EDMA sample test application! N( o. e! H# \) W- S* S1 ~7 n3 i) o
- /*% L+ X2 X* f8 }9 U9 ?8 d- f
- * edma_test.c
5 h$ A( ]- O9 Y2 T' ` - *
8 L& p3 D+ k% m0 I - * brief EDMA3 Test Application
5 |' K' q1 G q3 b" ?/ v% B - *
( N( Z* s3 S; L% [: h% ~ - * This file contains EDMA3 Test code.
/ e& z4 ~: O; S3 A3 l, b j - *
8 C$ Q9 S1 U5 c7 V9 S8 e& x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' v# J0 j0 [+ P, i" a3 I: P% w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. m- \/ j K9 `! J( [5 P7 Z+ c - * TO CHANGE.1 Z2 S. B$ y5 h' r( z
- *4 p; T" P: V& C# B2 D3 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 U5 x1 t) @9 z - *
, j" h( ?7 b! H$ r, K3 b - * This program is free software; you can redistribute it and/or( k( Q- f; O! H$ u) P7 d
- * modify it under the terms of the GNU General Public License as3 ~! r* E3 w/ N- n, g8 l
- * published by the Free Software Foundation version 2.
2 u, M9 C4 v/ N# r0 w# p0 u - *0 a% J. s& T% B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 z. z9 u6 F6 |# R2 s# ], B3 b) O - * kind, whether express or implied; without even the implied warranty
8 U" O: P; O" c+ T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( v5 g) A" K+ k$ d
- * GNU General Public License for more details.
1 ~/ y* W8 Z3 R" m - */. m* T2 I" K/ p5 x
- " r" a1 I; ^) f) @7 R/ Z( d
- #include <linux/module.h>
0 A8 W- W7 d4 E2 Q8 {" h - #include <linux/init.h># H7 U: A1 `8 w4 U. @8 ], P
- #include <linux/errno.h>' i. t0 M- @" a4 Z8 X
- #include <linux/types.h>( }0 h$ s5 d, o2 ^) T0 I) m
- #include <linux/interrupt.h>
8 P% W- O7 {7 Y# s7 o0 E3 x - #include <asm/io.h>. H( m1 d9 t$ X1 T2 i( h. v6 j
- #include <linux/moduleparam.h>. `# }- {3 i& u. C# t6 [
- #include <linux/sysctl.h>
5 K% Z+ u! s0 X - #include <linux/mm.h>
9 @+ f" l3 k. _6 x& X. B6 | - #include <linux/dma-mapping.h>
* w u$ {: j1 C# o; p' A
0 R( g" U5 C) B- #include <mach/memory.h>
/ S# @# }8 r% r! L1 _ - #include <mach/hardware.h>
% O! W" P! A5 P: l5 T - #include <mach/irqs.h>
: e, ^: m8 h' u6 p7 ~) P - #include <asm/hardware/edma.h>% P2 Q- d4 j9 M/ t
R. `/ j% d, a: ` U- #undef EDMA3_DEBUG
; X2 M) W% Q5 S: T2 `6 q5 r% R - /*#define EDMA3_DEBUG*/
5 \: D* d3 |0 m$ V! F, D" T( u - 1 _% \( T* q0 }
- #ifdef EDMA3_DEBUG
$ C3 s% u4 P/ N, D2 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: W- G) M* i) k2 b, x' {, g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& q' P+ e3 Z. \, G. C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
n$ l- n( e( d H; S# D2 ]- e - #else
; {+ J- R9 T5 I) l$ M - #define DMA_PRINTK( x... )
' {9 k; G6 a1 ~* R5 z) ~ - #define DMA_FN_IN# d; \* b' S; ^' x1 ^& b7 V0 ?
- #define DMA_FN_OUT
+ l7 n: ~1 L* y* ?# _( F. h! g4 c - #endif! s0 r& A$ Z% q" n+ X1 P) j, f
+ C- G$ Y& `$ g6 A8 e8 \' A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 N# k6 [- {" J7 b( ~ J2 N - #define STATIC_SHIFT 32 A$ U# n$ U, m. _
- #define TCINTEN_SHIFT 20
* D* l- }4 J6 `0 V% c - #define ITCINTEN_SHIFT 21
: [5 W0 r E) A1 H2 q8 b9 V0 u - #define TCCHEN_SHIFT 22
: d3 j9 @3 _' c9 ] - #define ITCCHEN_SHIFT 234 S7 [% ] I1 { T! \
$ {- p" a0 v. u# u- static volatile int irqraised1 = 0; K( i- V. U/ C' [- A a c
- static volatile int irqraised2 = 0;
$ j5 o0 K5 q0 L- Q3 T, P - 5 K+ X0 H3 y3 h R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
J: O( r4 o8 B: V( W8 g a q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
c# W" D# t; m5 G% M; z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) A+ |& `$ k5 s" l2 v4 f% [ O
6 R4 H& y( X7 N7 q5 N' V; u- dma_addr_t dmaphyssrc1 = 0;
0 h7 E' \4 X$ @2 c$ P# O% `7 W - dma_addr_t dmaphyssrc2 = 0;7 P' d8 u8 Q# z% O+ g
- dma_addr_t dmaphysdest1 = 0;/ Z5 @) i5 }2 ^- c; _5 P! O4 `
- dma_addr_t dmaphysdest2 = 0;
. T9 D) {/ Y1 b/ |1 I
! e r2 w7 G0 @2 x/ s# w K- char *dmabufsrc1 = NULL;) R6 E5 i9 _0 T8 Z$ ~* [
- char *dmabufsrc2 = NULL;$ s7 Z8 v" V; P* m8 O9 Q5 B( R! U
- char *dmabufdest1 = NULL;
* d# F& H9 J6 [$ J4 k - char *dmabufdest2 = NULL;4 @& a7 t! i) R# z3 P% E
- - q' v6 [" ^; I1 |2 L/ o' u
- static int acnt = 512;1 W( Q4 ]" {6 N3 B( D7 l
- static int bcnt = 8;
1 T8 I; s3 u, e w9 \# X+ c - static int ccnt = 8; m* R4 e1 [) q' G0 ]! B% x
! ]0 A( L: Y) J9 w' p7 W H. Y8 o- module_param(acnt, int, S_IRUGO);- Q2 n: ]3 B* r& ]8 \+ R0 g$ i h
- module_param(bcnt, int, S_IRUGO);
3 P+ O' ?: \% } @4 j - module_param(ccnt, int, S_IRUGO);
复制代码
6 L: y* }1 v$ q. l; n/ U, T0 _2 s' @/ y4 l& J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% W) V5 \/ Y% r9 M6 R* oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, f$ b. e4 `6 C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; o2 f9 M. Y1 R3 s+ O" u5 |2 Y
2 f- ?( C- S5 P+ u: \/ c! D4 }' C$ ? Y
|
|