|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 S& T* G# L- J& L7 J; b- [code]EDMA sample test application7 H1 a& s( x4 n) W
- /*
2 l9 C4 o% s L" \6 a - * edma_test.c: ~% a" w/ n- ?5 j+ a& l+ o0 J
- *
% q. N+ x) m6 b; ]* K; P - * brief EDMA3 Test Application# J j% p" o# O' Q8 d
- ** D$ F: A, B i
- * This file contains EDMA3 Test code.
: ^7 `4 c! F5 z* ?4 X% o - *' E% W; X9 D4 M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: R2 S+ i: R3 ~% c0 T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 A' f4 |( u1 W9 Z; D4 V6 N - * TO CHANGE.
& X- e8 D6 j! A - *& C" n) I' m$ X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: T3 F# Z) x! A( s
- *( s& c, w9 t/ w j/ X
- * This program is free software; you can redistribute it and/or, n9 D4 g2 d2 S# N# s1 _
- * modify it under the terms of the GNU General Public License as
" E7 y; z9 Q9 h0 Y - * published by the Free Software Foundation version 2.
0 f4 }) U/ g X o, a% ^ - *
h% n$ @ k" S$ c6 D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& k5 |. n; \, O* H# L" ~2 U! n
- * kind, whether express or implied; without even the implied warranty8 E. w, z$ g0 z6 h4 P5 b' m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 {/ o0 z; S+ d! e
- * GNU General Public License for more details.
" h l! j4 |& Z3 p" T - */
/ H- I; R- T8 e, D+ f2 O - 6 P4 a P& ^" r/ K
- #include <linux/module.h>
[9 ?' ]- t/ ]2 b - #include <linux/init.h>7 X2 n I! J* ~6 I0 e& [7 j
- #include <linux/errno.h>
5 @1 s) K3 X/ m4 @ - #include <linux/types.h>
5 J/ \) [; s4 u- E5 T - #include <linux/interrupt.h>
3 L1 P9 l F; b4 j) H1 V - #include <asm/io.h>" K8 s4 E% y$ l2 q& p
- #include <linux/moduleparam.h>
% ?% i/ r8 b5 I& M Q - #include <linux/sysctl.h>3 M: B' z5 Z/ h. t) |, n X
- #include <linux/mm.h>1 D- i1 v' E+ h: o
- #include <linux/dma-mapping.h>
( p5 Y7 r6 @5 P; C& M - : j6 l) y6 U9 i( |# z2 ^3 g
- #include <mach/memory.h>* G! w6 w- V' i9 E: N
- #include <mach/hardware.h>
5 ^+ i( t" d/ A3 `) U; l; x - #include <mach/irqs.h>
7 w) |, a N& I" h: _ - #include <asm/hardware/edma.h>
2 Z' @/ [- e$ w" l2 a+ |
( p) N$ z2 J6 X& {- Z! l- #undef EDMA3_DEBUG
" q% f Z9 ~2 K1 R* v - /*#define EDMA3_DEBUG*/
- i2 k( ~# n) N
5 n) A7 W/ @) R4 ?# C3 y! K- #ifdef EDMA3_DEBUG
$ ?4 r W7 n7 Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 n5 |1 y4 {9 g" n' S' ^& @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ b- k1 z* Q( y4 L/ \' k6 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). A8 t, R! _9 @, s
- #else" p& H. `" j; K- k
- #define DMA_PRINTK( x... )
L2 K+ c! [* w" X4 U: C3 M - #define DMA_FN_IN. }3 L6 d+ S+ t- Q
- #define DMA_FN_OUT
) s A" R5 ^' h1 T: p% y$ @% B, g - #endif
9 z; Y1 N+ d% |, L% q0 r+ ^9 f - # F& C% N6 H `+ j) v2 D1 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- z4 C S/ ]7 Q. A& f# |' G - #define STATIC_SHIFT 3( v8 g7 w" P/ ?: V3 Y
- #define TCINTEN_SHIFT 202 D9 r: n8 }5 k4 ]$ U2 n) U
- #define ITCINTEN_SHIFT 21
' h% W! m3 D$ G( } - #define TCCHEN_SHIFT 22
8 E, T0 v( C1 ?) r$ N - #define ITCCHEN_SHIFT 232 {+ i, a- B' }7 Q
! ^+ a J$ ?1 K& Z# L- p6 m' r- static volatile int irqraised1 = 0;
- k/ K3 \! f1 S1 B - static volatile int irqraised2 = 0;( I w; I- J1 Z3 J! y
- ( x9 u5 R; z: C- I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, a& d' T( Z/ F. T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Z$ m6 {8 O3 M6 b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 j3 W# d8 @; B' j( w9 E
. V# m- J: [; f- P- dma_addr_t dmaphyssrc1 = 0;0 r" u: \/ g- u4 _" q5 ?
- dma_addr_t dmaphyssrc2 = 0;) Q' V4 e9 @9 l4 |+ I0 S$ ~
- dma_addr_t dmaphysdest1 = 0;
* g: U: J% S4 f - dma_addr_t dmaphysdest2 = 0;" N( ~. |$ \6 V( V
+ N3 v1 g$ L% R" T$ \- char *dmabufsrc1 = NULL;1 G# _. _# y- v3 r0 `) y
- char *dmabufsrc2 = NULL;
$ Z. U8 o7 N3 v) S; k3 F6 v: o - char *dmabufdest1 = NULL;
, }5 V2 C1 r# q" k5 M$ `& X! y - char *dmabufdest2 = NULL;
2 K7 [' d/ F' T7 f) e4 R
2 M2 ^+ n& [. ]+ Z- static int acnt = 512;' u1 q/ Y! V v* {- _7 P( ~
- static int bcnt = 8;5 ?3 \# e2 I h2 o
- static int ccnt = 8;
( S0 H& N6 A; k& S) V9 W9 |2 B
% J3 g0 d8 k0 c- module_param(acnt, int, S_IRUGO);
# U ^2 u( s' H% W: t& k6 V j - module_param(bcnt, int, S_IRUGO);
; n6 M% J, o; g, K' w" C3 _ - module_param(ccnt, int, S_IRUGO);
复制代码 ( d* {% \- ?1 m7 t# J
7 V/ l; H o5 T( m( w3 |* t& l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# ?6 \3 O& j' \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
P. l, [2 ?, \0 A" k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 @ o* ` H: g, K
/ A) f' m: T0 i0 L
4 d' N+ P- M {7 T' k9 Z; [
|
|