|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% n7 L& \- l* x. k! j- [code]EDMA sample test application3 o" {7 q3 ]! i- B
- /*% E$ O5 C$ {/ P4 Q3 R
- * edma_test.c5 X4 s! N" i% T$ q
- *
/ y! |6 h/ I% q" Q - * brief EDMA3 Test Application
6 `- M, Y/ D i. U: N - ** o/ W0 e4 }% W! c3 g! s2 |+ G
- * This file contains EDMA3 Test code." `6 n* o6 R9 [; U* d
- *' A& D6 J3 D* B, ]2 w/ Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( a; P# S& t ~' k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT q' M; B! J% B! F( V
- * TO CHANGE.$ N/ c* S1 j: I9 E9 _
- *+ P. P+ g) s, I- i% P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 g$ U: ]- ?8 {* M+ @
- *
* e% `% [. w& \1 i- ^; C! `6 x - * This program is free software; you can redistribute it and/or
/ T3 U- w) Y9 G7 c1 i - * modify it under the terms of the GNU General Public License as
3 o0 R1 l) v3 J' H, x) I, o& f! \ - * published by the Free Software Foundation version 2.
_0 R( t5 x" B" i' W/ i2 u. B- Z - *. U6 G n+ u! a: O8 x5 T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 B: ^" H1 @# ^# s6 q7 r - * kind, whether express or implied; without even the implied warranty: \- U8 C! y) O2 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 H3 B1 N. x( ~6 t( n) C
- * GNU General Public License for more details.7 I8 N3 j+ `+ W8 d1 a4 p
- */7 M v$ i6 L3 \+ h4 r
- & `- M' s, B0 |( U( c- A1 z
- #include <linux/module.h>8 I {+ B5 }7 O) r. p( Q
- #include <linux/init.h>
Q5 V& t/ B3 z' R7 n - #include <linux/errno.h>
! Y6 p# T) y8 }. C8 D - #include <linux/types.h>
! H9 p% h. e3 f& l' s - #include <linux/interrupt.h>
5 C% Q. e3 l3 w0 P - #include <asm/io.h>
% m. W# t5 M0 U: t$ } - #include <linux/moduleparam.h>
& Y) X# L( t0 O8 | - #include <linux/sysctl.h>9 W4 b/ X, F1 D( G a
- #include <linux/mm.h>5 i1 @1 c% w+ q. g$ g
- #include <linux/dma-mapping.h>1 q: C M0 r. v2 ~' s' U
+ i' X1 u/ j2 w) Y& P! _- #include <mach/memory.h>5 K5 G) l8 h3 a2 e
- #include <mach/hardware.h>- m/ } s: w+ D# V q) y, x0 s. _
- #include <mach/irqs.h>/ B* s; M6 `6 Q5 t" Q- e8 }$ S
- #include <asm/hardware/edma.h>& @# }' a" r, m& [* O
2 J7 r |+ n N% Z0 N" C0 K, K: Y- #undef EDMA3_DEBUG
% B& Z/ N: _( h4 | - /*#define EDMA3_DEBUG*/& u( d' [! J* g
- 0 G0 P3 z' {0 `& D0 M
- #ifdef EDMA3_DEBUG
0 N1 b4 Z* \8 ]; i0 F/ b: y1 T6 `7 | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% N) B3 B2 n5 w! l/ c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 T. y5 g: u9 L8 p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ |+ P* W) o2 H$ V
- #else
: k( a; \6 V; P [+ g) q - #define DMA_PRINTK( x... )
) P9 h2 z+ p- w" |' T/ |# U - #define DMA_FN_IN! r e. B+ W$ n' W
- #define DMA_FN_OUT% m W% {# a! s
- #endif
/ P4 `& ?/ z& X
0 N; |% h; T1 t4 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& B$ Z9 Q6 [4 }+ e0 Z - #define STATIC_SHIFT 3
. o0 q9 E4 @4 C! W O: V - #define TCINTEN_SHIFT 20
5 R# ~- ]% q, Y - #define ITCINTEN_SHIFT 21
' `7 |) c* |3 Q6 ~$ U2 i - #define TCCHEN_SHIFT 22
. i4 Z' @7 y9 V2 F3 B9 N - #define ITCCHEN_SHIFT 231 d) @2 \4 f& F4 c! k
+ I) E* P" a% `- static volatile int irqraised1 = 0;
; [; g3 l! k; Z0 F: \& R - static volatile int irqraised2 = 0;/ X9 Z: l: l# r4 A# f' l
8 b! k) F: P5 v# F4 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ^8 M8 t' y: t+ ~5 N% Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* G' [; x! r" l! H* o% Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) f3 t# ?2 r8 F9 G/ N
% @! h) H0 A$ L9 w- dma_addr_t dmaphyssrc1 = 0;" D; E4 M, ?6 s5 R
- dma_addr_t dmaphyssrc2 = 0;
7 {5 B& j0 X# r/ ~' E - dma_addr_t dmaphysdest1 = 0;
; M" c: M6 w2 L# I) V7 ~' q7 s; c - dma_addr_t dmaphysdest2 = 0;
. l2 D" W- |7 c9 V - 1 {) {& M- T, \, m0 j
- char *dmabufsrc1 = NULL;
6 T( L7 R0 t9 @ - char *dmabufsrc2 = NULL;
, l( a. t' a# g1 D; V. q4 m7 z% C - char *dmabufdest1 = NULL;
0 B- j6 B' q; |9 _3 @( z' k - char *dmabufdest2 = NULL;
! o* _4 p( `* l8 J - a* q8 x; E6 s
- static int acnt = 512;
" Q/ _" @5 W) d7 c$ [4 Y4 J - static int bcnt = 8;' x9 g( H0 F9 e' F
- static int ccnt = 8;
4 U# |2 R( ?( I+ C) T+ X# f; o2 G
. O) E% J) |& D7 G6 I- module_param(acnt, int, S_IRUGO);
7 H1 M) p) f, E, [- H/ M0 o - module_param(bcnt, int, S_IRUGO);3 N% \2 Z) O( {
- module_param(ccnt, int, S_IRUGO);
复制代码 7 ?7 f' M+ _. |8 ?
8 O, B" V* y8 s' e( v- p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ I+ b5 l2 H# T, `! Y1 `
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
?' |$ ~8 w z1 [$ Z, F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' O: d4 v4 H7 ^' p; u* d3 G3 \
V5 x( u3 M+ v; V9 M+ f1 `2 i8 f% ?: d4 x+ V3 }7 Z8 n
|
|