|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: y: s4 f1 w% N- [code]EDMA sample test application# [& @; c2 y( {1 }8 ?3 ?
- /** W4 z" a: |/ Q8 c
- * edma_test.c4 Y3 S% Q) G6 S. B; j
- *, c% {/ i7 p5 f* W6 t2 J, o
- * brief EDMA3 Test Application2 r: Q/ \$ v2 q0 h, U% G- A
- *
/ [2 a0 _/ F( K% D: a: x, F) b+ o - * This file contains EDMA3 Test code.
6 J$ j2 `0 C! v5 L: Z% v - *
/ n' o1 b# U9 _! i9 ~. S# D3 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# Z V2 F1 Z8 |& n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT T$ k3 n+ F2 r- R4 G5 q; ]
- * TO CHANGE.
4 F6 F4 r. y6 O - *) X* _4 Y1 K6 z3 I; V8 N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 E# |5 P' x0 d7 ]0 C+ F - *
. c. ]6 m2 }; r& Z6 y% }* J- c - * This program is free software; you can redistribute it and/or
: ^3 @3 g; U$ W0 S8 J$ h7 Q5 V - * modify it under the terms of the GNU General Public License as
5 k' @$ C k* O% F - * published by the Free Software Foundation version 2.2 p4 b V) H. K
- *3 g# s1 o9 ~# e/ x+ r# u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' C, x7 @8 e4 D- _7 z' |
- * kind, whether express or implied; without even the implied warranty, \, t( y. Q1 j A9 t' ]. m8 e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, C% S3 N! O H! r0 H/ p; j
- * GNU General Public License for more details.
0 V1 |7 n0 P( W W. H/ ^" b - */
8 S$ u6 k# i# Y x& o9 @. ~- R9 o7 r - + N0 R! R2 \ Q( T; N
- #include <linux/module.h>
( M0 Q. P1 }2 }) @ - #include <linux/init.h>- ]7 ^7 L; L1 b F
- #include <linux/errno.h>: `5 b( k. g* i( m4 U7 s7 S
- #include <linux/types.h>2 F4 |) P5 \! {, l
- #include <linux/interrupt.h>. v1 j: \; B7 J# V& T
- #include <asm/io.h>4 J) \5 r! `# y- g* i* U
- #include <linux/moduleparam.h>; k& _0 M. q0 E6 P
- #include <linux/sysctl.h>
$ {; u6 H4 H" t( F9 z! e7 { - #include <linux/mm.h>6 V3 g8 u5 s: m8 e' K
- #include <linux/dma-mapping.h>
( a6 N9 Q0 m5 s. n: L$ q
$ |& W0 t/ |$ @! k- #include <mach/memory.h>" m$ f, C! \0 p5 a- K2 S
- #include <mach/hardware.h>
( c: e- E0 A& D - #include <mach/irqs.h>
4 x$ Q, _7 X" \* x4 b* {# e/ w5 M4 k! z# | - #include <asm/hardware/edma.h>- Q/ {3 q/ s) ^8 q
' b1 g8 S* k7 } [! z& F5 c/ q1 l* P- #undef EDMA3_DEBUG
( Y; q) h4 g* ]1 R - /*#define EDMA3_DEBUG*/
1 g1 H R! S5 h q# ~ \; Z
0 R) e( q" ~8 f& h- #ifdef EDMA3_DEBUG4 `; a5 ~: @8 b/ A: B1 M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 \, K& Q! N; H' Z% P, ~' H H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 c# S+ Y. M. X# I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 [& W H' @, _4 U4 g# A- X1 e - #else: i1 A2 [- N. c1 V1 m8 `
- #define DMA_PRINTK( x... )/ g9 Z' L" e) C6 A* d% X6 L3 s( a
- #define DMA_FN_IN1 ?2 A1 ?: F7 t1 e' F4 k+ H/ m* t. ^
- #define DMA_FN_OUT4 C S* l% y; @/ K7 y& S/ i
- #endif/ F2 ^0 s9 N% c
9 j- Z3 `8 g- k6 I6 k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' v) u, P# t& H8 a) z, K - #define STATIC_SHIFT 3
2 d7 i) [- E5 Z: v- Z - #define TCINTEN_SHIFT 20) I* ?$ L) P* F/ G, P2 H3 U0 V
- #define ITCINTEN_SHIFT 21* H2 N _' @: X4 U8 k3 ]
- #define TCCHEN_SHIFT 226 O) `% z* ?; |: q) _. B4 [# g
- #define ITCCHEN_SHIFT 23
/ H. A& Y$ c: O; s# F( X! a
6 H1 N5 X1 _8 w/ O% j. @& [# |4 N- static volatile int irqraised1 = 0;
: A1 t" s% ?6 _$ p, y7 f& w6 ~ - static volatile int irqraised2 = 0;
( }& U' k; r! d, C% ]" w: s) E - ) l4 g; n1 B) i) t( O- Q- j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 W6 _5 Y7 J8 V" b. z# G( d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 o P k4 a9 @5 E5 V! x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) p B2 K6 X$ x O6 m; w
n# y& f2 ^ @, C+ @# m$ s9 _- dma_addr_t dmaphyssrc1 = 0;
- i2 [5 o0 L3 u - dma_addr_t dmaphyssrc2 = 0;' e" I. P: F: _
- dma_addr_t dmaphysdest1 = 0;8 G; s& V' L. J1 S3 o# S" U
- dma_addr_t dmaphysdest2 = 0;: M- y Q- g: y4 T4 @) V; L9 R
- # N; k7 }1 l" S# y+ J3 `
- char *dmabufsrc1 = NULL;: U4 |& y% Y1 V, V% a
- char *dmabufsrc2 = NULL;' q! M, D- B) m. r: k
- char *dmabufdest1 = NULL;
( n8 e' Q- Z6 }3 M- I - char *dmabufdest2 = NULL;
& R; l7 Z( ?+ v9 F" l, u K
+ D7 Z2 T5 _9 n( a- static int acnt = 512;; L. y, h& J1 Z6 g% C8 x
- static int bcnt = 8;# T9 X; v1 r X8 X
- static int ccnt = 8;4 L3 A! L, v9 A2 |: Y
- ; M4 o$ {! ~& F) ~ ]: I+ j
- module_param(acnt, int, S_IRUGO);
2 l1 j* G3 N$ L: w" T - module_param(bcnt, int, S_IRUGO);* V7 J# {- v2 B; ]& s! y1 W
- module_param(ccnt, int, S_IRUGO);
复制代码
# z8 }/ ]6 g; h2 N6 S5 A- \% }3 g& ^( F5 p, Q7 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% R% T1 C! u# X: w5 t3 Iarm-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 m* {1 J2 a4 Z0 E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 |% T5 v/ S2 Z3 P
' K; {" t b2 @3 U- w8 o. e, Y5 z
. z$ a- H/ V/ y" G2 |8 a1 \
|
|