|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 b4 w% [( @; g& D# L# L+ r* [- [code]EDMA sample test application
f, n' c) t4 X - /*
9 O0 _% ~/ B6 [& U- d% m6 V - * edma_test.c
, |# U9 }) |9 @ - *
; e; l" N# X- Q! W - * brief EDMA3 Test Application! Z5 S/ S: S8 A K2 L' F1 N# {2 S
- *1 ]) n2 K7 ^$ R ~& }
- * This file contains EDMA3 Test code.) N# U' s: a2 C' M
- *
% D8 a* I' g4 e2 y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 A" T" c c3 F7 {4 z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 t( a/ g' L0 b# S- W! L
- * TO CHANGE.$ y! Q |; [% _0 ?
- *- L4 {: }" U) m0 K' q7 e! V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, C8 f& ^, X$ P" c3 _; z - *
" a/ f/ a+ } P - * This program is free software; you can redistribute it and/or7 p+ w2 v2 i2 X0 G% s7 I
- * modify it under the terms of the GNU General Public License as) z7 k( Z* C+ J% K7 v) q0 _
- * published by the Free Software Foundation version 2.
$ n4 y$ ?9 `0 S7 |. g - *
* f4 u+ L$ @% o4 j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* _4 R7 c4 S) v6 y9 k/ e - * kind, whether express or implied; without even the implied warranty% X$ i3 o1 T! J6 [9 m) n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, o6 d$ a C: v6 b: d - * GNU General Public License for more details.
( ~9 s: ]# R8 ?1 N# [ - */
' R: Q$ i6 N# [
! o# @+ H5 t9 }- #include <linux/module.h>
: }8 L; s! u# W% ~ - #include <linux/init.h>
; k$ X& X+ J6 B1 J$ p+ x9 ] - #include <linux/errno.h>" c3 W& n. P1 M4 y3 F
- #include <linux/types.h>
9 F. l2 ^. W W' x/ d6 N: I# u; Z - #include <linux/interrupt.h>, }$ ~. v3 @% b- X. V! f! k+ V; V
- #include <asm/io.h>
5 _1 l) k; r6 t, g5 H - #include <linux/moduleparam.h>3 u& ]/ `! t# `5 S7 [: K
- #include <linux/sysctl.h>. B3 G0 M$ y- D) w G
- #include <linux/mm.h>
. s6 `! T* L1 Y6 t - #include <linux/dma-mapping.h>
9 y4 o) F6 V3 I1 V; ?# z
; c9 o F, v- z# H. |- #include <mach/memory.h> f- Z( ?, A! H$ k, q/ ?, ^, L4 O$ x
- #include <mach/hardware.h>
: q. f8 S, K" x |" P3 J1 b - #include <mach/irqs.h>
0 I, @1 u3 g8 J- Q1 I) H% N - #include <asm/hardware/edma.h>
6 W, m/ p) a# @: Q- R
+ S, U# f7 D' t+ i9 D8 g. k- #undef EDMA3_DEBUG- n3 S3 t6 K) S- _/ G
- /*#define EDMA3_DEBUG*/
8 h* I7 R) ?% u+ Z a
. A- r1 N& j, H3 U- j o4 q- n- #ifdef EDMA3_DEBUG8 h' u A C4 k( _: w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* c# o4 O/ p0 K1 V ^6 ?6 g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# ^8 u* |6 h0 Q. y0 b. f u- R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 y- j7 q5 K+ e$ a/ M
- #else
$ Z% P ?4 U2 C3 u! j - #define DMA_PRINTK( x... )$ O' o: H( H# v K& c
- #define DMA_FN_IN9 g2 L% I% m2 v5 K( T# c
- #define DMA_FN_OUT( s# L) ]! E( h B; b* E
- #endif7 {' ~! l0 @5 `) _- }6 Q' S
- + \7 P- A( G: G8 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 w- ]4 o9 z! c: ]* a - #define STATIC_SHIFT 3
4 j4 o9 M8 X+ z c' W, R - #define TCINTEN_SHIFT 20 d1 F0 N+ X% C" y
- #define ITCINTEN_SHIFT 219 @. { a% i5 [ O% i/ y+ e
- #define TCCHEN_SHIFT 22: ^' d0 d( f" f# X
- #define ITCCHEN_SHIFT 232 l1 J7 K8 C5 h% T+ _
- - t6 v0 i- `9 G
- static volatile int irqraised1 = 0;# I# ~* A9 j- w' P2 k
- static volatile int irqraised2 = 0;
* v! {! e" c. T* a - 2 |- L2 X+ |6 S0 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {7 V+ I- q/ ~- e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ~! k+ v8 M0 q2 B% G% J t% `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 v4 d6 H) r9 @. W* b3 f - : w1 x4 E: B% D% ^! ^0 N( L- d8 m2 ?
- dma_addr_t dmaphyssrc1 = 0;
" ~$ s2 p( ~, g - dma_addr_t dmaphyssrc2 = 0;
& S8 g* G1 J+ @+ l# A- r - dma_addr_t dmaphysdest1 = 0;) Y6 O/ d8 ^/ y( b( j% P! R
- dma_addr_t dmaphysdest2 = 0;. p# |) N G5 o" X+ E# `8 ?; m
- + G. H- _, c0 K7 o( Q, h2 u. x
- char *dmabufsrc1 = NULL;. f7 U6 X5 f$ N$ O4 m2 o8 W
- char *dmabufsrc2 = NULL;
6 ]* m3 |4 F6 Z) z# J4 m* M - char *dmabufdest1 = NULL;3 f. M+ G. p% B* I9 L1 j
- char *dmabufdest2 = NULL;
# j/ N! Q+ Y3 l/ h9 P# |& v1 E Q
- A! j% T8 W* m- c- static int acnt = 512;
9 s! \3 e9 O; P - static int bcnt = 8;6 x: V* f7 V# `' x, k
- static int ccnt = 8; L" r+ s4 w! M6 X# ?+ h
- $ u2 w* j* Y" r6 X% |: q
- module_param(acnt, int, S_IRUGO);5 r: v2 e3 `/ Y, {7 t
- module_param(bcnt, int, S_IRUGO);
! @: D2 o) Q+ P; R9 U. w, \0 l/ G0 N - module_param(ccnt, int, S_IRUGO);
复制代码 E' _: B5 a M0 u% I' `6 B4 F: l
! A9 S- P% k0 `, c7 P7 V2 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. @9 E5 m: |) o3 x9 Y- I; {! z9 X a5 Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 Z! n+ w" [* ^" [: Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 A( V+ x8 H" O& i9 }) d: y
c4 R& [: k. z: i5 N- ?
$ B# y$ I" R8 [6 r3 R1 I |
|