|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- v5 c& p7 {& A1 b3 V- J- [code]EDMA sample test application' q" l. i9 a- ?% V* h2 L$ _
- /*$ O$ l5 Q! J1 ^7 k# e: a/ F' c
- * edma_test.c
$ Y; d; t- i% G( A8 ]7 M - *1 v5 V& @0 p- j$ i* o" }! ~
- * brief EDMA3 Test Application8 h. Q8 v( m" I2 u5 g+ @3 t
- *0 @, f' r: K* I6 Q( Q" M
- * This file contains EDMA3 Test code.1 z( u2 w. @5 ~: g) j: P8 F! D
- *
& X/ f& Q9 z1 @$ y+ i g/ a0 h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ U7 g5 i8 k0 w0 y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: I: h* x' i+ g& E - * TO CHANGE.+ g2 G% t5 ^! S1 q& H8 P
- *
- v5 a; d5 [9 ?; e! C1 [' R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* n; J& L/ a1 l, c ?# h# c - *
7 K" B% r* |7 i7 t - * This program is free software; you can redistribute it and/or6 ~, a$ s0 V. s# b: Q3 ?
- * modify it under the terms of the GNU General Public License as
# Z. A1 s; r# f N4 z - * published by the Free Software Foundation version 2.
. O' i& K: {1 Q. S! E - *9 ]7 u1 J! S3 L o. l/ T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. T% D' k" I' G8 z: ?
- * kind, whether express or implied; without even the implied warranty
8 k& W- @* m4 o( S. z# y/ ~5 j6 ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ J5 f) [3 ]8 P* N; v3 V) y - * GNU General Public License for more details." [& e7 b9 y- N" {' Z
- */3 R; Q W0 b k& n4 A
N8 p, e; L+ R* G c: l& m- #include <linux/module.h>
. d2 t( \+ |# L0 L3 K5 y9 e" f7 t' ] - #include <linux/init.h>
" j; i: z6 H) C - #include <linux/errno.h>
* f/ W# E' B3 p* ~% Z5 Q" } - #include <linux/types.h>+ T+ @4 }* J: C6 S
- #include <linux/interrupt.h>5 N) w' J7 h% p' P8 \5 h; k' B" y2 o
- #include <asm/io.h>
3 h) x) l' @8 x& b/ @* | - #include <linux/moduleparam.h>
+ M: ^# v4 }! x& w+ ]! q - #include <linux/sysctl.h>9 v, S$ x7 d( _
- #include <linux/mm.h>
6 g" O8 P. s1 v: P2 r" M0 ]/ W - #include <linux/dma-mapping.h>8 t4 E4 |, U. Q' u. s" z
- $ A1 g; j: l# l' x, X4 h" R' h4 U8 j
- #include <mach/memory.h>
. r! E$ A! I7 l - #include <mach/hardware.h>+ E/ x k* I: d1 M Q% o6 V4 |
- #include <mach/irqs.h>2 D) r' h! ]" e/ J' h2 O( q* K
- #include <asm/hardware/edma.h>
0 p3 G/ Z4 h& K. O - - a) E. p# i* I2 [
- #undef EDMA3_DEBUG- J3 | J% u4 `, v3 Z; U8 ?
- /*#define EDMA3_DEBUG*/" Q6 @+ `# V" F0 w2 n! p& a
, u: K4 {; N: o* M- #ifdef EDMA3_DEBUG: Z# ~, N* a) Q* V9 } i2 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 D7 Q8 M3 I9 H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) |3 H4 R, ^5 E$ u. b6 i( K5 H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& Z1 t3 @) K6 B9 ~& ] - #else; e' L. y3 l0 `( ~. I; u4 l6 k
- #define DMA_PRINTK( x... )
( U" H4 _ Z# p8 O% g; l - #define DMA_FN_IN" @' x' n5 ~9 e/ `0 E7 J
- #define DMA_FN_OUT
9 Q/ w, s/ h3 u" F4 @ - #endif, A- o, I6 r; K& q/ y
- , d: P9 U# w/ B8 V' N+ ] e! j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ C4 {# G4 H, x1 H* c/ q$ T- a6 E
- #define STATIC_SHIFT 3
( R8 l5 N9 g- {( [# `. F - #define TCINTEN_SHIFT 20
. |9 t7 d1 v( e j - #define ITCINTEN_SHIFT 21
6 Y- Q( v5 G2 B2 A$ {6 N - #define TCCHEN_SHIFT 22$ M7 A0 C0 Q6 L7 l! v; u" x6 h: m
- #define ITCCHEN_SHIFT 235 |4 @6 R5 p* y1 y9 `1 Q8 ^# G& c
- 4 y' m1 U8 W3 m
- static volatile int irqraised1 = 0;
5 V4 K: [7 l0 ]9 } - static volatile int irqraised2 = 0;
0 ^* [* v2 m9 p3 v. `. ~& }# T
( O1 R @& K' d, r5 Z7 Q* e# |; s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 q4 E. O: R1 [4 X) S# a; \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' H% K$ g$ b* t. i, m# @) s$ C3 R" q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& |& C- I, y1 j1 [
- + N, J( ~: ~2 c! V: q0 ~
- dma_addr_t dmaphyssrc1 = 0;
% m7 ]$ X8 E6 n% W( \ - dma_addr_t dmaphyssrc2 = 0;
# _ J( }5 G: G) j4 j) z - dma_addr_t dmaphysdest1 = 0;
6 {: G+ A# k% |: k - dma_addr_t dmaphysdest2 = 0;
, h9 e0 D3 O' \, Q
a# \8 x0 a5 ` B, I o- char *dmabufsrc1 = NULL;- n8 ^. X1 k5 ?8 _& I, M( X3 r- Y# x
- char *dmabufsrc2 = NULL;5 l& w$ A1 R# u4 [, A2 O
- char *dmabufdest1 = NULL;
, T' X" k h) ]4 _6 U - char *dmabufdest2 = NULL;- i9 x5 ^7 B- e: V" v |
- : H7 ^6 R' S) \3 ^% A* s
- static int acnt = 512;
! M! f' T/ Y u. ?" {0 B0 `2 I - static int bcnt = 8;
2 ?1 d: H* i6 w* O4 Q" ~$ P - static int ccnt = 8;
) U' X! E" U- F& _0 }# r - 5 d& e3 i$ Q$ Q$ h6 k
- module_param(acnt, int, S_IRUGO);
z, i- K& d5 g( g' d - module_param(bcnt, int, S_IRUGO);
! \$ I% `1 L0 e' F - module_param(ccnt, int, S_IRUGO);
复制代码
2 j( f6 o4 K* j" ]2 }8 w. N' ], Y2 _! s8 W9 ^4 \& K9 t1 P% F6 X8 R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( q: h" O0 I$ G/ harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 F0 z8 J0 V {4 Q! i* _9 n1 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 Q* H \8 s1 e: q" z
! \" A+ W( P# {7 [& Z5 U' X7 ]4 C# \. p8 w0 U9 b& U9 X1 y! @
|
|