|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 I( V5 O/ `6 u' U: t6 T- [code]EDMA sample test application* E; c) I2 \! w; Q( i
- /*5 o# f1 a# [# ~ N2 P
- * edma_test.c" g# x; J; A' y
- *. T& p) n: \: x+ }( ]4 r! c
- * brief EDMA3 Test Application4 }0 V. W5 P% z8 M! J
- *
) y4 w2 m2 W3 T3 i - * This file contains EDMA3 Test code.0 M7 x6 F2 V! ^
- *
& g+ j% @* e/ Q0 w& O3 V1 Z3 y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" Q& a: b8 x2 J& V2 S- ?" Y' f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 [3 Y* F+ o" J9 X5 ~ - * TO CHANGE.
6 K5 E0 Q& e3 c, ~ - *! C- P% f6 E3 _! `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; F$ C; D8 m V' Z, U; h6 i9 X& \
- *
# y& A) W. l6 y. l t - * This program is free software; you can redistribute it and/or0 M/ U) i+ K* j; r6 F
- * modify it under the terms of the GNU General Public License as& R% G1 H5 k5 c9 W
- * published by the Free Software Foundation version 2.
$ ?/ M& m9 p# M$ g& N5 V - *
& M8 r r' U( V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: \' ? n" x7 U
- * kind, whether express or implied; without even the implied warranty
# P- k" R# _ B; d! S. H7 g z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! k: _+ b! @; E0 S4 i( [
- * GNU General Public License for more details.& z; Z0 e" E, z* o) Z5 }, v
- */
! P$ T" u2 ^! F - + R0 m$ {3 q, o' Q3 E1 F6 P
- #include <linux/module.h>8 u3 K# `1 h% K+ ~/ T/ Z* \
- #include <linux/init.h>
) k7 B8 D# u2 x- [9 O/ T2 ~ - #include <linux/errno.h>
1 w6 K/ f; |+ M- g9 k b+ o - #include <linux/types.h>
+ l; B" m$ h$ O# Y9 { - #include <linux/interrupt.h>: b8 Y8 T) X& G1 z0 {
- #include <asm/io.h>/ |( @# P; Z( q2 b/ A' J
- #include <linux/moduleparam.h>. {2 ?, T$ L) h* h0 x& `
- #include <linux/sysctl.h>
4 L+ O- z, n% |( s4 t- r4 c - #include <linux/mm.h>
/ ]; i. R% v; v; ^( n# p, f - #include <linux/dma-mapping.h>' p7 _2 z9 b* n# E# q$ Z
$ @' Q4 Q& t" m" j: x- #include <mach/memory.h>
' U) \1 A' B9 f7 B1 ^ - #include <mach/hardware.h>
4 k$ t' [+ ~: g, ^. f - #include <mach/irqs.h>
' ^% p; U$ s7 I8 e* q - #include <asm/hardware/edma.h>9 k6 \5 H9 R! U0 G# O
- * d b& ]6 V$ u* N7 k
- #undef EDMA3_DEBUG: D ?9 o P& B4 j; p& y
- /*#define EDMA3_DEBUG*/2 l/ z C( a! I3 O: c
: [' c. ?3 p1 O' @& x+ T- #ifdef EDMA3_DEBUG
( H, e8 S. E$ g: B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; t3 f0 s- ?9 c2 |) D' k6 ?: |$ J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); G/ O) I) G$ e3 _% f' _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# K( `6 n5 i' O9 h
- #else
# c# E4 q( n ^7 g& k - #define DMA_PRINTK( x... ). `: ^0 o3 e# S2 e2 o
- #define DMA_FN_IN
$ b7 Z5 F% v6 l+ V- B - #define DMA_FN_OUT! p: G* Q5 {$ }
- #endif. R) [3 l$ K2 g0 m" I8 o
- 9 O4 X6 I" K) M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% X5 E! z$ K; E% y7 M
- #define STATIC_SHIFT 3; f5 l- f: K5 {9 L5 R; L1 G8 e
- #define TCINTEN_SHIFT 20
: l; E6 _: ]* `6 Q, r - #define ITCINTEN_SHIFT 21
: v# m9 a+ g6 k& t, j# \3 p - #define TCCHEN_SHIFT 22' z4 X5 p; V% p9 j |3 @! d) [
- #define ITCCHEN_SHIFT 23
" @: y$ }: o# A3 n9 I6 v - z. W Z& P3 H. p9 M
- static volatile int irqraised1 = 0;
9 y) f9 F: I' ]+ F7 D - static volatile int irqraised2 = 0;
$ J5 o" W& N1 [7 }$ U
7 U) w q% E6 F" y \- ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ t) k+ t' {; u! B' j9 ]5 A7 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 V& f& m; G6 @* ~2 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ L+ h) i4 ~2 f' {
$ P+ P' U) a9 }1 E+ ?- dma_addr_t dmaphyssrc1 = 0;
3 w/ ^6 F' B4 E. O$ ] - dma_addr_t dmaphyssrc2 = 0;8 n" z& }( l" K! r4 K# \
- dma_addr_t dmaphysdest1 = 0;
' M% l0 o2 V9 D - dma_addr_t dmaphysdest2 = 0;
- o) i; T: O# J: f - ! F \, B2 [/ v8 h* k! i2 R: f7 T- p
- char *dmabufsrc1 = NULL;
5 G U& }' X: g; I: p! |& [ - char *dmabufsrc2 = NULL;
/ x" ~/ ^0 q# j% C3 [ - char *dmabufdest1 = NULL;- }9 V! m) L+ D4 i; y6 s+ h
- char *dmabufdest2 = NULL;( J4 F/ A% e$ C
. N; y4 x$ p6 F# ~- static int acnt = 512;
. B) t# R/ r0 J+ @' t - static int bcnt = 8;6 y2 U9 l" x( Y8 x, `* X- D* p
- static int ccnt = 8;
4 Q+ [% c" D$ z1 U, N
' ?% F. u( f5 L- module_param(acnt, int, S_IRUGO);
! L* V' o! }8 J3 T - module_param(bcnt, int, S_IRUGO);
9 o: `3 M( z2 K! e1 k+ _4 D- { - module_param(ccnt, int, S_IRUGO);
复制代码 : B3 F6 X3 k) R. U* w9 F
F2 c; a7 E# K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 F) V! _( m4 `* C4 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" M- F) v& C0 F& p2 p& L6 @+ h y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% w/ u, b$ d/ k" h5 l6 I0 b! ?6 T! i. }
& \' F2 L* i/ H; a1 p9 V) ? |
|