|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- S4 i$ W; X" k7 e/ x$ z! ]3 @. v. k- [code]EDMA sample test application
1 `9 M3 J2 t9 w7 ?) Z) O4 M' J - /*, D, X* |9 I; |0 y2 s3 v
- * edma_test.c1 L3 O9 D/ @7 O" `$ k8 u# T
- *
- c0 S+ U s* S2 A) W. j4 Q - * brief EDMA3 Test Application
. C9 Y7 m- V9 K9 N - *# q/ \% F( v6 R/ R l
- * This file contains EDMA3 Test code.0 N# @/ O$ ^8 ?- W
- *- f* I$ [. F5 @: N3 X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; x# n9 D" G$ x1 x7 Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 S9 c8 g$ G2 ~2 g$ L5 G - * TO CHANGE.: l* z2 k" q/ d7 _
- *
; h S' ?. E+ \0 j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 i' G7 C4 h/ `8 ?5 z - *
8 ^5 n8 R3 F( X7 B$ t! } - * This program is free software; you can redistribute it and/or
) O& p2 ]$ O, ~2 j- p: f* G - * modify it under the terms of the GNU General Public License as( s8 ~; }- z/ l2 G" L
- * published by the Free Software Foundation version 2.
! @/ u! S% e! O; e0 T3 z# q - *# e9 Y0 g7 x' k8 D! t7 a3 R3 U$ @+ ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) {; ]* a3 r) F. R% _) _3 W - * kind, whether express or implied; without even the implied warranty3 \ V/ i6 F E! ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. r$ X6 o4 c; Z2 m - * GNU General Public License for more details.
9 }" E8 q2 z2 e2 z; W - */
' p# b7 f2 W. y# s) m - + }. G, V3 r, j
- #include <linux/module.h>
- W. H L0 F8 i! E. G8 t# I - #include <linux/init.h>
$ G. e& X3 H3 l0 ?1 |0 Q - #include <linux/errno.h>
2 j% K5 I/ q8 ^) i" Z* A( `5 s1 d: F - #include <linux/types.h># s6 G' E. z# Q4 R7 q, J* b0 K. n# T
- #include <linux/interrupt.h>
- G V' ~ k2 c3 | - #include <asm/io.h>
w& V- ]) r; P5 |+ k& }: O - #include <linux/moduleparam.h>5 w- W: O" _5 B% ]/ S
- #include <linux/sysctl.h>
$ Y- E) Y0 g0 u- r3 L$ } - #include <linux/mm.h>- d2 \. `4 `! V
- #include <linux/dma-mapping.h>) E# i* Q+ K" P9 O
- + n2 J3 I' [" w4 B2 a- l9 [2 o
- #include <mach/memory.h>
: g9 z. N% t! d% W - #include <mach/hardware.h>
$ I- D- V* W$ W$ g {# {4 n - #include <mach/irqs.h>4 H1 C3 r( U( |6 R5 G0 `- v6 r
- #include <asm/hardware/edma.h>1 h* @0 S0 `, q# y w# J( h# A9 Z
$ o* I. v* y1 r a- #undef EDMA3_DEBUG
8 u$ P+ V5 D/ o/ M: m - /*#define EDMA3_DEBUG*/
) s+ |7 d$ p- N& E7 J - : y! s% A& B* H. M5 e' o+ C; W4 O7 o
- #ifdef EDMA3_DEBUG
; f# R0 [; Y; m% l4 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% R, Y+ v9 O+ Y" C: z) j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 o* O2 q3 D4 \+ q, F9 _3 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 q! r& O* D3 d$ i* p+ ]/ Y - #else, p9 ]7 K) `. ]) o) Z" a. S/ E8 \, _ Q
- #define DMA_PRINTK( x... )
) Y! h8 M4 p7 L$ f - #define DMA_FN_IN
- Y G6 ]. R- h+ T' {2 n - #define DMA_FN_OUT& m2 z5 n' N) b' U
- #endif
+ Q Z/ u+ q1 {. z% K - ' Z2 e" U3 Z, [: ?0 ?8 H+ n# t- L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) X# X2 m2 e! b' i0 B
- #define STATIC_SHIFT 3
2 r2 G0 U) f" y. C: ~ - #define TCINTEN_SHIFT 20
8 Q4 ?5 S2 M6 A% B. x" i0 _, l4 C - #define ITCINTEN_SHIFT 217 p: L# c p# A8 q$ ], u% f/ _2 H3 R6 ?
- #define TCCHEN_SHIFT 22
; _& h) J2 A; F8 l: x( H9 P - #define ITCCHEN_SHIFT 23* F6 v. O4 P1 }; Y& x2 t+ h
- 1 ]5 |7 ]5 I- j* G
- static volatile int irqraised1 = 0;; h9 P4 T& i' i; v; O& K5 K
- static volatile int irqraised2 = 0;
9 R( O- x; E% P: ^- V. A3 h - 5 l5 H9 @5 j6 t- o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# J8 V: x- w1 t* |8 q4 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, _ m) R0 c5 z6 i6 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% E5 y, I* r; |$ U) r
# c& ~3 a# }( H2 `* w- dma_addr_t dmaphyssrc1 = 0;
6 V0 c0 j3 f# f! ?2 i$ ? - dma_addr_t dmaphyssrc2 = 0;
8 N; k e9 H) P& T: I - dma_addr_t dmaphysdest1 = 0;% s# |1 Y- {' K7 j* t4 v, u
- dma_addr_t dmaphysdest2 = 0;
5 d0 R8 g* y! G4 v, K4 o/ _7 E - 6 b3 X2 d, p0 g9 p/ s# E
- char *dmabufsrc1 = NULL;. J0 s% A: o4 r A( y
- char *dmabufsrc2 = NULL;* T# `. N: u4 A; Q: Z) X8 X2 s
- char *dmabufdest1 = NULL;- f8 Y: o6 G1 N* D# }
- char *dmabufdest2 = NULL;
/ R# Q- }! l7 y) q& D: t
' E( |# `5 W7 E- f9 O- static int acnt = 512;
+ m5 u1 L8 ~ F1 X" `7 Q - static int bcnt = 8;
1 o+ b3 S2 c* ?3 t4 G5 c8 R8 n - static int ccnt = 8;
8 J4 W5 q% R$ ~& l7 Z9 M; \8 l
% L+ }9 q- F9 @; G6 e- module_param(acnt, int, S_IRUGO);
1 S: q; H( Y. ~6 a. Q6 w) G+ h- k - module_param(bcnt, int, S_IRUGO);
0 n# a1 s# P0 P7 o - module_param(ccnt, int, S_IRUGO);
复制代码
1 G5 ?3 T! }3 I% Q* N) L
9 L F7 |/ z+ o4 M6 j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' C2 F+ k3 D8 O% \& E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
V8 J' f( K! V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) [4 T7 J* A' l4 { r8 ]
# @7 \0 s7 I& Q" x
2 r _, z$ t* E& n/ D* ]. v
|
|