|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - U% a( o6 T! N. X- o3 F
- [code]EDMA sample test application
+ \7 Z2 K# Q5 r* O# I+ K' M! G2 i - /*- i7 k" ]& U x- M0 @
- * edma_test.c' n6 e% M }7 W7 G: A6 h# k
- *) ^% l# ^3 Y5 v% g
- * brief EDMA3 Test Application
/ ]0 F9 Q E/ ~1 b9 K; @" c& v - *8 u. z2 B% E+ o% h
- * This file contains EDMA3 Test code.+ b* _+ B8 _* z% |0 B+ a
- *
+ n% z H# X; `4 I) C- D7 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 z7 ^# K# J! w) G8 P# Q% y1 {2 Q& ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# N* z9 G% ]" G# V" B6 I* _
- * TO CHANGE.
i1 s* U0 v2 k ?5 x3 D+ Z& ~0 H - *' t4 N( R. V/ e2 {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% n6 L5 N$ M+ y - *
* U1 Y- i' Y/ U( b4 L - * This program is free software; you can redistribute it and/or
# n# f! M6 E2 _ ~ - * modify it under the terms of the GNU General Public License as$ V: n. r% L8 g$ Q* k8 Q; q9 x! D
- * published by the Free Software Foundation version 2.
4 c- d9 U! o9 e; o% M - *9 [; H5 _9 ^& \' ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) @$ n" j1 L& J2 G" J+ \* R; l5 i
- * kind, whether express or implied; without even the implied warranty
5 s- ^9 P6 T- b; B) f# F1 o7 K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' g* m9 {; [' E9 @, h - * GNU General Public License for more details.1 L8 g5 h2 `6 a6 Z
- */
1 Q* D% U3 m6 \
8 s4 s8 H/ J1 w& ^" ~- #include <linux/module.h>7 E* O6 v3 X- I
- #include <linux/init.h>
5 \' s: L5 Z' g! f - #include <linux/errno.h>* F5 G/ ^' j& N- r' I( p0 J6 F3 {
- #include <linux/types.h>
c9 n% [% Z( ~8 h" W4 Y - #include <linux/interrupt.h>
# L2 y+ M5 ]) q# r - #include <asm/io.h>
# h/ x+ w# ?; t8 \$ V" ^* @5 y/ j - #include <linux/moduleparam.h>
7 _" D6 m5 N' y. V/ u, t/ a* K - #include <linux/sysctl.h>
0 h1 o x( B2 [- L - #include <linux/mm.h>
- D) x9 [4 J' k) l - #include <linux/dma-mapping.h>
* E- e/ ~: J* \, N' Q2 O3 Y" d
& C4 e, _% q ~8 F! t( q+ i T4 W- #include <mach/memory.h> W% J) k! g7 g! ~# G+ X/ O
- #include <mach/hardware.h>
( M" ^; Z8 S7 q9 ~ - #include <mach/irqs.h>
, a& \" F+ Z; y4 z7 J - #include <asm/hardware/edma.h>
9 U- x( j' C K% f6 ?6 i4 |1 J - + ]/ F/ U) K5 t+ H+ I+ T9 N
- #undef EDMA3_DEBUG7 {" y- F% O/ }
- /*#define EDMA3_DEBUG*/
' K6 y4 o/ q4 X j0 b+ n
$ S9 m+ j3 u5 R* P. ~5 Y- #ifdef EDMA3_DEBUG, i: `8 f6 s8 `1 w% u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" Y& o/ y3 O- Z5 W6 ?6 S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" ? @; w0 G2 j# w2 y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 _* }$ Y. z- u2 m - #else
; s# `" }* Q5 a: L1 h$ l* k - #define DMA_PRINTK( x... )
1 v4 j$ E$ p; n6 a - #define DMA_FN_IN |( M: \6 \/ D5 f" o3 J; z1 d; L3 \+ }
- #define DMA_FN_OUT
- G9 H! ^. Y/ L* L - #endif
( T& A4 V" \' A( e3 S# \ - 3 O# v& ~0 k Z# i) M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- S- `5 u5 s3 w4 W" K6 i) P7 K
- #define STATIC_SHIFT 3. f( X/ t! M! g6 @' a1 n8 ^
- #define TCINTEN_SHIFT 20, C- b1 _% Y- ^, T- H, b% e
- #define ITCINTEN_SHIFT 21
; e q5 x7 t, B" s. h - #define TCCHEN_SHIFT 22
& O8 ]5 E: q8 m" r V - #define ITCCHEN_SHIFT 23
9 l) ~0 i$ J, f - , q$ x6 e" r7 b8 R- x
- static volatile int irqraised1 = 0;8 N6 \5 h& u: I
- static volatile int irqraised2 = 0;
" P* {% d, l: g) r y; P9 L& o2 U
8 \/ {2 \- \# b( p2 b7 y% q5 S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& P6 e. p5 @" [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 J- j: \7 \8 y& ]" L5 t$ d! v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; E" j2 S7 b Q2 Q
- : A7 `+ q. B9 \. Z0 i# X. z
- dma_addr_t dmaphyssrc1 = 0;1 R# ^* h3 o# w
- dma_addr_t dmaphyssrc2 = 0;" q9 Y: h# w0 X+ c
- dma_addr_t dmaphysdest1 = 0;* R8 a1 |+ G" Y% l, X7 O1 @
- dma_addr_t dmaphysdest2 = 0;8 @6 x8 ^. U# ]8 i# I' Z& K8 n s; l; S; Z
- % e7 w7 b% i! c
- char *dmabufsrc1 = NULL;% d% Z g! [! H
- char *dmabufsrc2 = NULL;
6 e* O- ~, \- ?5 F - char *dmabufdest1 = NULL;" K0 h) u! f# L1 ]8 y
- char *dmabufdest2 = NULL;7 X1 X9 T0 b! E$ Q
- 4 q% M8 l+ Y( j) @) R" O2 C& s
- static int acnt = 512;
3 u5 Z* u' s% r, k! O - static int bcnt = 8;
: k% r. G. G0 f: v/ I - static int ccnt = 8;6 f2 M8 X# n, b( h
6 G9 `* q* q# j( S- E* t- module_param(acnt, int, S_IRUGO);
1 Y+ _) n# h8 K% z4 g/ ]% ~ - module_param(bcnt, int, S_IRUGO);" t% _6 R$ @4 m- V" Q
- module_param(ccnt, int, S_IRUGO);
复制代码
; f/ q b1 ~: f0 D8 `, P) E: g# Z% E6 i5 K3 b8 Q6 X3 {: w$ o5 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! S! U9 U+ N: _: {5 H" T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. g- d- d! l1 R% B( S' k! F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) ~8 u4 [4 E/ e5 C0 Q a4 u8 M
; s2 h/ v# K! h7 Y7 v6 p& r8 K" ?1 a# D2 y' b1 k. Q8 N
|
|