|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 w8 f2 K$ P1 |1 R+ i6 Z* }- [code]EDMA sample test application$ `9 t# x. G1 D. l
- /*
6 y$ m6 o) g: F6 T h8 O - * edma_test.c
+ d; K, J+ H @! x; H, h9 a - *
' X j( g) F# V' n - * brief EDMA3 Test Application0 I. a- u! E( g3 z+ ?2 G. v
- *: Y7 r% ^$ X$ c. P
- * This file contains EDMA3 Test code.
( L+ T0 {; c# k7 ~3 \) r - *. m! I! J7 S) U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( o, e2 G; Q/ V& ` Z3 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) ^! Z3 E, A' O @ - * TO CHANGE.
& ]+ [8 D o& s$ R$ P; G t* @9 i8 u - *4 ?* ^7 `) s+ ~7 {- \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) R9 `) O" Q7 q! S
- *
/ x! s' S O$ @2 r9 j, V- h - * This program is free software; you can redistribute it and/or1 {4 k/ I. s+ H! Y+ J$ X4 h& i
- * modify it under the terms of the GNU General Public License as
Q: Q0 s# j, \ - * published by the Free Software Foundation version 2.4 c" J# o+ n- F
- *
- h# M" D2 V5 I; L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 A- ]9 U0 a! u! D0 q( M$ q/ r# B0 p% y! t - * kind, whether express or implied; without even the implied warranty
/ I0 m/ G& v% m8 X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. W' {+ p' I( \/ z% R - * GNU General Public License for more details.
6 { h# w# W0 q# o7 c - */
2 W2 \% P+ a1 g+ [& ]! X - " p, @8 Q; s/ a$ g: v' i# X7 e. N
- #include <linux/module.h>
. s+ M* m/ Q8 E. l: w& a - #include <linux/init.h>
0 e/ s! b1 v) T3 Z- x2 ? - #include <linux/errno.h>4 r0 x. f5 c9 _+ y: W& i
- #include <linux/types.h>% T# Z3 l" e8 @5 h( N
- #include <linux/interrupt.h>
% E$ {; @+ _! A$ p( S* v6 v% l - #include <asm/io.h>
0 O N: g. j5 h - #include <linux/moduleparam.h>: c/ B. m: P) W1 u3 @/ {
- #include <linux/sysctl.h>
8 u9 n, j8 @% ~" i9 U- G1 L - #include <linux/mm.h>$ H+ D. V2 ?9 K4 H# R" e
- #include <linux/dma-mapping.h>/ B# W6 f5 V8 d
3 @2 Y* w, K3 O* ~- #include <mach/memory.h>8 @$ n+ U$ V: k- r7 Y' E
- #include <mach/hardware.h>
! Q" R" k' h9 e4 d. y - #include <mach/irqs.h>% h/ C- o) }/ k; {
- #include <asm/hardware/edma.h>
4 c$ z9 ^0 i. D; e7 Z
5 i$ W9 U* b: R+ d- #undef EDMA3_DEBUG. d6 ` p( X$ y @
- /*#define EDMA3_DEBUG*/# ~& d; E) l9 p( @( L0 `
0 Z- ~+ y9 ~5 w2 s7 ]% e- #ifdef EDMA3_DEBUG1 w! k% a ]( q+ O$ E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 W" N5 K% N2 L6 o; E# R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 Q; P% ?! d+ x! | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ?/ n) v5 H+ G& X2 E
- #else
. o$ n7 W( E3 ?2 g/ C. U1 A - #define DMA_PRINTK( x... )9 ]* c# K3 t! i% O4 O
- #define DMA_FN_IN
" u/ W, {8 Q# S( y - #define DMA_FN_OUT
5 e4 C, f2 S) I: u - #endif
& e- R: }4 |% ^$ f5 A/ m; Q3 y
$ c! [5 Q+ N% U u; W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 W7 \% x8 t& S - #define STATIC_SHIFT 3
( l6 p* H+ Q1 |8 p, k% c1 d. ?0 ` - #define TCINTEN_SHIFT 20( p+ Q, q( [, _- v' I4 a& i
- #define ITCINTEN_SHIFT 21' x9 A9 A8 _' q ?$ Q' l- w
- #define TCCHEN_SHIFT 22
, ~9 m0 L8 q8 ^) Q/ V. z - #define ITCCHEN_SHIFT 23
+ i/ Q* _; G8 ~
& ?( @, `) E8 m- static volatile int irqraised1 = 0;
; m- y7 m. e1 ^! u4 W# A - static volatile int irqraised2 = 0;* e, a/ P% [1 Z$ l4 x. S5 e
- 2 j& P7 B5 J5 ?/ A# o$ x. J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& y w& y8 i: m: V9 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! O2 b( F' E" h1 V# E& T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 J" G& `6 a' T0 ^. v
7 `8 }6 E/ ~8 C- dma_addr_t dmaphyssrc1 = 0;! |# e% I" q9 e" y
- dma_addr_t dmaphyssrc2 = 0;9 _! E" I" Q; G1 ~5 ?6 ^4 G
- dma_addr_t dmaphysdest1 = 0;- I; N% Z1 @; s0 U( Y+ F4 J8 I
- dma_addr_t dmaphysdest2 = 0;
5 ?# r/ N$ [7 a% e. d& r; a
, ?' R+ P7 \1 A- char *dmabufsrc1 = NULL;; l5 s7 N9 N# A3 D9 V; m
- char *dmabufsrc2 = NULL;% w2 P- K2 x# H! L+ O
- char *dmabufdest1 = NULL;% Z1 F% J$ J+ C X) |+ A, Y
- char *dmabufdest2 = NULL;
& z, p- _* m' _$ v$ q
/ ~+ j1 M I/ ?, u/ v- static int acnt = 512;" r9 C2 B& Y) Y% K& m
- static int bcnt = 8;
: V- s5 d u. y. A' [ - static int ccnt = 8;, n9 {0 e& I9 \7 L) `) Z
- $ g9 t: L4 D( V- D
- module_param(acnt, int, S_IRUGO);! E8 ]. P" W! ?: H+ E$ i: G/ `
- module_param(bcnt, int, S_IRUGO);
, u- u; @* ?' h( ^ - module_param(ccnt, int, S_IRUGO);
复制代码
2 Z5 h& O/ O7 D! i" `! d) u+ B! M4 q- u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; W& ^. l. @. @* ]/ F) x9 J% Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ G) k3 ^# C. T$ o% d* e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 t/ i9 G, f. r& U, b+ p
" X$ @: l4 }5 W; Z3 V9 K; T2 t" j3 c, C8 n7 y, ^
|
|