|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " A+ q0 S3 z6 W: D
- [code]EDMA sample test application# i2 X1 P0 {2 Y& i
- /*
# _0 h! |# Q! C3 L: t* V- O& a8 M - * edma_test.c
: L- b, s) G; ?* ~5 M+ C- | - *7 L+ m) k [% w0 j ?7 r6 I
- * brief EDMA3 Test Application
" a5 H I0 q7 m! J. ~& `# Q - *8 J7 P. o3 R7 t7 Z% a
- * This file contains EDMA3 Test code./ \7 `) M( U; a) p2 ~- v
- *( i# a3 Z. Y, F+ z& q* Q) Q9 L9 N8 a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 n+ M$ H4 S! ], R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" a2 T/ W6 C' J% E7 F: p - * TO CHANGE. L8 [/ R! W" R; v5 d& @
- *2 x1 w2 m6 s d' z3 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, \' G$ [# _3 |5 K1 U5 U - *
& O/ V! z+ G; }* ^" Z - * This program is free software; you can redistribute it and/or
$ a% s+ B h# |2 _5 ~& Z1 z - * modify it under the terms of the GNU General Public License as/ c' r# B- c! P. r- }, Q
- * published by the Free Software Foundation version 2.- d1 j0 }$ @, A9 x8 l- R
- *
( B9 d& f# i. F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% H) {! _. D' n - * kind, whether express or implied; without even the implied warranty
% z# @% n$ `8 i. I. n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( s! B. m+ k8 Y; I5 m* ^
- * GNU General Public License for more details.3 h7 M, s" x* ]8 S8 Q a0 L
- */
) C; b7 `' C T% B: n/ w - 6 L1 ^ |! Q4 q7 H" V! [6 ?
- #include <linux/module.h>5 [# ?, @# |3 }
- #include <linux/init.h>" v/ [6 R+ B c/ v/ l! L
- #include <linux/errno.h>) E9 a4 P; S* G7 }) a9 S
- #include <linux/types.h>
! L' ]# U6 w4 ^# r2 ~: l - #include <linux/interrupt.h>
" g; e. j% t( t/ I - #include <asm/io.h>
* D: ], Y, |; e) \7 b9 M# a - #include <linux/moduleparam.h>
7 z" R* g' B% R6 @" Z - #include <linux/sysctl.h>
3 {+ B0 I- R, S - #include <linux/mm.h>
% Y6 @; P! t! U1 k& S p7 s8 _5 A - #include <linux/dma-mapping.h>
; T+ A9 `- F( B! v - - i0 q9 C& a8 X! t) @! b
- #include <mach/memory.h>: c- W' f2 D! F- _. ?- {
- #include <mach/hardware.h>
" ]+ m0 H H+ |/ l: G) s - #include <mach/irqs.h>, }5 H3 S3 ~' f2 M, z, q
- #include <asm/hardware/edma.h>) D; d$ r. |" t+ l
" r0 F4 _0 g ]& ]3 I9 f- #undef EDMA3_DEBUG& q* Q1 G% ^0 i( X# P2 N+ G
- /*#define EDMA3_DEBUG*/5 Y, ` W$ v- S: o2 y$ B }
% g3 u- J4 X8 `' \5 S- #ifdef EDMA3_DEBUG3 m9 f! P9 N* f1 s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. `/ M3 r( r- R6 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ _/ |9 Q! Z5 E n. \( B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ^( O2 `4 d: C/ _. o! Q# W5 K, J
- #else
* m( i' x) b2 H* \+ r I - #define DMA_PRINTK( x... )# ~5 n$ c' a0 @2 J
- #define DMA_FN_IN
b8 h6 a4 C9 S3 j6 l - #define DMA_FN_OUT" ?7 ?- ~2 i* f. H! j
- #endif0 y" F! n2 ]" @, X/ s4 O& p
- 5 j7 X8 _( a8 h" {8 l7 Y( r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* v- f* M8 E4 C - #define STATIC_SHIFT 3
0 T- W6 r4 J' h9 A - #define TCINTEN_SHIFT 20
, N0 O! X: w1 a5 m - #define ITCINTEN_SHIFT 21! h( @! z+ @$ l: R/ c( F
- #define TCCHEN_SHIFT 228 C6 |+ p( G0 w$ }
- #define ITCCHEN_SHIFT 23+ D! ~1 ^4 N$ g6 R6 B% h& p
( w$ X6 {* p- l8 s- static volatile int irqraised1 = 0;
3 K2 `' m& c2 d# c- y& D2 e% j9 t' ] - static volatile int irqraised2 = 0;
' p& r* M2 u( y3 q) M. p
2 o2 g3 K$ k. |, K- }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# `* x: D+ U- a& m" L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 `3 A' a0 N9 y% S R4 [3 \8 p2 u2 [% r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* }% E/ |* Q0 Y0 O) s' D* i - % u; P9 Q/ e- S. I$ s6 H
- dma_addr_t dmaphyssrc1 = 0;0 d' e9 e- ?9 ]! ^1 Z5 I
- dma_addr_t dmaphyssrc2 = 0;6 f, F' ~* T& E( C9 X( M
- dma_addr_t dmaphysdest1 = 0; L3 k7 _8 t+ e C7 j
- dma_addr_t dmaphysdest2 = 0;/ W4 a" Y% c! k! \/ x
. }4 `& j2 C c- t- char *dmabufsrc1 = NULL;- B+ V {7 X0 k* E8 ?8 q5 y( l
- char *dmabufsrc2 = NULL; y2 q! X9 R9 c! `- R8 }
- char *dmabufdest1 = NULL;, u& m5 P& g5 l
- char *dmabufdest2 = NULL;9 a1 q, w8 N) _/ m
W4 w5 ?8 }. \1 `- static int acnt = 512;
6 V6 ^9 ?1 |; h - static int bcnt = 8;
4 }7 C- y* S( U' [ - static int ccnt = 8;1 G. X- Z; A) b! i. ~ k7 i7 Z
- * p1 R3 _& n4 h2 y2 t# ?# |0 W
- module_param(acnt, int, S_IRUGO);" b# y% B% i" ]- F
- module_param(bcnt, int, S_IRUGO);/ f) I! P& o$ s6 U# H
- module_param(ccnt, int, S_IRUGO);
复制代码 ! ~/ e2 [5 Y V9 W& ^$ V
4 p, m y# X, m# {5 W+ m+ } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 m2 O+ L+ c) M; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, v S; `0 X/ I" A/ w v5 M" H( a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( i" t! X" v3 c8 Q
4 `/ L" i& O: y% N$ f
' r3 ~! }0 P/ V4 l |
|