|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Q( D( w7 {; R- [code]EDMA sample test application- } N) y6 N9 ?* e* P( ^! D. R' Z5 o
- /*& c& X6 V0 v* f7 U( `
- * edma_test.c- L: e; E- {" T U7 x( A' V
- *
" V( r: E& Y/ N. C9 p5 }/ K$ O - * brief EDMA3 Test Application
7 B% G0 U! Z$ C7 k - *+ X+ Q, ^% w0 M3 B
- * This file contains EDMA3 Test code.
) E, ]/ V( ?1 e# A - *
2 @3 _" L1 U6 Q/ I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 S, e4 c6 w& d" y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 r/ f$ H3 A# u# n
- * TO CHANGE.
, w' c& A- T9 Z! g - *
- V9 M4 I/ `2 z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( W5 S- C+ ^: f5 i9 w2 g5 d
- *
. R! R2 p* m$ Q0 k - * This program is free software; you can redistribute it and/or0 y0 H7 t- d- }+ n8 Y
- * modify it under the terms of the GNU General Public License as' m7 X! L% E7 A4 i
- * published by the Free Software Foundation version 2.1 i* D, y8 C, F' Q& d& l) V( t
- *) o; B2 [% E% @! E4 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- E* h4 K# G! L# r! |, s: D6 t0 u2 y' o - * kind, whether express or implied; without even the implied warranty
& m# u9 E: q' X& H: K( B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) ~9 R8 s. }# q" O* O: `' L
- * GNU General Public License for more details.+ G; H% B o" u
- */
2 ~$ o3 n- h/ q) U- `
8 L9 G/ @ Y; Y4 [! I3 G4 u0 c- #include <linux/module.h>
9 S- E4 Q. c- }( i - #include <linux/init.h>
* n1 E/ r' D4 f5 {' o2 R4 U - #include <linux/errno.h>- s8 J3 }; |" R! S
- #include <linux/types.h>
: F3 u, ^, A5 w1 r, H* O - #include <linux/interrupt.h>
q2 f; J& H# t& {0 [ - #include <asm/io.h>$ m. N, p$ u- a2 G: Q# U
- #include <linux/moduleparam.h>
6 e% s/ D7 v3 s. G - #include <linux/sysctl.h>+ p3 x- ~. U- N0 U9 X( H% `* A
- #include <linux/mm.h>3 o! y/ J) H1 O. _1 w
- #include <linux/dma-mapping.h>. x5 ^' b; i K6 _8 v
/ k5 f! j6 W: I& u K. P, Y" c- #include <mach/memory.h>3 W, e6 N( X& G; y
- #include <mach/hardware.h>) E' }4 d1 T3 `4 i! \$ k
- #include <mach/irqs.h>
9 ?% K9 p& \9 n8 F/ @ - #include <asm/hardware/edma.h>
! S" c& U) A* j" K/ w& \/ @ r
) \( P7 ^3 G& Y4 H( o- #undef EDMA3_DEBUG
% V& X- M2 o% B+ J" n4 S$ N& _/ \ - /*#define EDMA3_DEBUG*/5 f, f. @( I" ^: D: B
- ! B0 }) m# {8 Z0 j. U" ?
- #ifdef EDMA3_DEBUG
6 E7 ~3 c$ R' a) `$ E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; G: ]& I/ ^+ K$ a! @% V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Q. n# M- L! ]3 S& u0 Y! k- s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! B! I5 V D0 K - #else0 U% R/ _: L$ ~1 @9 j9 f
- #define DMA_PRINTK( x... )
5 f0 Z# O. `& x5 R) V0 y- c - #define DMA_FN_IN/ L. G8 a6 [9 _* c8 u. E
- #define DMA_FN_OUT- H9 i) E, f; Y0 S
- #endif
' L% Y4 j- w/ W/ J& z
! H3 x. y! z' _. V. p/ A- I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) J0 Q' S- x( K
- #define STATIC_SHIFT 3- R, Y9 k$ M) |
- #define TCINTEN_SHIFT 20+ T' h5 A8 I5 B# A
- #define ITCINTEN_SHIFT 21
6 J. a! [8 l' _* [5 s% B: S - #define TCCHEN_SHIFT 22% G- r, v3 s( S
- #define ITCCHEN_SHIFT 23$ b9 T( _; H; r3 G9 q8 o/ C6 n! g0 ]
# [. s; C, L D/ p- static volatile int irqraised1 = 0;
?! x2 w! k6 y: ^! e# R4 L: w# b - static volatile int irqraised2 = 0;; D: G7 P. m# u" s
8 r/ ^7 z0 u9 D0 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ~6 Z/ Z8 C" c' ~8 [* q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. T0 c( W" I. ^* K. Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' H E8 z1 ` Z5 N" g
$ N7 j. A' T5 L- dma_addr_t dmaphyssrc1 = 0;
! B( b8 G7 o; L6 ]' F( L8 M! w - dma_addr_t dmaphyssrc2 = 0;
& G4 |% F0 X! ^% y1 v7 d - dma_addr_t dmaphysdest1 = 0;
' ?* u; N1 \5 Y% ?0 v7 a - dma_addr_t dmaphysdest2 = 0;4 M( D3 D/ B! m( \' Q' I# @
N3 T+ _8 S1 _4 Q) S6 i2 P0 D- char *dmabufsrc1 = NULL;$ p! O5 u+ |4 J6 b
- char *dmabufsrc2 = NULL;
9 f3 K, }: y# b9 N6 }* t& B - char *dmabufdest1 = NULL;
$ d: I; P! b$ n* t - char *dmabufdest2 = NULL;
+ b0 e" n# B9 A0 o: u+ z) A* c - ; s/ m" K. R9 t- ]1 N
- static int acnt = 512;
" ?! x( a5 i5 z - static int bcnt = 8;8 A6 | L) E0 L1 D3 Y/ N$ _+ n0 i
- static int ccnt = 8;
5 G4 `$ q) X+ _
) r2 e- r# ?% j2 |/ j/ D* D- module_param(acnt, int, S_IRUGO);' ^2 F5 I* h- d( l; M8 I" L: {3 Z
- module_param(bcnt, int, S_IRUGO);" P" i! `5 N E$ ]) e& u7 F |
- module_param(ccnt, int, S_IRUGO);
复制代码 1 R' j5 `/ [/ S5 H5 p
. k. S. ~& _% \$ z9 F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 J! d- @0 I) f" R6 v* W4 J. M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! a1 B# k: O+ A ]# s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ _1 J( A- b9 x8 ]2 s' Q
; W, L5 [; \& K6 O! l7 H7 a) X8 F2 J
|
|