|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ q4 m0 h; g- w- E8 P" D: {
- [code]EDMA sample test application& r' z, h, l- ], G% j
- /*$ s" [7 `' U% M$ y* ~
- * edma_test.c
% e" B v( X0 v, l3 z e - *
! I ^* P& Z( J - * brief EDMA3 Test Application$ G( ^0 g! n( t0 ~, R8 v( K0 H w
- *7 h0 A1 V- X2 r4 L
- * This file contains EDMA3 Test code.
* L) G8 e- @' Y$ D - *
0 X( j8 h& i& P" @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ w! \ t" h7 B, F0 M2 Y8 m* l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, i; S) _% ?4 j' Q
- * TO CHANGE./ d/ D$ e& i; Q' @+ P" |
- *, k& t8 {' c; ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' i' [" ^+ t& y1 t+ U - *
; V: S6 C# [7 s# n% B6 U7 u1 ]" Y - * This program is free software; you can redistribute it and/or
; W/ k q7 l' s! K# B - * modify it under the terms of the GNU General Public License as# P$ x O; q1 `7 H& }- V5 q
- * published by the Free Software Foundation version 2.
3 c8 K# | w8 ?/ X4 v - *3 @" U* I9 Q3 G7 j7 ~% {5 l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 L9 {2 \. \+ k: i
- * kind, whether express or implied; without even the implied warranty
; Z8 r& U, d' B, J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& m' g8 M# E$ G9 \
- * GNU General Public License for more details.. v [! v/ v& e3 O
- */: ]0 j# X5 E4 r$ ~8 b! B
- * L$ Q: [# S! k* |- K1 }
- #include <linux/module.h>
3 }. @& Q( ]3 U1 v3 S6 y - #include <linux/init.h>6 o" ~5 [; a* ]: C9 C: h# c
- #include <linux/errno.h>: I9 Y9 N+ F. e% C( d
- #include <linux/types.h>7 K/ J$ [4 T$ @" `2 `
- #include <linux/interrupt.h>6 U. z- D* I5 _8 |: k7 m: u
- #include <asm/io.h>! Y9 R; Y6 c" ^$ {+ [) _3 x- o
- #include <linux/moduleparam.h>
; O& ^4 M, L. z2 E a9 ^8 [8 N - #include <linux/sysctl.h>% O9 |3 L7 @( Y9 j" @, q. X
- #include <linux/mm.h>+ c$ @; P! D' L3 V$ t
- #include <linux/dma-mapping.h>+ A+ L& F! D5 u+ W. j* z
' ^% B" J7 S6 a- #include <mach/memory.h>7 G5 C! N9 E! I$ K' ~* a
- #include <mach/hardware.h>' {( y3 x& V6 _ ^
- #include <mach/irqs.h>
E6 {. M# `6 M9 D( {0 | - #include <asm/hardware/edma.h>
, g. x% A# h3 B W- h+ G
" x/ e0 E9 o) B0 ]9 r+ a5 h0 E6 \( w- #undef EDMA3_DEBUG" R8 {2 x# q' K; |' k- @
- /*#define EDMA3_DEBUG*/ {/ x; K4 T8 g
$ Y6 t3 }- H, r; Y5 S4 c- #ifdef EDMA3_DEBUG- x' y$ A' m x& A& Q% R6 m9 v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 _: E1 O) E4 A; D7 ?! S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 M- C" c7 T3 N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 E+ v _4 w" }5 Z* a4 \ - #else% W" z& W- Z- a- u
- #define DMA_PRINTK( x... )9 F$ S) D: ` G9 B
- #define DMA_FN_IN9 j1 k9 ^# ]3 ?4 t- K
- #define DMA_FN_OUT, P; c; O1 _+ {& ^9 o5 W% {/ M
- #endif
& v7 _% E. D/ V3 U2 @. f+ A
7 }! g+ H+ `9 E( Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! D+ F3 q7 c4 v! {8 r2 G - #define STATIC_SHIFT 3
- ~2 B; d1 w& }( E7 z1 |1 j0 C6 M" \ - #define TCINTEN_SHIFT 20
9 e! e1 Y: O* [' H - #define ITCINTEN_SHIFT 21, j. A2 o+ P& `% M c
- #define TCCHEN_SHIFT 22! j9 f: V0 Y0 w: q% A6 Y
- #define ITCCHEN_SHIFT 234 k6 b0 [5 F" }% \8 {1 y
0 W( C$ R6 [4 b; g: Q6 `8 c5 A/ `- static volatile int irqraised1 = 0;
% \" c* [% a2 {6 r+ B8 f3 H - static volatile int irqraised2 = 0;
5 r( u1 t& h! k: @
5 y* e o7 W& Y$ W% V& m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 I; F& c6 ]! Y. u2 G; w' v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- t o8 j# S7 `7 w3 T# S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
N1 t2 R0 I# ? N. s# y1 Q
7 |. c1 m0 v* T4 c1 S& ]- dma_addr_t dmaphyssrc1 = 0;
6 l0 v) `0 M9 A$ ~ - dma_addr_t dmaphyssrc2 = 0;
5 d5 v P/ d$ Q8 T7 S - dma_addr_t dmaphysdest1 = 0;/ ^5 {8 g% w4 k- r$ o
- dma_addr_t dmaphysdest2 = 0;3 b: _+ u0 |# o
- ' H! s. U! W! Q% T9 w; Y
- char *dmabufsrc1 = NULL;" c; t3 V1 |3 S: A2 s+ Y
- char *dmabufsrc2 = NULL;0 O4 }. P$ S5 r9 Q0 a. B) W: V6 T/ M
- char *dmabufdest1 = NULL;( S. T# w V6 d, @
- char *dmabufdest2 = NULL;/ K- q6 c: K" E* U4 U( A
- ) q3 t& a: L0 S
- static int acnt = 512;
6 G8 O: \ ^' V) q; A+ G' d - static int bcnt = 8;
: [; [4 E: u1 h8 y3 E - static int ccnt = 8;) o; N9 ^1 g/ a
) a' }( L) ^* r% w: ~. d- module_param(acnt, int, S_IRUGO);
7 V4 |' U$ `* I } - module_param(bcnt, int, S_IRUGO);! B' w/ E+ v. n2 ?" D
- module_param(ccnt, int, S_IRUGO);
复制代码
. N4 k& g% ?9 ?$ {& O0 Y& @4 {+ U1 u* O. U9 j4 x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 u' B' ?8 C. _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 v1 j& W5 L+ A) p7 t2 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ a, X9 G0 [, W2 |, f* O- j
* B1 P8 ]6 t/ v+ W3 X
/ D" e7 K% [. J z6 @* y9 X! y- O |
|