|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 g% M$ u! _! ~- _
- [code]EDMA sample test application
0 p H! R( I& O% z - /*! k. j1 @$ U, a5 N0 i. D
- * edma_test.c* J4 y- U$ ^% ^' I2 z# x; b
- *
1 ], r8 t- g; T( r. b: ? - * brief EDMA3 Test Application3 L" @/ ~! e w* u' ^( X
- *& | s, d; F% q1 o! x/ n0 J
- * This file contains EDMA3 Test code.0 Y8 V8 P) S4 B
- *9 |' B( y2 {/ ]- w& g" J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE i, j) x2 z" n- Q) k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 E6 b. b5 G" {% Z. w - * TO CHANGE., Y6 O6 {2 x+ E: m! s: _
- *
- e) J9 R! L0 ]' \0 Y/ S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 f. a1 | q4 x- Q: H! s
- *$ A: F9 q- I1 n2 z
- * This program is free software; you can redistribute it and/or
, {8 ?3 c. S4 t4 d9 G9 Z - * modify it under the terms of the GNU General Public License as9 F! c; ?9 Y7 B9 ]
- * published by the Free Software Foundation version 2.7 X3 X4 c* r3 n7 a7 u
- *1 A- y' o$ p0 Y0 c& k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 }! n4 {) B" W - * kind, whether express or implied; without even the implied warranty
% \; b& R a" S& n1 x6 V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, w. Y2 k; E$ R! R$ ~8 f - * GNU General Public License for more details.) H5 E* d, S; ?( M# x8 `
- */6 g- b, h# @1 h
' v. u$ D, H4 j1 P- #include <linux/module.h>2 b4 F' S3 B- y5 F6 U
- #include <linux/init.h>
) d' p( I" C" g9 E# n3 U" E8 q - #include <linux/errno.h>
" c" E; t6 R7 G' s) |7 b - #include <linux/types.h>- x: r* r z! ~7 W* a& ]; E+ m4 l
- #include <linux/interrupt.h>
( D2 a1 V: E. O% C L/ l - #include <asm/io.h>
+ X# m! i8 d$ C: |5 B$ o - #include <linux/moduleparam.h>: P c% E; H' s! a( w
- #include <linux/sysctl.h>
* [' J9 i; Y# u3 ~. p* ^ - #include <linux/mm.h>" ?0 F5 W! n$ |3 A" @* u2 t
- #include <linux/dma-mapping.h>
, h6 F+ r1 G0 T% R: ] - 6 k. K8 R8 a) e5 Z
- #include <mach/memory.h>
; c& [ K. Q( F6 z& A9 O) a, c - #include <mach/hardware.h>
- s C+ A: p$ o) ]3 O0 S - #include <mach/irqs.h>' l* j$ Y; E/ R6 U. w3 R
- #include <asm/hardware/edma.h>
! z' l" |2 O L8 ^( b - 6 _% O6 h+ x0 e E# T
- #undef EDMA3_DEBUG, O+ w- x4 |# B4 O$ D; U$ X
- /*#define EDMA3_DEBUG*/
8 f! G" t# y( ?. o - 7 v2 F- |5 m' \( L: W$ ^; d
- #ifdef EDMA3_DEBUG
}6 ~1 @+ H1 M3 I, ~; @9 c7 b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ B' q v: _& ?+ X; w, A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 Y4 _5 a3 W! o2 Q' o5 Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 U2 d3 f- Y- ^+ e$ _ - #else( P+ w8 w' n/ G' |) T6 }
- #define DMA_PRINTK( x... )" l( Y }- C" d+ a5 \9 f4 o4 Y
- #define DMA_FN_IN
3 c! |7 X( w; U4 ^! L - #define DMA_FN_OUT7 x, Q. `+ N+ n5 ?
- #endif/ e# O3 H- A9 M. n) F; d8 q
- ' R9 v* ~. E9 n! ]% [$ [: ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' Z* E& c/ j3 J; N) p' } - #define STATIC_SHIFT 3) M) r; t2 v9 Q; ]; }% \
- #define TCINTEN_SHIFT 205 i% M v( G: C4 \# G* q7 E0 j
- #define ITCINTEN_SHIFT 21! s" N/ V5 P# C/ N- B
- #define TCCHEN_SHIFT 22, {8 B0 |+ i% i& Q* i
- #define ITCCHEN_SHIFT 231 t3 @1 M; f2 G- s
! i" F9 L* ?0 U- static volatile int irqraised1 = 0;6 H+ L: m7 o# x+ S/ }. i
- static volatile int irqraised2 = 0;' M. c9 C; S# [3 G' i0 o
+ B$ O0 k; M5 ]4 e- t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 H2 V5 a8 |8 d1 `$ C5 D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" K- x7 J1 L; @8 B" d7 H9 T: c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); e [: m; y2 ?3 s
- 0 \, p+ N$ n% i+ Z0 j+ W' w; V" u
- dma_addr_t dmaphyssrc1 = 0;3 z/ H- Z) d# e
- dma_addr_t dmaphyssrc2 = 0;
- }" J+ H8 `6 Y - dma_addr_t dmaphysdest1 = 0;
+ i l; G% M3 p5 S- S y4 x! \ - dma_addr_t dmaphysdest2 = 0;3 y* [8 S8 T1 [# K# F: H9 p
- 6 p" J8 q# E' @9 `
- char *dmabufsrc1 = NULL;
5 l; I7 u" t t( y - char *dmabufsrc2 = NULL;& D/ I$ F) ]; h+ K
- char *dmabufdest1 = NULL;7 d" n) n0 {6 |$ \ T' c
- char *dmabufdest2 = NULL;
, t5 ~, q" I% m
8 b @8 ^5 }4 H8 Q- static int acnt = 512;& ` x- h& Z# X$ Q
- static int bcnt = 8;. q J: q3 r/ S- V1 G! c- v0 _
- static int ccnt = 8;2 b; ~* s2 M, S) J* f' y
- 4 {" m- a0 z$ E9 J4 t* `
- module_param(acnt, int, S_IRUGO);
; h: }- e" V8 W4 ]& ^ - module_param(bcnt, int, S_IRUGO);. }5 u- f( b2 o' w
- module_param(ccnt, int, S_IRUGO);
复制代码
1 W! Q0 ]( p) C
, B$ ~; O% Z% ?3 x* O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% }0 Q* Y* d4 S- G
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 R0 b$ i2 r3 a# o2 h4 I/ {& f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) a4 h" Z; H0 ?: |7 L( ~# g" V
! r. g( X; [) f% J$ I- v
; W& {, }8 |9 ?$ j |
|