|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) j- G) w$ l' H
- [code]EDMA sample test application7 v. J$ a/ N4 C2 {$ m# @
- /*
, G8 X: F. M1 Q- ~ ^ - * edma_test.c9 a# L2 n$ Z2 M
- *
7 `0 e f& N1 n b - * brief EDMA3 Test Application2 X) l l3 R: U p- h1 e
- *5 B8 L6 k+ s4 S6 s) ]
- * This file contains EDMA3 Test code.
4 y, Z7 H, I! d - *8 [& o) s4 s6 E% z3 i6 Y, q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# n2 g+ o9 Z I; }" P7 w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# y2 Y. Y% K c! x5 z% B' p: T$ R
- * TO CHANGE.+ W0 p! G: o* k5 ^1 s
- *& C5 O+ w) d: C, s5 H- F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: q: T8 T8 S' Z: m6 J) b7 A9 v - * _" b! |4 ~0 \$ J9 G+ k
- * This program is free software; you can redistribute it and/or- K. `6 B$ N- n% Y0 E. p6 ?. b& H( q
- * modify it under the terms of the GNU General Public License as) M" d% y3 _( E# ^+ [
- * published by the Free Software Foundation version 2.
1 l, C: G' i/ K# d2 D- X" @ - *5 u( e% O# G( G2 E& X$ b O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ O5 R, E2 y* |& k8 u, J' g3 G - * kind, whether express or implied; without even the implied warranty
3 F) A* w4 X+ n& S- M! f1 Q; B/ M# E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ i% s+ j U+ o8 h - * GNU General Public License for more details.
1 g% `1 \- s9 R' C7 U& ~/ q5 F! T - */+ C$ G% q9 K: ]
- : l6 v2 {6 M# _+ q* K: |
- #include <linux/module.h># k+ g7 q! w& R
- #include <linux/init.h>/ g3 o! m/ U s9 g; _
- #include <linux/errno.h>6 x( }& p! }& j: W# x1 v
- #include <linux/types.h>! u* ?* Z' l) ]2 `
- #include <linux/interrupt.h>9 Q/ H6 ]2 m0 j; ]7 K
- #include <asm/io.h>
3 h5 z4 f5 ?9 o: R! U- W# O - #include <linux/moduleparam.h>
( V. x+ M8 I# z+ w) F( } - #include <linux/sysctl.h>) W0 f( S* [, f5 D5 S! p
- #include <linux/mm.h>
$ `2 e. C& X6 _8 i# e* |. T: m - #include <linux/dma-mapping.h>7 ~1 I! ?) g/ A; X
9 l: G$ C' E0 I k2 q2 I" W! U- #include <mach/memory.h>& C7 i! g( x( Y3 F
- #include <mach/hardware.h>
3 M1 C) _1 f+ n* L |# [ - #include <mach/irqs.h>3 b% b0 X/ K5 Q( p4 x$ t( O: `6 U
- #include <asm/hardware/edma.h>
3 C- M# K" i1 B- E, E" l - # R9 r$ Y( ]# V0 l d8 C
- #undef EDMA3_DEBUG
5 ]4 x7 U! N: j - /*#define EDMA3_DEBUG*/5 H- R) J! D7 ^7 d
1 w) p6 r; L2 @( t* B- #ifdef EDMA3_DEBUG
$ K F, |6 ~- @9 N& x. s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 m' @* D8 I$ H. N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 q H- n, C. F. }5 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 h6 D9 s4 ^7 _1 @
- #else
" _/ u, L0 i( I! n3 G% b - #define DMA_PRINTK( x... )
4 [6 x4 g/ d/ R0 L F. _* \ - #define DMA_FN_IN
4 ]' t# m8 u" y. ]" ? - #define DMA_FN_OUT
; V. f; v9 S/ \ - #endif, Y% k% z9 R. M, g' g
- . Q3 w+ y) { l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" }# _0 k3 V* w4 d$ y( }6 X9 @
- #define STATIC_SHIFT 3
) J9 R+ r' l( l; { - #define TCINTEN_SHIFT 20
+ X' c" L, x- q5 K) X - #define ITCINTEN_SHIFT 21- s6 b; }# r4 V
- #define TCCHEN_SHIFT 22
7 }+ {2 Y& }9 k6 W - #define ITCCHEN_SHIFT 23
+ i2 \ T0 ^3 q0 U - ; T# B% c0 S! K4 q. Y# W
- static volatile int irqraised1 = 0;
" M0 f& h3 R% x$ u& G/ ]8 W2 T - static volatile int irqraised2 = 0;# c W9 d4 g3 s
% B" y5 y8 V) z- b, ]& ~6 Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! I0 I7 ]+ }" J8 n5 G8 I5 ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) s7 b! |0 q6 \2 i( Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# M5 N9 k. o' C R) Q - ( U5 ~- I N$ p% t% O
- dma_addr_t dmaphyssrc1 = 0;5 M4 A) n, W5 x+ w% c
- dma_addr_t dmaphyssrc2 = 0;/ {3 h2 R( ]& k. _9 Y n2 c" }
- dma_addr_t dmaphysdest1 = 0;$ a" n. a& C. D5 r
- dma_addr_t dmaphysdest2 = 0;% a# `$ c5 g1 ~8 t4 {
# j" C2 W; a1 p% P& o: N- char *dmabufsrc1 = NULL;
* Y5 X' g- I d; H: z7 g8 A1 @ - char *dmabufsrc2 = NULL;! M. L$ O4 `/ M- ~+ }0 d" O m
- char *dmabufdest1 = NULL;5 g. [/ b! K" R% T8 q, l, x) e
- char *dmabufdest2 = NULL;1 f! D$ u8 z4 H1 c, R Z4 g8 P, W
; n3 J }7 n9 M9 W5 P- static int acnt = 512;7 F: ^6 e0 c5 `
- static int bcnt = 8;
! ]. L8 ` ^0 D' }/ S; j& } - static int ccnt = 8;
4 L1 T+ ~) p1 |5 D - , j( Z: y8 ~: S" |- T7 q
- module_param(acnt, int, S_IRUGO);
& a. j( Q8 M9 D" E: _1 p% m - module_param(bcnt, int, S_IRUGO);
9 X; c( A4 q1 |- k, V. k4 h - module_param(ccnt, int, S_IRUGO);
复制代码
" A4 q" H( [+ @ b+ w/ R( V0 _, p3 y! t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# V( Z8 w, V2 H6 Iarm-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 m8 @/ n3 }3 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' _1 q4 }" q" ^ @' T
# ^1 Z# ~6 L0 j7 R) `2 N$ ^9 g( ?8 I
|
|