|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 @0 s. U' G& {$ v, O
- [code]EDMA sample test application
2 G7 a/ M4 n ]6 A& T+ h - /*
' m' n9 N# Z1 q; g - * edma_test.c$ e2 d( F. }& @
- *
' B2 B/ d2 k8 p& _8 z - * brief EDMA3 Test Application
( h9 ]. y! z0 h! d, y - *
. k; x/ p0 B4 C [# S - * This file contains EDMA3 Test code.
' D7 f' \" X# t' n8 b G* e0 B - *
' _7 U/ ^, f( B8 G# C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) \/ B3 K! }5 Z" p3 J7 A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# e* j( J% D. t+ a( r3 X* k+ d - * TO CHANGE.
* f- d7 N3 C& J/ ^$ C( A6 D - *' o. K3 V) N* z' t z& J9 T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 K* }" b9 C" S% K8 a - *0 }; I" B1 G0 ]' w4 ^
- * This program is free software; you can redistribute it and/or1 ^$ g6 ^2 t2 }7 W `3 z( C$ b6 O; q
- * modify it under the terms of the GNU General Public License as0 ]( y0 p1 K0 C
- * published by the Free Software Foundation version 2.$ Q2 r; k% B( o3 M e: G
- *
( H# ?2 h8 t- j+ E+ O, L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ x q# M, y- S6 B$ m' f - * kind, whether express or implied; without even the implied warranty
& C _2 q5 ?0 u# `2 F0 c9 O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- F' _& [7 C- \& p# |2 D7 B - * GNU General Public License for more details.- m3 D4 v8 f" n) L8 ?% z
- */, _7 u5 I# y4 M+ N2 I/ _4 \' _
- o+ W7 H$ x7 s5 u8 w
- #include <linux/module.h>
! i8 Z$ O4 x# X6 ^1 E$ ^8 O6 C - #include <linux/init.h>/ @$ Q4 D9 z9 m! I4 ]0 s; M
- #include <linux/errno.h>* ~5 N9 g) Z7 [: c( {3 P) _
- #include <linux/types.h>
' @ Q- w& {& @8 j! f) M2 @ - #include <linux/interrupt.h>0 N! U, k1 v) }; w
- #include <asm/io.h>3 m/ b1 K8 e5 \0 l9 I7 Z
- #include <linux/moduleparam.h>
: m+ n/ ?( j: V1 O4 P - #include <linux/sysctl.h>
) _7 t1 p( {& X0 }' \+ W - #include <linux/mm.h># M7 Q' Z1 T, r* O
- #include <linux/dma-mapping.h>9 |8 C, G C8 E S* \9 K8 E
: b9 z" N; D" Y/ ?& E! ^- #include <mach/memory.h>+ t: I; E2 s- _: y
- #include <mach/hardware.h>2 J$ c9 X7 f0 S' a" n
- #include <mach/irqs.h>
- O8 Y) t( u" Q1 E# \0 v0 ^- } - #include <asm/hardware/edma.h>" G4 U1 T1 J! }! U# g2 X9 c
- ! P" {3 H7 Z# t) q1 B) p
- #undef EDMA3_DEBUG
# u" |$ p" |- A: W0 R. J6 P - /*#define EDMA3_DEBUG*/
( K3 Q! z9 ^0 k5 o$ ?9 ]
1 O! [3 k3 Q/ \; Z- U- #ifdef EDMA3_DEBUG. r/ e- t8 \$ W7 v1 t v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 w( h; c( G: K2 s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 u. h# m' Y* T0 w j' K5 } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' Q5 N) O, Z8 ^4 V
- #else
) C. Y$ L6 u$ ?; | Y7 |% L* G - #define DMA_PRINTK( x... ); Y+ d4 O( K8 A+ h5 o- C
- #define DMA_FN_IN3 A& O L, f% _
- #define DMA_FN_OUT& p0 t0 c+ c( ^$ u* p, Z
- #endif3 S# l+ D0 P0 o7 Y$ m2 ?
$ V& x9 {( t' x5 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
[, R' W* E& s+ ^8 f - #define STATIC_SHIFT 34 I D9 l# {+ @8 Y+ L$ |
- #define TCINTEN_SHIFT 20
7 ]& a: O6 N& f; E% a$ q6 O - #define ITCINTEN_SHIFT 21
1 m; {; ?9 ]8 [ - #define TCCHEN_SHIFT 22* I" L( h8 Q4 m' C) P9 f& K
- #define ITCCHEN_SHIFT 23
9 D9 r/ J w/ r5 t& _ e7 l9 a @- {" k - / R. ]1 ? M, W
- static volatile int irqraised1 = 0;8 ]0 n8 Y8 c9 l y( b% L
- static volatile int irqraised2 = 0;: r, d6 k! a7 ?- X8 w; d/ d5 k
( @3 L$ j& g5 D* j2 T2 c9 [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. \5 I0 T; N, L2 L. ~- n/ s( h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) w9 i1 \" f2 V2 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. r5 K" S- p5 U4 ?! q/ ?
; {( K' ?- U, c8 {- dma_addr_t dmaphyssrc1 = 0;0 Y+ [& B6 B) J& u8 m! x A( |
- dma_addr_t dmaphyssrc2 = 0;
/ q6 I- _9 b8 I/ V' t - dma_addr_t dmaphysdest1 = 0;
: i- O7 T0 }% R0 I9 M4 v - dma_addr_t dmaphysdest2 = 0;
r) M4 P, j$ L0 u - 1 r& m; l; B; u' Q+ ^) q
- char *dmabufsrc1 = NULL;7 ^% X' ]3 S& n$ i
- char *dmabufsrc2 = NULL;
6 \+ R8 L& g& e1 p! @* H( c5 l# K - char *dmabufdest1 = NULL;" \% c1 i, ?; `. z. e7 d" S
- char *dmabufdest2 = NULL;: }3 H5 @" R6 Q. d4 k
- J, w3 X: X2 r! p3 A, p- static int acnt = 512;5 X! E, o1 A3 X$ e' V0 k f: i5 L6 }+ n
- static int bcnt = 8; u) M4 u j# O; q% q' _
- static int ccnt = 8;4 ?, ~; v: K6 i
- ) K! K5 u$ B% v7 P
- module_param(acnt, int, S_IRUGO);6 ?, _! N5 c: X$ t* Q
- module_param(bcnt, int, S_IRUGO);
& q" J" e; }# |' {! E - module_param(ccnt, int, S_IRUGO);
复制代码
5 e7 f& _: M O* b! w; Y
+ S0 t/ Y0 Z6 `9 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 \8 _: n1 G, e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: |& e" s0 S. O' M; j, S5 Q) e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" _( S' Z6 g7 U ^( @4 `+ l. H- e, N# N0 H: M% M+ T
4 a$ m ^% p9 F& Z3 [' f3 }8 C
|
|