|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 ?- A! k1 M7 b! B% y6 \; p" R
- [code]EDMA sample test application
" {5 t0 Y( ?% x* V" c - /*
- r) O# p1 j/ E, a: t; b# n7 Q: N - * edma_test.c: } U- p. h* w. O7 } _
- *
, x. ]2 O; M- [9 I" \ - * brief EDMA3 Test Application
+ X% Q2 \9 e/ x s - *! Q3 |7 A. t/ ?1 [, e
- * This file contains EDMA3 Test code.
# ^* _3 o w' z* B# y/ ]; Y( V - *+ {$ e: A$ y1 h6 w& z0 o. C) D N3 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' p1 J: I! ^" M. ^# R( z/ t u; E) Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 u- K0 z7 ~, B
- * TO CHANGE.) Z" _0 A9 q$ G. C1 ]
- *$ z2 K1 _9 v* w0 u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
r f) z) U3 Z1 @& | - *
6 P2 _( ?4 j9 y, \ - * This program is free software; you can redistribute it and/or( T- P- _3 N& i3 {3 I
- * modify it under the terms of the GNU General Public License as
( E g* |) C9 y( m - * published by the Free Software Foundation version 2.
' B% H( T# a( H. | - *
8 P3 s& E i; l' d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 Y8 e2 x6 z+ c0 r4 h9 y
- * kind, whether express or implied; without even the implied warranty
$ F7 Z$ P( G) ]% u0 s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 s& ]- o2 @/ H. Z5 }
- * GNU General Public License for more details.* I, ]& D4 Q( ~. P. Y9 e# L; t7 Q2 T
- */
& t6 C# j6 A+ Q; C6 g. d4 r% M
3 N+ d8 N5 a9 v& Y1 M( M( i- #include <linux/module.h>
0 R7 v2 z0 R" I5 j: s6 z; I - #include <linux/init.h>0 ~# t/ G/ G) ~8 F) V5 i
- #include <linux/errno.h>
1 ?3 B) a! }: y$ X. b4 o& l5 ~ - #include <linux/types.h>0 r0 z" m- Q6 ]& _5 g6 w+ V) x
- #include <linux/interrupt.h>* {& i, E1 n2 g2 `2 `
- #include <asm/io.h>4 K$ S3 a: K5 f3 A; p% ^
- #include <linux/moduleparam.h>, [" H; }5 i1 R# U4 `' p
- #include <linux/sysctl.h>7 N; c; ]. e2 y7 t" M
- #include <linux/mm.h>' d4 M% f8 X( ~8 N3 \8 j- p
- #include <linux/dma-mapping.h>: n& G7 |6 ]' P: f& K% |
- 0 X* U) t9 [6 a/ ^
- #include <mach/memory.h>6 T! b/ Y# |# u# i+ H% r, }# I
- #include <mach/hardware.h>: y/ q, e& p) p# {
- #include <mach/irqs.h>
3 H4 |- l1 Q7 P3 v' j. G. ` - #include <asm/hardware/edma.h>6 T( j! ]- ]! \- q+ `8 I. Z) R
0 U9 W0 _# A- o- #undef EDMA3_DEBUG
' T+ l- K$ T! _& f: R% @ - /*#define EDMA3_DEBUG*/
- q2 H& D' a( y- v r: c7 T - : N. f4 V# ~/ i9 _
- #ifdef EDMA3_DEBUG
0 O' d& N+ S% b! @7 P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. x9 [4 ^/ M3 I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 ^! G) M$ n3 q/ u7 d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). \/ O! W; G: y
- #else
l8 N. H3 A) Y/ z# V4 O - #define DMA_PRINTK( x... )
1 p1 G5 I4 A! a7 H% X - #define DMA_FN_IN
) E. x& W3 X/ q. F* E2 N8 Z4 _ - #define DMA_FN_OUT
! B( M0 T5 ]! c) t% R% y% h3 U3 ~# b - #endif- E! g) t- @# z
- 6 `9 S$ `5 z! U& ?& O- t2 l/ g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# @1 V% ^/ {8 s
- #define STATIC_SHIFT 3" I& p* p, n+ l" M- g0 r: ?
- #define TCINTEN_SHIFT 20$ E' e5 j. [! s+ r/ S+ B
- #define ITCINTEN_SHIFT 21: S& Q9 T1 a. B" d6 I* Z
- #define TCCHEN_SHIFT 22( X2 I5 K7 g" D/ M6 S( i
- #define ITCCHEN_SHIFT 23/ ~) z6 I) w: g
- ' h9 D* T/ T1 n8 [9 `( j% A
- static volatile int irqraised1 = 0;$ p5 [& @8 d/ p! L- P9 }8 w
- static volatile int irqraised2 = 0;0 U/ i; ]1 l. {9 v; k- _7 u
3 _& \& G: B" u" U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# h' ?) A- `- _- s0 _5 u; e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 s( A3 R# a' Q" e3 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 K7 Q& l0 E1 i; j5 s. q k+ g
$ g3 r7 _3 }/ u- a- dma_addr_t dmaphyssrc1 = 0;2 Q- R# r+ U8 h* W3 P( F2 \2 B" Q
- dma_addr_t dmaphyssrc2 = 0;; E1 C1 v! K& g z8 z
- dma_addr_t dmaphysdest1 = 0;
1 l9 _4 r6 Y) D! L& {0 B - dma_addr_t dmaphysdest2 = 0;- x1 s; z0 Y( }# F$ f% f n* I: O
" a& f o& o5 m* B4 B- char *dmabufsrc1 = NULL;% R: L& n: B& O* h5 h9 V
- char *dmabufsrc2 = NULL;" W. d0 O! |* W, f
- char *dmabufdest1 = NULL;& E1 `/ m( c8 k$ E- S2 ~2 Z
- char *dmabufdest2 = NULL;1 R( G7 A- C T. r. l
- s' ?8 O8 {8 \( X; d- static int acnt = 512;4 t! X& U7 Z9 ?) a. f$ t" G6 u. I
- static int bcnt = 8;$ X& S o1 `: C! g4 Q( g5 Z1 `
- static int ccnt = 8;' n/ ?+ x1 r: Z; g( w
- % g- T ?( g, v: r; C# a+ I
- module_param(acnt, int, S_IRUGO);
( [4 ^; r, |1 Z/ ^$ b! X - module_param(bcnt, int, S_IRUGO);
* u) @4 S2 ^3 `( v" H& e - module_param(ccnt, int, S_IRUGO);
复制代码 ! @# x! Q. _! T. \( @ M
" Z( c' c/ }# v! e9 c. p8 R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 P' f2 o$ l) T- e, [- S- ~" B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) L( g# i, }. r5 V$ w+ F" \* d- {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* F& u- A/ H( ~
, Q" v; G6 z+ n1 \ f# z7 b& m r9 a: R/ d' x9 ?$ o3 A$ d( i' j
|
|