|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. {( ]! Z2 \" Q1 H+ z! `6 p- [code]EDMA sample test application& a# @* X/ U N) B0 N5 }
- /*
; N. _' Y& J9 E - * edma_test.c4 _% A% z: m# X9 z- i+ ]+ E) [# }
- *2 K$ L1 T; f5 D% X$ ~* o
- * brief EDMA3 Test Application5 Q7 W, f4 H6 }: ?/ @
- *
/ N5 Y% z7 G5 Z2 c - * This file contains EDMA3 Test code.2 z: \8 v$ I( ^: v$ e
- *# U0 g2 \3 f6 D7 t1 I6 a' B) W" E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) ~* N1 G6 d- {; I3 D# ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! \( E$ \+ ]6 t! i1 w - * TO CHANGE.. u8 l2 ~/ k. Q6 d: L4 G
- ** @- @7 a( ]$ f0 \2 ?/ U# A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 D3 `) ?; O- m, ` - *2 {) E, Z% M& L& j
- * This program is free software; you can redistribute it and/or
( k/ z Q# V% @ M- e - * modify it under the terms of the GNU General Public License as1 c3 Q" g1 W7 C8 Q; e
- * published by the Free Software Foundation version 2., ?5 Y f7 a% c) d) Y, r
- *- Z( S7 e5 Q1 s, Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 A" a6 |; `7 z, L; @- o6 ^
- * kind, whether express or implied; without even the implied warranty. w" z" ~5 K+ ~, j, g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 R9 |3 b- N9 W/ r2 g$ [ - * GNU General Public License for more details.' H7 m0 a( n5 b" P8 f; Z# ?
- */
" h$ \0 r- w# ?2 @. u" }) g/ p
, o! N. s. S: J- #include <linux/module.h>2 z9 X: i1 Q: n# A! f+ L" R
- #include <linux/init.h>
% S+ O+ H" T. ~; o. I9 Z+ } v - #include <linux/errno.h>
4 I3 W; G. G1 M$ T4 q9 ~: _3 W - #include <linux/types.h>
+ r, L+ ^- X& H6 g2 `: E0 J I2 I - #include <linux/interrupt.h>" ]" v2 C* n) J2 b2 ^% q* p
- #include <asm/io.h>
' q6 \5 Z$ F2 w: S7 ~. F+ N4 P - #include <linux/moduleparam.h>
. m- I3 R& X! r6 x& ] J - #include <linux/sysctl.h>
& M* x: C1 P6 k6 v - #include <linux/mm.h>
6 T7 I" p% m( Q/ H7 a: Q1 U - #include <linux/dma-mapping.h>0 E9 N+ X3 A7 s/ J& X
/ o0 `- l9 F, [7 D- #include <mach/memory.h>9 `) r; G' A$ G; K0 r0 T
- #include <mach/hardware.h>
. D$ j, f1 J. G9 |5 w% [8 ~: U - #include <mach/irqs.h>, O. A7 s; G8 a! ^! a$ \
- #include <asm/hardware/edma.h> c& \5 |3 n- ?
- # W5 K3 z$ f7 {. L; ]4 X7 d8 `6 t
- #undef EDMA3_DEBUG
7 k) t: a: S7 ]+ w9 _/ s - /*#define EDMA3_DEBUG*/
/ P7 K j1 ] ~ - * v. n, l- N5 F! U( Y
- #ifdef EDMA3_DEBUG6 ?. K. r4 N8 e# L6 ?5 C4 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 s/ n( P/ i* O* H1 e0 ?1 }3 V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. x- E& t. t7 A$ [* e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 m% k) q2 [" Z/ Y - #else4 F; ]) [; C ]- K$ k! T
- #define DMA_PRINTK( x... )0 ~4 i0 u1 _% }* b
- #define DMA_FN_IN
9 S( b9 c+ e, U7 b" Y8 ]2 q( A - #define DMA_FN_OUT, d- |, z& A/ e2 A& D
- #endif- X) B( Y2 r2 n0 p8 q z
+ i' J O! N: m) _ G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# r+ H9 U3 p) f( z6 ` W: f
- #define STATIC_SHIFT 3! U! A& _8 _" x" ^! q
- #define TCINTEN_SHIFT 20+ J" A/ s/ K# ]: W$ t- j
- #define ITCINTEN_SHIFT 210 v6 F. B- g8 e# k+ S" b3 Q
- #define TCCHEN_SHIFT 22
, C. {) s& O2 j, }/ { - #define ITCCHEN_SHIFT 23
! L# _, y, X% t" }: J. q
8 q# [! Z% V" B; K: J8 ~% _' [8 e- static volatile int irqraised1 = 0;. e2 q5 }# n3 ^# D0 c3 E5 J
- static volatile int irqraised2 = 0;
/ n3 k2 {0 k' \) W/ `" t - 3 @9 E9 G: Q/ D- U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ u- R w9 P5 y3 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! O6 F$ I. [- |6 a$ [% C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ J# w( Y) ^& H& S - 1 w" j; a2 ]2 p2 q& r
- dma_addr_t dmaphyssrc1 = 0;6 M" R& ]- J, h* ?
- dma_addr_t dmaphyssrc2 = 0;
0 K0 g A. m' K) Y" U4 X6 r9 F - dma_addr_t dmaphysdest1 = 0;1 u; p$ f) o- u9 f) ~ h
- dma_addr_t dmaphysdest2 = 0;
; C) c; S5 y5 c3 {- s - 2 h$ m* e* J& K* X% J( m3 a
- char *dmabufsrc1 = NULL;
- X2 ^2 J5 ^. q7 G: n - char *dmabufsrc2 = NULL;
3 c* B; q) K5 a( [# j/ i - char *dmabufdest1 = NULL;
z& V1 H" }1 k, O, v9 ? - char *dmabufdest2 = NULL;
* _; j. F& N. |5 ]9 F
! @1 N$ |& V j4 c. ~, G- static int acnt = 512;
* }/ b- e0 X" Y - static int bcnt = 8;# z. D. H& G1 T+ K# o; f
- static int ccnt = 8;
! X( { l3 c# v+ ]5 t- F) @ - ( F4 n7 d, b D7 J4 A0 w/ j
- module_param(acnt, int, S_IRUGO);1 k0 y! I7 A& j6 a. G# R' u
- module_param(bcnt, int, S_IRUGO);
; X% X8 A: m8 }% @ j: g9 ] - module_param(ccnt, int, S_IRUGO);
复制代码 + Q- r" F" B) x2 E$ J9 l
7 N! D. p8 W8 p: d2 Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% u3 e X- T6 \/ s7 O6 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 B7 N, m* v% `; b! Z8 C" E: e8 {4 U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# v* |7 S9 _( U( |# Q3 o/ ?, H1 d* Z0 g6 @+ C: x, `1 Q
9 P9 p3 X1 Z w8 c5 v |
|