|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% B0 c$ l" h$ |4 {; |- [code]EDMA sample test application& K, ~+ E, [* r" l$ S+ n
- /*
$ Y2 O7 k5 K$ I f; H! V# d8 O - * edma_test.c
: A% S9 Q3 D% ~1 W7 {/ |4 x - *. S2 z3 G+ `) o. O
- * brief EDMA3 Test Application4 w, q0 E) X K2 q5 q% u
- ** o) A/ M. ^$ ^2 I
- * This file contains EDMA3 Test code.
+ D( W! r, `+ [* p7 m - *: ?; ^' v4 ~- z% V# V+ l8 ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' u8 b) `/ n4 z; q$ L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" P# q3 T* N, i1 T* A3 I4 `5 @: s
- * TO CHANGE.7 e. b7 A6 `* O$ e
- *
% k) H0 h6 x6 _( c% O$ a r+ @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& G9 G5 l, V" n( Q* O9 k/ z - *; `* G& x7 C. ?5 I0 H
- * This program is free software; you can redistribute it and/or' E) y4 s8 W' i2 m, C1 V
- * modify it under the terms of the GNU General Public License as
) p8 X. e6 u5 v# F* q" Q# _ - * published by the Free Software Foundation version 2.8 T; o) }6 q, E& b
- *
: W! L0 P T9 ~1 r; C# m; n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: W2 G0 o- {- T- D5 q- a9 f/ A - * kind, whether express or implied; without even the implied warranty
8 Z# \8 @6 f. Z0 @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. l: Z3 m `$ x9 b" T* f - * GNU General Public License for more details.
5 c$ p8 ]1 l5 u; l7 p# j - */1 L4 e- `' a& E1 E1 x: F
- $ R$ W% J6 i7 E' d% D0 A
- #include <linux/module.h>+ ~$ W) ]+ g) V
- #include <linux/init.h>* F+ C% U) `3 P6 K& g5 p
- #include <linux/errno.h>
/ k4 ~: b0 w4 u - #include <linux/types.h>, D$ N. s$ X3 r7 r
- #include <linux/interrupt.h>: o5 U9 t4 _; b: Y5 k. {& r
- #include <asm/io.h>; z+ X6 o9 g. D% H* L, c1 g9 W O
- #include <linux/moduleparam.h>2 t( g* H H; Z: W
- #include <linux/sysctl.h># e# b0 {8 B a P4 O9 s' }7 O4 Z# n
- #include <linux/mm.h> t+ b+ i: Q7 S6 F: J1 N9 w! X
- #include <linux/dma-mapping.h>; I; k! r i/ o% m5 f* P/ a
- 4 @2 J3 }! o% Q2 F5 G9 A W
- #include <mach/memory.h>6 f. f8 I1 k; {; w& h
- #include <mach/hardware.h>. E; h/ n+ n1 e. d3 Q/ c8 R
- #include <mach/irqs.h>
, C6 x p: P7 ~9 a, ?; H$ b - #include <asm/hardware/edma.h>
9 r$ [& X5 G$ }% ]" S" U - + p8 U( t# h% W# c/ P7 U
- #undef EDMA3_DEBUG( Q, Y$ }! P, L$ ^: W) }0 ^; K, @
- /*#define EDMA3_DEBUG*/5 d) V+ \! A5 |* y$ C- G4 a# j
# _) \8 x, ?, ]/ g7 d( o- #ifdef EDMA3_DEBUG
- I q& N% Y- p N& X2 s i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 I* Q$ a) m7 a6 r% q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( J3 {. ?* J( \- q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% U( d& ^& K1 G' d% B
- #else
& |) o0 I# H+ T# W/ P - #define DMA_PRINTK( x... )
) o `/ w5 l$ L( Q! p* v - #define DMA_FN_IN
( S# p6 `2 q2 i3 g) J# M - #define DMA_FN_OUT
$ }$ F6 ^- h, w4 h. ~ - #endif
7 p! l9 f1 J2 n1 g5 k% K `3 W
W# C) x) p+ k5 O: X$ U# Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ c2 T( a8 b# _3 r - #define STATIC_SHIFT 3, `) M. l; M* @1 {. I J
- #define TCINTEN_SHIFT 20% T' e3 e/ ~" q( H! d3 z
- #define ITCINTEN_SHIFT 211 B3 Q! @" R$ `. g% m, x" K$ O
- #define TCCHEN_SHIFT 22' Y( i+ c `) g( ?9 U. W, t
- #define ITCCHEN_SHIFT 234 v5 e$ U* a! ]; s: l$ s, J
9 h0 v6 |, @& N I/ x- j& z- static volatile int irqraised1 = 0;
6 z; h8 ~& h4 e6 p/ K+ ]8 ~: A! s - static volatile int irqraised2 = 0;
3 f4 [) X) G. q% {. [3 A, {2 y
2 U* T1 ^2 b2 \2 {+ p" d# N# O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ^$ U# |* \" b5 |, {4 F8 P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 G" F# }" u t+ J5 p% |- R8 a, H/ ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ], x% d L/ H8 A ?* Y
+ i. @) S: S: c1 Y& t7 z: U- dma_addr_t dmaphyssrc1 = 0;, ]* r$ H0 Y9 f1 C2 i
- dma_addr_t dmaphyssrc2 = 0;# j/ N/ j! G. `0 W7 V# H$ v
- dma_addr_t dmaphysdest1 = 0;
6 e( C0 h4 A% D; Y" P - dma_addr_t dmaphysdest2 = 0;
! O7 A" I8 q; B* m) _5 C( ~
5 g# |& T1 M. i( Z2 l0 U g5 U- char *dmabufsrc1 = NULL;2 v: n: {# I8 C6 `
- char *dmabufsrc2 = NULL;
- o6 r( J/ ~% G5 H! O# w - char *dmabufdest1 = NULL;
, W. [5 x1 \! L$ N/ p% Q - char *dmabufdest2 = NULL;
1 _7 ^% q! S. c. f6 p. \: T - i; ^# a7 X/ ^% |$ O% c
- static int acnt = 512;
; m: A% [, V) E' e. ~) N - static int bcnt = 8;
7 ~0 Q1 k. @. i' l0 N7 K - static int ccnt = 8;/ y0 Z. \# K( m. w: O7 J6 t3 y
- ! |4 n- d/ E* ^! A" L
- module_param(acnt, int, S_IRUGO);' {0 N) O9 l+ J5 z% Q: S2 h
- module_param(bcnt, int, S_IRUGO);3 f6 j$ B/ w7 q
- module_param(ccnt, int, S_IRUGO);
复制代码
" H2 c7 p. o7 c
/ ^9 q7 O" F, `$ {# \" {& H5 g) m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( i/ N1 C' U9 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ u. C' k l. }/ C. B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 m- `6 q, p1 I. m6 ^6 I
' V3 U4 z2 w2 B: b4 J6 f: Z y7 [
: r) {+ a' d8 u# u+ w/ t1 h5 Q" m4 S; U |
|