|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
c: D; p7 }. q* |+ O$ L- [code]EDMA sample test application9 h3 e+ f0 B5 {+ m* O) C L
- /*
# y" Y1 A+ B: C. G - * edma_test.c" `: n# X( e/ n' a' D) @
- *
* |$ {4 v$ C% y1 T5 O - * brief EDMA3 Test Application. _) ?/ ~: T9 o' a3 f- y
- *% u$ t' [ y) \/ O; F3 c p
- * This file contains EDMA3 Test code." W9 D. e0 K* ^- A1 i6 j# Y5 P/ w
- *9 E6 e/ D G9 }4 N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 I) `$ Z2 a1 M3 T/ x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& ]1 V. z4 _( C6 J4 I
- * TO CHANGE., I# K5 F r6 q$ c: W# L' s- ?
- *
2 [3 U: {( e3 ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" | T ~7 j4 G# w! }6 g& N
- *
, a+ A3 b( ]: D# }: J! d - * This program is free software; you can redistribute it and/or) W3 O, X2 x: C" F
- * modify it under the terms of the GNU General Public License as
; N2 r& N9 {' }5 _; h) w5 S - * published by the Free Software Foundation version 2.
, L2 n: o9 `. u$ b - *
7 m! l; {/ d% P: U) N, S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 \8 m* h- d1 V# f/ E3 b - * kind, whether express or implied; without even the implied warranty+ h8 G! L2 T3 t1 \% E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ i0 K0 O- q4 @ v! x
- * GNU General Public License for more details.8 s6 m4 {8 Z* b$ ~
- */
! W9 f5 w4 N# z2 q
/ G! n$ z' i8 \# Q* |- #include <linux/module.h>
) C2 H- {3 n$ T5 o- l1 A- K$ U - #include <linux/init.h>
! L8 b# Z4 g( R6 X" Y' q - #include <linux/errno.h>
: a+ n0 ~$ ?3 ^1 i - #include <linux/types.h>
2 h6 C% t4 m% b - #include <linux/interrupt.h>
, U8 G. B' P3 j - #include <asm/io.h>7 s& F/ m2 Z0 t% g/ j. l+ A
- #include <linux/moduleparam.h>0 g8 ?/ O# B4 E; W& F; S
- #include <linux/sysctl.h>
n5 g! Z S1 U' B' E! G - #include <linux/mm.h>. f* \# n G- K
- #include <linux/dma-mapping.h>
/ V( _6 o% d& v0 U9 n- r# c( A w
6 m8 H7 N+ F% f! F- #include <mach/memory.h>
2 k4 U J3 q+ f9 ^ - #include <mach/hardware.h>" A x5 X% w4 Y! ]) {/ D3 d0 l
- #include <mach/irqs.h>6 h( J5 U) I) O2 u+ C. w/ O$ W
- #include <asm/hardware/edma.h>
7 k6 ~; \6 G6 `5 [% r
4 O: \7 Q0 {% D/ [# }- #undef EDMA3_DEBUG
5 x. a2 z0 ^% f - /*#define EDMA3_DEBUG*/2 f7 G9 B8 x: g0 G
- ' u* _; a; c/ f4 f
- #ifdef EDMA3_DEBUG* W" A! v. o3 ~. `( Z1 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) S& Z% v* l# H2 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 O4 G* E0 w- E" c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) T, ~# `* d" Y6 x* u- I/ C
- #else
" f3 u6 j, C& A' {) _$ x: N - #define DMA_PRINTK( x... )
W% L7 k; n" Q - #define DMA_FN_IN
; y9 x6 ~$ @0 s9 m( `* m8 W: k7 F) D - #define DMA_FN_OUT
8 V& w+ C- y% a2 w5 @9 S - #endif! I2 U/ J1 s5 E
- P9 H ^ Y% [) ~# [) Z; U: E+ W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 y" t8 z& H7 z( S& s - #define STATIC_SHIFT 32 X; `1 t q+ ]$ n; O
- #define TCINTEN_SHIFT 20) e' V9 o0 e9 c* P
- #define ITCINTEN_SHIFT 216 C" p# L) n$ u: q
- #define TCCHEN_SHIFT 22
q0 A3 q0 u5 N& F - #define ITCCHEN_SHIFT 23. p1 w5 z" C- t& a5 H9 L
- 0 S, l7 O1 T% j E* ]" v9 Z
- static volatile int irqraised1 = 0;
) L+ L- K7 O5 {/ I% j) Y6 g1 [4 @ - static volatile int irqraised2 = 0;
# n% o# n2 B# Z8 t& D$ [
! k Y* ?7 Z+ X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 D) t4 f; F1 k [/ g6 M# T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* C5 \8 C; V/ [7 E* W( K- i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- I4 O$ A8 S8 L# S
- / i7 T( m# j2 [( r, f/ l3 Z5 }
- dma_addr_t dmaphyssrc1 = 0;
' X. p9 I& k" I+ [) _ - dma_addr_t dmaphyssrc2 = 0;0 Z3 U2 L8 U; Q+ f
- dma_addr_t dmaphysdest1 = 0;
0 r9 @" c9 M& G/ V1 ~1 D. b2 Q$ @ - dma_addr_t dmaphysdest2 = 0;
5 P: m! e9 G4 z - 6 f* A/ y: E1 P( d, {' ~" v
- char *dmabufsrc1 = NULL;1 j3 W- z" w3 J4 L! y9 g
- char *dmabufsrc2 = NULL;4 f$ V! h) ?' ^5 m3 r
- char *dmabufdest1 = NULL;. `2 z/ ]0 ?5 i) g3 X
- char *dmabufdest2 = NULL;# ^1 M9 ~' a1 v3 @1 {5 D$ R
- 8 y" Z ]$ q7 S; B* Z5 F
- static int acnt = 512;- b/ u$ m3 j9 {% K& C
- static int bcnt = 8;
: F' Q: I5 n! F, ? - static int ccnt = 8;
1 J( r1 ~1 `4 E" o3 c - # H( q0 W% l i6 _ I
- module_param(acnt, int, S_IRUGO);
2 L0 ?( c, \% y2 _( X5 U, M/ f - module_param(bcnt, int, S_IRUGO);8 H/ I7 M" R V4 h& P
- module_param(ccnt, int, S_IRUGO);
复制代码
& _. C9 \' u0 d0 X# E0 E
* S" @# ~* G& X! U3 y) r& r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. ~& f; K2 A2 G( y- W6 H/ o& s/ Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( h- n+ F: v. d3 J; `- y( S7 R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" L/ C5 p. O) A. h1 f" T, ]9 }6 L, }6 M6 v0 v/ W
F' s' w) S; e |
|