|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & ~3 K0 O5 H& Z9 Q+ R
- [code]EDMA sample test application2 Q$ L+ H5 \; q; d7 t' W
- /*
, v8 `9 l8 B' G) @2 n - * edma_test.c
5 O% ?' P& d) L% i8 m2 X; s - *
3 e( t; q: y5 L8 q6 l4 r& b - * brief EDMA3 Test Application
, b9 ?# D a1 w% I, N, Z - *4 z& P8 K4 P4 q$ j* \# G
- * This file contains EDMA3 Test code.! y0 Y: }; T! h1 G3 M- p% n; f
- *
1 j! n* W2 ]9 E; a" \* a( L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: p. h7 w; a- f9 W$ S% z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 f, B x1 b, t6 s& e9 D! R" k# ] - * TO CHANGE.- G) T F- i0 p# |# ~% ?9 Q
- *
" o0 L8 h. p, V( c3 m3 X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 \, ~3 L. ^1 r) @; F - *
* @! B/ R# I9 D# l: B& j - * This program is free software; you can redistribute it and/or
# z3 G) p- H# n, Q# b# w- E - * modify it under the terms of the GNU General Public License as
( S( A+ f4 }6 d G- \ - * published by the Free Software Foundation version 2.% @9 M4 K2 j+ M1 R+ M
- *) W6 @" @3 @ f s0 D' n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 p, x$ ^4 O) J
- * kind, whether express or implied; without even the implied warranty4 a8 ]: a: O' C4 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 B/ j& w, E- t' T
- * GNU General Public License for more details.
' A5 J) o; E! T2 N - */
: y/ n3 M3 V, ^! G - 0 \8 A3 N9 G. i
- #include <linux/module.h>
[3 N( v$ L. a0 b* c$ S: F; U - #include <linux/init.h>
3 j2 U% F! L# x9 d8 H" q - #include <linux/errno.h># z* _+ w7 n2 m+ T% e$ s
- #include <linux/types.h>
, Z/ }1 c! Z, ~, U C - #include <linux/interrupt.h>0 q0 m9 k- K7 j. ]1 k8 I. ^# ?
- #include <asm/io.h>
4 h3 A& Y; F+ ^ F - #include <linux/moduleparam.h>% {4 ?7 \* A) n8 S
- #include <linux/sysctl.h>
, A: X; n1 t* L( Q. E- d! c: | - #include <linux/mm.h>5 T+ J/ |: Q& n; K' q
- #include <linux/dma-mapping.h>% D& D" D4 J1 _& _5 f( T
/ M( \1 Z- a# `- #include <mach/memory.h>
, y$ A+ b) ]8 g( _* Z" |$ A( Q - #include <mach/hardware.h>! r5 C' R! |( [# l" g
- #include <mach/irqs.h>
4 i0 d# u8 o' b8 C2 P - #include <asm/hardware/edma.h>
! `$ ]1 o* z( Y" _: r- V
+ D0 e( [! t: n- m) z# w3 Z- #undef EDMA3_DEBUG
5 `7 F4 w* r! H1 }, a - /*#define EDMA3_DEBUG*/
6 z) u6 X. X- N- q+ E - - S" i! c4 q2 t
- #ifdef EDMA3_DEBUG; C Z5 N$ M- T; T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); c `4 D: O; U& E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 H0 ^1 Q* D3 `7 f& W* x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ W8 K. n! _4 o) n* H. { - #else1 d' T9 e2 H' r7 n1 j$ j% j# w
- #define DMA_PRINTK( x... )
& o- l( D% @; b2 y' |+ B5 ^% F - #define DMA_FN_IN
5 i2 P! e* P S, } - #define DMA_FN_OUT
# ^. i; O, u; y' `3 r8 P% {) u9 S - #endif
; k- p' k+ e: r& F# g; R; k. _
8 ]9 a/ B' ?0 E. g. f# y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. b3 r, }& \" S. l2 n* P - #define STATIC_SHIFT 3% h3 ~$ s( |. W# W
- #define TCINTEN_SHIFT 20
i* i" [' W# j5 I - #define ITCINTEN_SHIFT 21; ~0 ~: H; m4 V2 o$ }0 T
- #define TCCHEN_SHIFT 223 g4 s" M. d2 P9 E
- #define ITCCHEN_SHIFT 23
2 o1 ~! z# q5 Y - 0 X+ F; T1 {( G
- static volatile int irqraised1 = 0;
, V" J; l3 j9 x! K8 J5 c* ?1 Z q - static volatile int irqraised2 = 0;
8 J0 Z7 w% ~0 v$ _- J3 h1 g
, @6 X- A( N! R7 U/ |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ p6 [; u! @ W( d1 y. Y: `# G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 N. r' q$ C' Q% u9 J$ \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& U% K, n2 W- Y1 [5 b$ e# Q
- : l+ I+ W4 M/ Z } k1 I
- dma_addr_t dmaphyssrc1 = 0;
( w5 ]- a0 X5 V. y - dma_addr_t dmaphyssrc2 = 0;2 G% `7 \/ m2 {
- dma_addr_t dmaphysdest1 = 0;
W2 @+ ]% _ h' P1 ?* _6 h% n5 ^ - dma_addr_t dmaphysdest2 = 0;. @9 K% ]& v/ T6 _, g
- 4 z5 Q9 _- l. W6 ?+ h
- char *dmabufsrc1 = NULL;
3 k/ u* I* k3 s, J3 ^ - char *dmabufsrc2 = NULL;& G7 M2 w& B! D/ i; T" L2 a# T2 R
- char *dmabufdest1 = NULL;$ `1 _9 I: y! H- U' N m; u3 _
- char *dmabufdest2 = NULL;- Y7 C- C! w( T& ]3 t. c s& r
- 5 }6 E9 L: j4 e d
- static int acnt = 512;
5 _$ h4 _2 Z6 x0 n) G( ~ - static int bcnt = 8;
+ K/ |2 e9 m7 g- L - static int ccnt = 8;
4 L4 I- ?; O- Z1 T: \ N6 A - 0 e4 U$ l, x5 C" A& t4 D- v! M
- module_param(acnt, int, S_IRUGO);& D% E# c6 y0 `- r
- module_param(bcnt, int, S_IRUGO);
8 m& A( W2 Y9 ^9 \. m: @) M - module_param(ccnt, int, S_IRUGO);
复制代码
# a# I6 x- M, z
* A A* ~7 _+ P1 ?/ \% a, V2 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 `8 u5 e! t$ R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% \2 F4 c9 e+ P1 X3 B& k# ?1 e- O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- q$ s1 X; M6 ~( V: F$ H/ L
+ F/ f; b9 K& r9 |, C8 t4 P) Q: P, l* W1 L! i( i6 B4 m
|
|