|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 L* F5 X; M9 E( l+ e) C2 g- [code]EDMA sample test application5 U4 P+ Z. x1 z9 i. Z# N( }
- /*
% c7 V8 B' u5 j! U* f+ Y' B - * edma_test.c+ n2 P" N! R$ j9 a, M6 C
- *
# z$ n" Y6 Y3 T/ D( q5 `& D - * brief EDMA3 Test Application
* M) ~# q/ o! H1 B, a - *# L$ z4 @5 _& j; ]* H1 Z1 E
- * This file contains EDMA3 Test code.
7 e: m3 g6 x' J) K6 J3 q - *+ [: s0 e1 z- y+ B7 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 C) d! ~ }# ^# j m% ~; u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ G# ~9 q0 H( j - * TO CHANGE.* u) x* f! d. h8 J
- *
, k# o. q8 j I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 K. T4 {8 j2 w% [; } - *' _* c2 D6 w+ f# k
- * This program is free software; you can redistribute it and/or. c4 Z5 c$ h9 G- G- F" c" {/ m" O7 J
- * modify it under the terms of the GNU General Public License as
1 k* |9 T9 t/ n - * published by the Free Software Foundation version 2.
& I4 u/ l; R2 j) I1 X - *# b4 e9 w/ z. j& W. d: M0 S# Q4 \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 F0 k) r$ n' Z1 X - * kind, whether express or implied; without even the implied warranty: G/ f4 G! e& o: a6 [' H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- i2 o% @& O: ^ - * GNU General Public License for more details./ X' E/ t+ g& Z
- */
& }- U6 ?) p" }8 p% t3 s* O5 }9 s - ; i4 s% [$ ?! M; h1 X, |) b
- #include <linux/module.h>5 @1 w6 A8 }4 n# m1 U8 n# c
- #include <linux/init.h>7 }; r m; Z) c. [6 [
- #include <linux/errno.h>
! r$ G2 y1 O) _+ D. r - #include <linux/types.h>
8 E' z6 |- A3 [1 p: s' y - #include <linux/interrupt.h>
! O; l! j5 h5 y- t6 {. n% ]! F H - #include <asm/io.h>
' ]+ ?. W1 R4 ^: e# q - #include <linux/moduleparam.h>$ K/ F/ _5 k t
- #include <linux/sysctl.h>& K9 I, B' ^% S I" T5 i! U
- #include <linux/mm.h>& k8 ?8 ~3 U, t$ B6 N& g
- #include <linux/dma-mapping.h>
. W" B& H+ t/ \8 S9 Q, Q. Y" W - 1 D/ H. k2 G5 a
- #include <mach/memory.h>: s- X( [, E5 z' o" b1 Q
- #include <mach/hardware.h># T- Y z* m0 M1 {3 w4 k6 F" T
- #include <mach/irqs.h>. {& x5 A1 W4 w0 s$ B
- #include <asm/hardware/edma.h>
% Z# ?- F4 J9 d3 j4 R. D/ U8 g
) h) g# I2 S) I: e' x9 z" ?& X8 y- #undef EDMA3_DEBUG4 j9 q8 K9 x* |
- /*#define EDMA3_DEBUG*/
2 c0 D0 G8 A% q" D# X/ { - - \# t7 j* E4 e2 }& c1 x7 H
- #ifdef EDMA3_DEBUG) N! ?6 h- V0 l e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& k1 T- { w5 y+ `: \; } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" u% n. s6 r, L2 F! P$ ~- e3 T. w: t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; m' c5 `/ Y3 d% m - #else
. o7 @& ?' e& F. u& w# l& M- G - #define DMA_PRINTK( x... )
3 m1 o( z/ X; K" I - #define DMA_FN_IN2 d' E/ u; L" l) r# D8 m
- #define DMA_FN_OUT
3 ]3 ?! X8 x: r - #endif; [8 X7 ]/ ]' x6 Y3 C: B
- 0 M: N% w5 _: v# D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ |3 Z& O, j+ ~' U
- #define STATIC_SHIFT 3
6 n2 g3 U" z& b3 ?! U8 _' { - #define TCINTEN_SHIFT 202 d- B7 y$ j0 C% b9 [
- #define ITCINTEN_SHIFT 21
. V T/ `4 R z - #define TCCHEN_SHIFT 22( G$ B% L1 P/ W% m1 L" q* J
- #define ITCCHEN_SHIFT 23 H2 D8 ~# n( w: E
- $ R1 C8 D& y! A4 {. I
- static volatile int irqraised1 = 0;6 l. i0 Z8 a2 c1 h# `; W( J0 c
- static volatile int irqraised2 = 0;
5 r. q/ n/ G7 n9 q0 M: T [! b
# j, g) p+ w# I6 s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 s8 |. ^' L: I8 b9 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 X2 w3 Y0 O- b$ R8 ? d+ ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ L: c3 k6 i" ?, M( v0 F# X7 c - 9 o9 I+ {- R" L/ s7 a3 |' ?# ^
- dma_addr_t dmaphyssrc1 = 0;
5 d7 X! _( n( ~7 I - dma_addr_t dmaphyssrc2 = 0;
0 z- ?% Z9 q; S+ @0 }* d' c8 Z - dma_addr_t dmaphysdest1 = 0;
: I- m: `4 `5 s9 C - dma_addr_t dmaphysdest2 = 0;
/ z ]( D; n: [% u! o - + [) h- g4 V z. @ N
- char *dmabufsrc1 = NULL;8 W n' Q4 V$ E' N. G2 E8 V0 {
- char *dmabufsrc2 = NULL;
' a7 O/ @* o/ X! I$ k - char *dmabufdest1 = NULL;) v: T2 B: c6 v6 _
- char *dmabufdest2 = NULL;9 Q( Q0 D9 s h" f" F! W
- - ~4 @- c& D/ p% ? _2 ^
- static int acnt = 512;
4 [) X* W# k! T) ~; ^ - static int bcnt = 8;
; L/ q& f l4 B, J- O+ C7 V3 K - static int ccnt = 8;" V7 s a/ R5 V! v: \# z
4 t. J% a" `8 Y* f3 p- module_param(acnt, int, S_IRUGO);
: f- I H1 g' G6 I/ i% C J7 K - module_param(bcnt, int, S_IRUGO);9 U. [; D h Z l- B. S) n
- module_param(ccnt, int, S_IRUGO);
复制代码 ( j' E* v3 X# j0 q
+ ^* }2 Q. P$ x L9 y5 F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
|1 w7 ]% C- O e8 w8 ?% Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ M% C9 i* c. |) C2 G& \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" G* x8 j$ |% O6 Q1 U5 m- V* i2 ~" G
& c+ y/ ~% B8 a( i* n, q" b2 O
|
|