|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: C$ Y+ S# V+ L& r- [code]EDMA sample test application
5 y) R% @ |# j# G! X - /*
: z) [% z. p; P2 h/ g2 I - * edma_test.c
3 g7 j5 x3 j* j8 O3 `& ? N3 u - *" c8 P; ~) B( {' V9 ]+ c
- * brief EDMA3 Test Application2 X& [* E# b. o* h' f: F" M( w0 {
- *1 T/ B! S2 T# K% E; F* P+ Y7 O
- * This file contains EDMA3 Test code.
: S& C! m( i4 M- p - *, W# M( b; P! o8 s6 W5 ^$ h0 y9 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ O! a* Y# Z, v( Z& X, @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ |8 r d; `; K) q: [
- * TO CHANGE.5 v9 _2 s- G3 s8 X+ E
- *
* G v! m4 N7 P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 a* Y8 c5 g- l( g7 e, T. _ - *# {2 S/ W2 m1 P$ |( p- V4 {
- * This program is free software; you can redistribute it and/or
$ o/ E$ f& p$ ?3 b% y7 Q- u - * modify it under the terms of the GNU General Public License as
4 p- C0 e4 Y0 w3 z, [5 Q - * published by the Free Software Foundation version 2.
7 J( ]7 q: Y. k6 Q0 A3 y - *
4 e/ P0 e3 k9 ]' J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* g8 `& o) x$ [+ l7 ^ - * kind, whether express or implied; without even the implied warranty) K3 m: ?$ z3 P' P3 Y% K ?) t9 ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) T7 l0 O, R' v' @3 P
- * GNU General Public License for more details.
6 E/ Z/ x! F6 G& ^ - */
5 s: j2 m7 I, v9 n* j - 8 r( Z4 ]* @% t/ ^4 ^
- #include <linux/module.h>
+ {: r6 L' B& t) l( Q3 ]2 e - #include <linux/init.h> d2 y8 M6 p; Q) l. F4 y2 A
- #include <linux/errno.h>
+ I J ^# B# E0 f - #include <linux/types.h>8 j$ ?9 N% T) Z0 G" N
- #include <linux/interrupt.h>% a- L, G( A) @% N3 u
- #include <asm/io.h>4 L7 m7 N5 j, M0 m
- #include <linux/moduleparam.h>- Z0 w. r6 O+ {( d) }
- #include <linux/sysctl.h>
2 E" T* [. _' b* d" T; w0 |1 \ - #include <linux/mm.h>
+ K1 x' z* F- q8 G+ k, Q9 _: } - #include <linux/dma-mapping.h>: Y/ T/ d* E# {" x& m0 i
6 \5 f8 L: Q6 d8 V4 J- #include <mach/memory.h>
# ]) K9 _6 R4 a1 V0 w8 L0 V( Z6 Z - #include <mach/hardware.h>
7 ^. H8 v- G! c - #include <mach/irqs.h>0 n* Q0 a% p0 y) `
- #include <asm/hardware/edma.h># c. F0 q8 ]2 Y4 @* d- C7 R
' g" {" E+ T1 Q' w7 n/ _' t4 d- #undef EDMA3_DEBUG
4 R; |! l, D5 N7 u% h" J' i9 W - /*#define EDMA3_DEBUG*/* v9 w4 R+ G: E9 V* l
- 0 P( T7 ~; b- h4 h4 l* R6 i
- #ifdef EDMA3_DEBUG! G% i$ d7 J, O4 J9 P% C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 A7 t, S, P9 {' j0 D4 j/ ^4 f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 K$ _' F1 r( R& D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% u/ ^0 c* X; H1 i ^4 \ - #else5 m3 t4 K8 _9 c5 y% K! f0 V1 D6 Z. C
- #define DMA_PRINTK( x... )
' [# v7 j" n. Z6 F- U5 j9 K - #define DMA_FN_IN. d& c3 j* Z2 c
- #define DMA_FN_OUT7 `# p. I* r; x2 K
- #endif
3 }+ e% V+ }9 q+ k
- q5 t+ g+ G: F8 z, T- r" w: ~* L# ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768): `/ ?! q& b* |4 Q- I1 E: r' T8 E O# A
- #define STATIC_SHIFT 38 a% L8 q; Q4 d
- #define TCINTEN_SHIFT 20! @ Z6 a8 B3 n9 f( R
- #define ITCINTEN_SHIFT 21
6 k0 B5 z2 ]- X. x7 D2 `4 H+ f - #define TCCHEN_SHIFT 22; r' |6 G# v; d: ]6 N& i' E
- #define ITCCHEN_SHIFT 235 t+ u- j8 s5 @" w5 Y
' F6 W- p! g! M- static volatile int irqraised1 = 0;; f& ?: ~0 W. s- \5 d
- static volatile int irqraised2 = 0;" _; [7 N3 ]$ d& s4 [. y# S6 l
" g" M1 B1 o. g/ R1 ?4 t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 e- S# G8 Z1 E7 ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 k" ~2 |+ d+ J5 O8 |* e+ s& g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; e7 q. Q' v3 _3 Z6 K" G - : o% Y6 H8 s7 K" p. |! g/ D1 C$ y# I
- dma_addr_t dmaphyssrc1 = 0;
7 \0 g5 b$ w0 c: i - dma_addr_t dmaphyssrc2 = 0;6 `+ z, V& I+ X5 s5 C: O
- dma_addr_t dmaphysdest1 = 0;
2 }6 x @( M+ A$ v - dma_addr_t dmaphysdest2 = 0;
; x9 v1 c2 C# z3 g$ Z2 m - : x; w) e x2 y6 \( s+ I* q. f6 }
- char *dmabufsrc1 = NULL;
" a0 W7 W# ?+ `3 c. z - char *dmabufsrc2 = NULL;
9 _! ]1 J0 }* c4 p" [ - char *dmabufdest1 = NULL;/ j/ b9 v& M" r E( B$ f" g
- char *dmabufdest2 = NULL;& I9 [- g1 X- v5 e* F# f5 T
# J. q/ G" E2 G/ s- n) Q6 [- static int acnt = 512;" W( f9 l7 l6 S5 R6 v( K/ H
- static int bcnt = 8;
0 ?: Q5 V! t; a+ w# \; g2 [ - static int ccnt = 8;
4 @7 ]5 Q" I1 N5 j; a5 N - 2 F- e: K2 i: m* e* Y9 P3 H# g3 x
- module_param(acnt, int, S_IRUGO);
4 Y1 Y, \9 W# ?3 _! x* R - module_param(bcnt, int, S_IRUGO);' {5 i0 |) c9 M4 }% b, U7 E
- module_param(ccnt, int, S_IRUGO);
复制代码 0 _$ k4 x; l9 l# T
4 \2 @0 W6 P: N5 b" C; c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' [% N) Q1 P2 C$ jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 o/ p: z3 `1 h6 ^7 y; c8 q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; Q- [, J# b0 S" C/ M
* p1 r5 u4 z. t2 t
a3 _8 z# _3 v! B, x7 v* P% l
|
|