|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
e) u! u7 }- U5 g- [code]EDMA sample test application
+ l& V, u I X! u: R" x$ E$ ? - /*
. i$ _9 e! K3 M) R& k - * edma_test.c" q7 b8 ~) F0 Y) G9 H3 g( t7 r& ?: M8 X
- *
. h) p) C9 U. N4 W, k# v$ } - * brief EDMA3 Test Application
* y, `" n0 X9 t( E - *7 G+ ?" u7 y* d% H# L, b4 s y
- * This file contains EDMA3 Test code.! g2 t8 M/ X: V* W0 O; d" W: I
- *9 q, t9 \- A/ I! Z7 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" {9 O2 A& Y8 u0 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( w! H4 \$ u5 |& a0 w: {4 i - * TO CHANGE.* Y" i P# ]0 V/ o7 d
- *' D5 ?8 [/ z# T, }3 y2 R; `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% [. M$ y1 T8 D9 Y5 U4 H
- *) }/ W- b& f- k# H* M: m1 ~
- * This program is free software; you can redistribute it and/or
" Z {: z9 d8 {- ` - * modify it under the terms of the GNU General Public License as
8 |! D# K+ K: D - * published by the Free Software Foundation version 2.5 O; `0 m6 ? l, C: G7 Y& e
- *
8 l( X9 f( W6 P0 X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& j2 e: V; N3 _, a0 ^$ Y! d3 d1 ^
- * kind, whether express or implied; without even the implied warranty
7 f9 F" o+ U% T* }& w7 k, H7 f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ r) }- Q9 _6 _; F
- * GNU General Public License for more details.
% b( }/ E( c: _8 E' j7 g - */1 Y x9 B; Z+ M3 G
- ; L. h2 J/ G# q4 U- Z
- #include <linux/module.h>
$ f4 G. U+ f6 ~9 n3 ~ - #include <linux/init.h>
4 h' r4 D+ s, d" w/ E* r2 W - #include <linux/errno.h>
6 n# `& m/ N6 P# H - #include <linux/types.h>4 l. g4 c5 W) ^! P7 B$ @
- #include <linux/interrupt.h>
8 q* Z b+ A9 Q( @0 @ - #include <asm/io.h>
1 _0 [ k# i) k/ [% n - #include <linux/moduleparam.h>, m1 ^8 m& P- L) Q1 G
- #include <linux/sysctl.h>$ e! a2 P6 J+ D: z7 \
- #include <linux/mm.h>
% X* m8 m8 o% s8 y% N8 u - #include <linux/dma-mapping.h>9 w3 X, H7 E7 c+ J$ M- ?6 o
- 8 e2 ^* l8 @ b2 ^% q+ t; O8 u; G4 [
- #include <mach/memory.h>0 I5 M6 K& f: p, o5 Q- @# j
- #include <mach/hardware.h>
) l) i% f- U$ s - #include <mach/irqs.h>( B, _ D* g& \" E0 L/ I1 s
- #include <asm/hardware/edma.h>
2 T4 Y0 v$ Q' N2 r0 _7 Y# e: g4 S! O
2 ]' f# t- A9 H- #undef EDMA3_DEBUG, r3 s$ }. K- c6 R8 g
- /*#define EDMA3_DEBUG*/
$ P7 _, {$ q" h8 N) C% H! a# X! }' M
6 h z w) w, Z/ |- #ifdef EDMA3_DEBUG5 q/ a! ]5 P0 T0 g! B" e$ _8 N- O8 f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, n: k0 `$ k2 \7 d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 U1 M1 a1 q7 r) t9 S9 u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 I, t+ P$ ?; t/ W5 z3 B- o& F
- #else Q4 h ]: z! `1 }. S
- #define DMA_PRINTK( x... )8 |* o7 _2 `- r' G4 u7 ~
- #define DMA_FN_IN. h5 U4 j B; ]3 L
- #define DMA_FN_OUT
. R0 R& \3 R6 ^0 i - #endif5 p7 B A% {8 ^4 c% C& d9 c
- 3 H& t% D0 r$ A" A! h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. M% W8 i/ ^% B - #define STATIC_SHIFT 3
& k/ T- M4 E! ^! G+ i6 A. G! ^ - #define TCINTEN_SHIFT 20: C4 U/ s3 \' i4 J9 [
- #define ITCINTEN_SHIFT 211 t9 r% d/ A+ l+ j- w* I, u& w
- #define TCCHEN_SHIFT 22
: q8 U# [; j l* I8 s2 j; l - #define ITCCHEN_SHIFT 230 f5 G N/ `: z* z
- ( [: Y6 w0 f( I" r" g, O$ Y
- static volatile int irqraised1 = 0;) T1 y* \7 s- N; h! F
- static volatile int irqraised2 = 0;
$ S5 k- D% T" {5 y) g( i% j - " E* w3 T; ]) S& l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 v$ @# }6 O$ { q( z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 _0 e3 s% v6 B/ s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ]5 g/ j( o( F- C
8 G) A7 S! R) p- G# j+ Q- dma_addr_t dmaphyssrc1 = 0;
: Z/ Y: e7 ?- Y6 f4 x) R9 \ - dma_addr_t dmaphyssrc2 = 0;
1 A$ M0 p& h G, R X( _ - dma_addr_t dmaphysdest1 = 0;
4 w) Q4 |# F) y4 R Y. z+ S& E# S - dma_addr_t dmaphysdest2 = 0;
: {7 I4 ?8 M1 x0 i1 K6 c - 9 ?! U" y% x/ R \0 H8 T' R, b
- char *dmabufsrc1 = NULL;/ V3 E4 z [9 c
- char *dmabufsrc2 = NULL;
( n# U" y5 W: Y* ~ - char *dmabufdest1 = NULL;
. ~% N; T4 [# Z) ? z" j - char *dmabufdest2 = NULL;5 p/ D0 Q, W1 l. R1 J/ o
- : J& P! x7 N. A+ V( m5 o5 Z
- static int acnt = 512;- n! e: L' b- \2 @" E
- static int bcnt = 8;
4 p. ?4 l( Y7 {# F0 U# i9 { k - static int ccnt = 8;% a% A% K$ z, p. k# Q7 s
- $ l2 `6 a$ n4 h6 x' K6 N
- module_param(acnt, int, S_IRUGO);
L/ `2 _- H, `% s- G& M( H - module_param(bcnt, int, S_IRUGO);
7 F! P9 I3 N2 @5 Z8 j8 U) l& l - module_param(ccnt, int, S_IRUGO);
复制代码 5 w% e& N6 K0 {, d
8 Y1 ^7 q7 ?' W7 t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 O$ {/ O0 D5 v% S" ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
^% c. o( p9 L- |) c% Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ u& L1 F- w0 M7 c9 m3 i5 `6 M% X
: G+ w5 |% @6 {& c' {! t2 Y
|
|