|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 `5 q( N3 _: w9 r2 V! i% D
- [code]EDMA sample test application
4 Q. {* l8 m' h - /*# C, g8 H9 K* r" O' ]. O
- * edma_test.c
/ a0 n, n" y: r+ y! g* A - *& Y2 u: M% v$ j! d. \& r
- * brief EDMA3 Test Application
- m d& W8 z6 t! U - *# R+ Y# f1 G$ P- u5 E
- * This file contains EDMA3 Test code.
+ e2 s, p/ \ o4 S4 }* t - */ I' H' M7 t, S9 m. x ]2 P6 y+ S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( P7 V1 X; |& N! f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) o7 s) W( Q% ^; u( c( ?" g! o - * TO CHANGE.9 H4 e) s2 p- @) x; b# M" N- S
- *
' x2 w5 p7 s4 L; ]% j' n9 s/ P- C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: @# s: [- S n4 B - *
3 ~ e: W9 o( C8 f w. R% L8 e: o - * This program is free software; you can redistribute it and/or% b4 d7 I, j( K2 v$ l
- * modify it under the terms of the GNU General Public License as
$ D. a6 @, H; ]8 k; p5 r( [4 h$ b - * published by the Free Software Foundation version 2.% T2 j3 I8 f4 D6 L. |
- ** b) q4 n- n* ^) e+ R8 H% _4 Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( j; I* E2 n- ~ Q" L* ~0 c1 j
- * kind, whether express or implied; without even the implied warranty
) U/ \; ^, n1 K4 d$ ~5 E- } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 Z1 i. O, O2 x e - * GNU General Public License for more details.
0 r* Z7 W# z" s( G - */
4 l% k+ P4 L' b5 u/ I- t0 D6 ~
' F4 b" p2 Y0 }& ]7 K/ z) K- #include <linux/module.h>/ g/ B5 ]) V6 H! O+ d
- #include <linux/init.h>5 `6 a% v; `' r' d
- #include <linux/errno.h>8 k+ p8 R3 c: r+ X+ _: ^
- #include <linux/types.h>/ b; ~$ c; D2 e8 ~
- #include <linux/interrupt.h>
) W5 ]4 T, O' [5 T; ? - #include <asm/io.h>
% s5 d5 q7 v& H. C: ^ - #include <linux/moduleparam.h>
k0 i: j( b* Q7 ^0 p - #include <linux/sysctl.h>, u; B* `1 f3 i$ i, c. |$ C
- #include <linux/mm.h>/ z% n. Y+ e3 H9 _2 N6 U a* k
- #include <linux/dma-mapping.h>
. A3 G* u# y* w7 W, w- P
5 F: I$ m, r) P0 Y2 J6 q% E- #include <mach/memory.h>
0 ]2 q1 H' h- L3 W' q - #include <mach/hardware.h>
1 {" _; y( y& t! r: l3 `! A1 o - #include <mach/irqs.h>
4 q$ s1 y5 P& J* S6 \/ I8 b - #include <asm/hardware/edma.h>
3 p. h7 T% V5 W0 @' s I
, H$ I. c5 W& ^( _5 ]- #undef EDMA3_DEBUG
0 o2 i0 Z6 R8 P7 w* j) J; \ - /*#define EDMA3_DEBUG*/
, w( D. I! a5 X - $ W7 V% l8 X- D5 a1 }
- #ifdef EDMA3_DEBUG
8 }8 z# n% M; N; _7 E4 R$ f/ G9 a X i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 |* D/ U* a' Q5 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; n0 z a& P2 D9 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- @3 l# l5 b- r9 O2 o - #else
. H- b8 X, p: W3 x - #define DMA_PRINTK( x... )
0 g( R* I+ X2 a# h% J - #define DMA_FN_IN
( f' x1 ?8 w' J2 W, u3 ? - #define DMA_FN_OUT
' M; d. O3 F8 F! Y6 C6 c5 \ - #endif
9 q) S! p( n6 X9 D; Z3 s# w
* X$ m& i e4 A/ L* t- #define MAX_DMA_TRANSFER_IN_BYTES (32768). T8 ^+ v! H2 h
- #define STATIC_SHIFT 3
3 p1 }; n. E4 C0 T0 S$ V! T- u - #define TCINTEN_SHIFT 20
7 Q/ e# `" L0 O2 K2 h1 A/ Y - #define ITCINTEN_SHIFT 21
4 Y8 o; I! d( q" o4 R8 c: D - #define TCCHEN_SHIFT 22
" ? H! s# A2 b( i - #define ITCCHEN_SHIFT 23# a7 r! L: K) \7 v* Q
2 B' P3 I/ W# F: m9 Z1 }: F& R5 K- static volatile int irqraised1 = 0;
8 o* P& W) Y; j. X" K' C* o - static volatile int irqraised2 = 0;3 q6 }& H2 p/ } v
, m! d! A% a6 ~' n3 t7 t% ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. W% J9 C9 T# Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' J$ ?2 D! d' x- ?; K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; G! z! g. R+ ~. h" k
- 2 H# p# a2 b- z% U, V1 ~; \
- dma_addr_t dmaphyssrc1 = 0;! s) H' Q, M$ ?9 C6 P
- dma_addr_t dmaphyssrc2 = 0;
6 J! V8 i0 w0 G6 W& n - dma_addr_t dmaphysdest1 = 0;
( h7 K. f- F0 A0 m2 x - dma_addr_t dmaphysdest2 = 0;
c+ q) X2 e# x! w8 |. e
9 q" o& O5 U( }- char *dmabufsrc1 = NULL;7 q5 b, y* {4 {% x9 g0 V. p
- char *dmabufsrc2 = NULL;
( W6 H. [4 O! X; V5 N$ @ - char *dmabufdest1 = NULL;6 z/ R8 Q4 g& {7 H7 t
- char *dmabufdest2 = NULL;
. v% G8 l M5 J- E! i, [
& y# z4 _2 H/ N5 w4 K' {* |( R- static int acnt = 512;7 J9 _+ t/ Y- R" O. {3 V0 W
- static int bcnt = 8;
x/ \1 `4 _, |# D7 N# P( Y+ | - static int ccnt = 8;
! _7 t: _( ?5 r* N/ x" ?+ q
+ L' ^+ L: s, F$ R- module_param(acnt, int, S_IRUGO);
2 A! ?$ d& l" z- \8 d, a1 l- @ - module_param(bcnt, int, S_IRUGO);( |- L* `0 K. R- E
- module_param(ccnt, int, S_IRUGO);
复制代码
7 T. Y0 @1 i; y# F. e2 \: Q+ c! ~6 L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( A# y4 Q7 Q# j, Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( k' a- t" p9 v- D" O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. |/ N) R; v0 m8 V1 H
" i1 G( t1 U) ]- E6 m% x' S$ F
$ x/ _0 `' q% M! h# \ |
|