|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ E( \" w* r6 |8 d9 \4 v- [code]EDMA sample test application* d5 ~6 W" a7 R- R1 X+ K: q
- /*
- Q1 h! T j; E# M0 s2 n% z5 f - * edma_test.c
, [: g( K) E7 l: b - *0 C& h1 T& A/ I' L4 m4 ^
- * brief EDMA3 Test Application
/ X6 [6 j5 h2 P6 r/ G$ ~ - *
- c! |/ M- ^! P% m1 ] - * This file contains EDMA3 Test code.
: z! n K/ P0 ?# O, J5 w - *; t" |4 R8 N% s) j0 Y/ v$ h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& ~: M# D! i4 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 K o) W& D4 _& a; D - * TO CHANGE.
6 E( f( I" T, I6 x& V - *& Z& q/ n' B) n2 D7 Z' k9 n) R+ ~" L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
}6 E9 n% F. n: w - *
* V) H1 \3 b# O I4 H( q$ { - * This program is free software; you can redistribute it and/or5 K- q$ o# H' W; X% ~# y0 G
- * modify it under the terms of the GNU General Public License as6 u4 m+ P4 J& [. H0 U7 k# g
- * published by the Free Software Foundation version 2." w/ e6 E5 u, X6 ^
- *2 C! D/ j r" u2 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, z3 m, d9 ]) E+ H/ Y1 Q/ e - * kind, whether express or implied; without even the implied warranty; n/ c9 y( f6 N3 B5 m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 q8 g# G, g0 ?' p1 ^/ e7 O - * GNU General Public License for more details. y% ?: F' o$ f" ~
- */
9 @$ \+ T& l( [5 W* T8 ?
* x. P( O0 v1 Z0 D- #include <linux/module.h>* B- a# x+ o' X: x) g- C
- #include <linux/init.h>
1 X4 U5 O" f! Z: A7 r0 t - #include <linux/errno.h>
! o$ b* A/ O$ n5 g. W- i1 { - #include <linux/types.h>3 j8 Z6 m% o& y% z( u
- #include <linux/interrupt.h>
$ A; Q- m! ?0 r - #include <asm/io.h>
( u* r( B# U" K' p6 P1 K) t( Y - #include <linux/moduleparam.h>
! t, V% s0 b' s& p; p6 a - #include <linux/sysctl.h>6 x$ O; \: B, m7 G
- #include <linux/mm.h>
$ d" q+ r0 t( x4 N) ]8 |- i - #include <linux/dma-mapping.h>1 G# G0 D0 |# a0 d3 Q
- 5 i5 b! ]5 u7 n0 ?: f6 j
- #include <mach/memory.h>: b& u* z0 `9 M. m" T
- #include <mach/hardware.h>
0 Q8 @1 {2 T0 G' P _( T1 Y/ ?( J - #include <mach/irqs.h>5 p0 g) u1 H, ]6 E
- #include <asm/hardware/edma.h>2 \6 h+ Y. C1 E; Q
- - |# }, C! N2 J+ f( j
- #undef EDMA3_DEBUG; b# m( Q" e0 F7 s
- /*#define EDMA3_DEBUG*/2 D: Y, B+ g6 q, ]$ A
- 1 _( w. j+ C0 Y8 P1 F% j5 w
- #ifdef EDMA3_DEBUG
! i( F- X2 j. j& c5 ~/ P0 y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# k) x. V+ Z e% l6 q% L2 e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; g& k) }5 a1 P/ _; l; E" ^- ]% x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" z9 b. y7 F( D - #else8 s/ V) x8 I3 @( D
- #define DMA_PRINTK( x... )( i! r3 O& ?. k1 _0 @0 x
- #define DMA_FN_IN+ j2 \ \: ]7 R' Z: @
- #define DMA_FN_OUT# {6 ^" @/ i# s! l! [
- #endif6 W9 V4 [, H& l- u, l3 i
- Z8 r/ ]( z' L- A+ y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* Z3 _0 {( x5 Y$ J9 P$ D8 Z/ @' P - #define STATIC_SHIFT 33 I7 l" l. w% Y8 h! v
- #define TCINTEN_SHIFT 20; \ ` X3 G# w g( Z4 w9 _
- #define ITCINTEN_SHIFT 21
8 Y- B+ A! c; E) W9 Q+ ` - #define TCCHEN_SHIFT 22
# }$ I& L8 B# [% B" a2 p/ L4 p8 q - #define ITCCHEN_SHIFT 23
9 ~8 n* A5 |+ S - $ g& M% G* N/ s( j5 A- U3 ^9 U5 @! B
- static volatile int irqraised1 = 0;5 h% y' I, T0 O. b4 z% O
- static volatile int irqraised2 = 0;
+ n! Y" Q! l6 v8 M - ( w2 H& [5 C$ n2 R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 K$ y5 P- _* u" ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. n0 M% f8 H& y0 }2 p" e, k# [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* C+ ^# d1 `1 ~/ Y% M8 Q, W
; N+ O! i0 V8 ^: u- R- dma_addr_t dmaphyssrc1 = 0;
/ m3 n2 U: D3 q - dma_addr_t dmaphyssrc2 = 0;
0 P" F1 C. _7 m - dma_addr_t dmaphysdest1 = 0;
& q8 P* k* O: e, o, t - dma_addr_t dmaphysdest2 = 0;
4 N, U A" u8 L! N7 |9 ?0 s
) V. }# E7 T! I- char *dmabufsrc1 = NULL;
. W( _5 l3 o \; h$ W1 Z - char *dmabufsrc2 = NULL;
/ Q" N m- q: k9 j* N - char *dmabufdest1 = NULL;/ N* i& h2 ~; f
- char *dmabufdest2 = NULL;, G U' G+ S0 r% V- J+ B6 X, K$ v
/ x3 o% f. Z( X' |. C; z- static int acnt = 512;% K* `" R% r3 n- `# }% ?' @! r
- static int bcnt = 8;
: S7 w8 M; ?0 M$ [7 x0 H, s - static int ccnt = 8;3 W+ t' n. @: V' }
- : w& E; N8 k/ _& H
- module_param(acnt, int, S_IRUGO);) x) K2 c, x% E l6 n0 V
- module_param(bcnt, int, S_IRUGO);
4 I' @7 E& a/ `* e - module_param(ccnt, int, S_IRUGO);
复制代码
6 Q" G0 n9 n4 w8 B' A" o, d0 P1 A+ c" \- R- p' Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 A5 e# s+ t# carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 a4 K: f7 U! @' ^$ L3 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 _4 |. h0 x e! s* v
% z. {. Z7 u3 ~
0 J8 i$ o E! F) d% Y" m+ l |
|