|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( J w; n$ D9 A) M' v* N) K
- [code]EDMA sample test application
2 U# q, I/ |1 q - /*
+ ~3 F% |* v9 L. d% v# s3 U - * edma_test.c9 z4 ?( G3 L- R t% l2 a" J
- *
, i$ }) P: l+ T( J2 M) v - * brief EDMA3 Test Application
2 Y g J, L, [. J - *' i; P5 M' G. y2 W
- * This file contains EDMA3 Test code.
2 T8 Z3 g, j1 R8 h6 R - *
6 z$ ~; B# z4 n0 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* U& A X. O7 T$ C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ^: ^/ J: {: R
- * TO CHANGE.
# K2 D4 C3 c4 ? O6 o - *
% a# s1 J# r1 l/ Y0 J" r6 D! ^2 O$ A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" E4 R) H) ~, v1 P# A - *( M! S0 b' Y) L! v, X
- * This program is free software; you can redistribute it and/or
& |6 z, V% k8 S, R$ j$ `8 q - * modify it under the terms of the GNU General Public License as
% ]# f% F% b# s# p9 z - * published by the Free Software Foundation version 2.
' Y$ v2 [: @% f+ h' c - *( R4 p( G8 e* M$ R2 b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 w; U+ q- K: d$ l1 | - * kind, whether express or implied; without even the implied warranty
6 L6 m3 y9 n0 o% r, Q% ]$ }- P' w. Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ m `7 `0 I6 r. D% s; V+ I" @ - * GNU General Public License for more details.
W) a# d: V) `5 a- R& ]) V - */2 v; X: l2 u5 Q8 q$ ~
- , H, g0 J3 O M% D4 q% ~ [* M
- #include <linux/module.h>
; ?# C' Y- _/ l- n7 b - #include <linux/init.h>' F# ]8 k9 |( d' w8 H
- #include <linux/errno.h>: `/ Q O# C( a) E8 O! a
- #include <linux/types.h>/ ]" ?8 t( F& T. Y, @
- #include <linux/interrupt.h>
0 }, {% M& P d& R% { - #include <asm/io.h>
0 L* J/ }' R! r9 p' _4 R - #include <linux/moduleparam.h>
* I @: H9 K1 W6 _, b' y) z - #include <linux/sysctl.h>' k. y. c/ n+ ]
- #include <linux/mm.h>, X G% _9 {: r3 A
- #include <linux/dma-mapping.h>
5 E4 \7 G1 w9 T: L# D
$ }( k* e) R7 J- p. n- #include <mach/memory.h>" n+ F7 \3 B' G, N' ]! x3 n6 Z
- #include <mach/hardware.h>( H0 `+ h5 j G- k: }% h
- #include <mach/irqs.h>' z$ R! w2 I3 k+ S: V' P `
- #include <asm/hardware/edma.h>
$ ]- E* S5 S% \) y( R, ]& t - , c1 ]3 e L# m/ e5 s* q/ T( L
- #undef EDMA3_DEBUG
1 ^5 z! T. x g. a) ~* S2 O# O5 ? - /*#define EDMA3_DEBUG*/6 P, ]3 X/ T3 S+ s! d: G
, c8 h, @8 l7 _8 W; ~$ A' @- #ifdef EDMA3_DEBUG9 U% k+ m# x; e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 a) N( t. T( X' Q- _* H/ i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# K7 w; x. k7 n$ B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 {+ S1 ?% Q" c
- #else
" [5 o) {; d( R& c L - #define DMA_PRINTK( x... )6 F" N9 z# f Y6 L8 Q/ v+ Z( b
- #define DMA_FN_IN
0 F/ C( G8 J f( p5 Q/ f2 ]* | - #define DMA_FN_OUT& }" X' Q2 x, Z* M; L
- #endif8 [7 E; ]5 A4 b5 C- U( M- k
6 V0 B* q0 D! M( O! o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ p8 e/ Z7 A. Q; J - #define STATIC_SHIFT 3% f* F7 E% y r) x% J. N
- #define TCINTEN_SHIFT 20) R3 ^$ H) l! V
- #define ITCINTEN_SHIFT 21
( X) {( y" b$ @8 I! V e - #define TCCHEN_SHIFT 22
, a+ |" l: |7 n9 l5 b - #define ITCCHEN_SHIFT 23, n5 n, e& \, S7 A6 h
- 3 h: k y- G0 p! P _+ O. U. w
- static volatile int irqraised1 = 0;0 Z1 j% k/ m$ _( x* S" p
- static volatile int irqraised2 = 0;$ G$ l7 G/ E1 r, }" A' m P
& {- x- i- }# Y) F+ | s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 [! R) K5 [4 h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- a; B6 S9 C" E6 V5 x6 O! z5 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 B; U2 t7 M* v: Z* B& A1 n2 F: p! e+ |
- / ~9 h: G- I. ]2 _9 `% g6 S
- dma_addr_t dmaphyssrc1 = 0;
0 Y: z3 H8 p1 x s7 a: w - dma_addr_t dmaphyssrc2 = 0;( ~( T0 |1 D& {" l4 ]9 \, k
- dma_addr_t dmaphysdest1 = 0;
: J Q9 P) H$ G' t/ @. K1 V - dma_addr_t dmaphysdest2 = 0;
$ X1 Y( ?, i0 u8 ]8 O
) c' r! X3 g+ s8 u- char *dmabufsrc1 = NULL;6 Z( `1 m( o: [ f8 h+ ]
- char *dmabufsrc2 = NULL;
! J8 s& X! k4 f3 _% v. M - char *dmabufdest1 = NULL;; g( a* E- }. X# b
- char *dmabufdest2 = NULL;
8 H6 n: X' M$ C. U1 r3 _, [! Q
2 w6 B* H! h3 l' n7 E2 g% R' o- static int acnt = 512;3 S9 E8 \& K; D( o, \
- static int bcnt = 8;# J5 U; p$ b$ `# a
- static int ccnt = 8;
) O* T! v9 M9 ]+ I) K0 c9 B - # I4 m" d# G, c0 B* B
- module_param(acnt, int, S_IRUGO);, M# W' I% K- M: D0 G8 _ P' U
- module_param(bcnt, int, S_IRUGO);
: M: Y8 p0 h+ K; A - module_param(ccnt, int, S_IRUGO);
复制代码
) f* `4 S: s: ]! S
0 D' J: K, s' A' P; A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 H4 K9 i( Z% F$ o$ g8 D* i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* z7 @% v3 s6 P: {( `* h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* y( N' }5 o! f t1 l9 F2 C& `( x1 Q. v3 ]8 a# W& M% |, T
2 i. c# l( t' y8 N* [: w# x |
|