|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , y6 ]1 E- L% j/ k8 d1 |6 i% |
- [code]EDMA sample test application
7 G* ]/ e- \& q, a9 ?5 C - /*
, h3 S! f# Q. e+ Z u9 H - * edma_test.c
1 D: p( N# C8 p; d$ n' l) Y - *$ v1 l6 ?+ e( y: A8 z
- * brief EDMA3 Test Application5 b, T# t; g# o7 \% J. d3 {3 V
- *! C1 {2 w" Q3 x: f* p1 \
- * This file contains EDMA3 Test code.
3 q! l7 v1 y" l( a% @5 f3 }, c9 K- E - *- I* B; w0 {1 ?7 j" [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; q; `) j) ~0 q( V" j# k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- @# G$ |- U8 R$ D - * TO CHANGE.
; h! M) _) V/ \ K7 _: D - *2 C2 ^' T# S( M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, C5 d' x3 w4 ?% E- z/ ]) l - */ B1 C; m- I: @% w7 v
- * This program is free software; you can redistribute it and/or/ g( u$ U! s* ?$ o$ P0 V5 ^3 A- C
- * modify it under the terms of the GNU General Public License as
3 C5 O, v: L) I* F, s: F3 L. j - * published by the Free Software Foundation version 2.$ D1 P) Z$ l3 y# u$ ]
- *1 ?+ G/ t0 J' T5 Y* N: x2 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' R: }8 {, ~- E! B9 h3 V
- * kind, whether express or implied; without even the implied warranty8 o& T% i. {5 K/ H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) f. s4 y4 {, b; `5 V5 A
- * GNU General Public License for more details.0 N/ ~- d0 q, G; F0 g
- */
$ I( N1 X! L' R
* `( W- R4 h5 {4 ]) ]5 R& z1 g- #include <linux/module.h>8 F8 \& m1 R$ R5 k
- #include <linux/init.h>
/ ^4 H, i# d/ C- F# p; j/ d - #include <linux/errno.h>& R/ I% O0 o6 h1 V* \8 {( h( L$ m; e
- #include <linux/types.h>
" Y! o7 ?) _- H* K$ H9 L$ R% s - #include <linux/interrupt.h>. p* L# i/ m8 ?" Y/ G, @ r+ t- \4 D
- #include <asm/io.h>% p# i! |4 A Z( W$ L
- #include <linux/moduleparam.h>' X* k8 n- S+ C( S. j- j
- #include <linux/sysctl.h>
& P/ \4 h# b* U# U0 T$ E. ? - #include <linux/mm.h>+ @1 X3 q: V1 ^" Z3 E
- #include <linux/dma-mapping.h>; e8 b; x! s" p Q# V+ z; ~: @
* N7 y$ o0 ^4 {- i! M- #include <mach/memory.h># v# u: E+ i# _* t
- #include <mach/hardware.h>2 z5 _. l: I h8 ^
- #include <mach/irqs.h>1 E3 `3 c3 d' K9 K- q
- #include <asm/hardware/edma.h>+ ]' M, p- m4 Y# N9 d' Q$ ?) T* T
) A" V" t5 ?+ ]( \# y- #undef EDMA3_DEBUG
+ H# s: Q8 n% }+ E9 W5 T - /*#define EDMA3_DEBUG*/; y' O" }2 r D7 _3 l `6 [
- 5 Q: v1 [" l' \! H4 R
- #ifdef EDMA3_DEBUG
/ m5 ~3 M; s1 w p+ u2 u/ ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( H& W1 S% {; ?* k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% u- P3 f* a7 P, S+ g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! M; \& m1 H3 n/ L
- #else
/ A( c4 P+ p. |( }# t/ o - #define DMA_PRINTK( x... )
) t. E5 l, A; K; n1 F/ ]" u0 c - #define DMA_FN_IN0 h$ [" y; n$ A! G5 p
- #define DMA_FN_OUT3 p0 U; F/ c" I
- #endif
$ M, ~% J! d- J - : n4 g$ B( j# h/ }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); g; h9 a5 q h' [
- #define STATIC_SHIFT 3# p8 I' g1 A2 G" I( Z3 k% p
- #define TCINTEN_SHIFT 20
+ C. N. ~ j5 m! G2 ^ - #define ITCINTEN_SHIFT 21& B0 o! T2 H6 F4 p
- #define TCCHEN_SHIFT 22
$ a& z/ _2 N W6 H* M7 d/ M# g - #define ITCCHEN_SHIFT 235 T- d; P, d) o2 {( y6 ^
! Z* `$ g: b* ]+ E" B- static volatile int irqraised1 = 0;, t# ]6 C6 k! D( c$ `! Z' m- O
- static volatile int irqraised2 = 0;* E U+ s- O7 P8 B+ q
" Y7 Q& l' @- Q! W, ~: a8 K) p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 O3 n# s/ }! _/ g) f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C1 @) k& `' T; K, U2 P% ^$ ^# `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ r& W8 B6 n, I' ^' z
& G1 w+ q0 x9 ?% ^# C2 J- }. J: S- dma_addr_t dmaphyssrc1 = 0;) O( i# y" O) N
- dma_addr_t dmaphyssrc2 = 0;
. f" R1 O3 d& X( L* w1 t% v. M6 Q - dma_addr_t dmaphysdest1 = 0;
7 G+ h w0 V- v - dma_addr_t dmaphysdest2 = 0;4 J! b3 m6 s$ i6 X& _" \
) y3 f) \1 I9 a; d- char *dmabufsrc1 = NULL;
# I- w( C& V7 g# o# ] - char *dmabufsrc2 = NULL;
9 w1 E ]9 @: V - char *dmabufdest1 = NULL;+ l; }3 B2 a$ K6 d* @5 p$ a7 P
- char *dmabufdest2 = NULL;0 J- A3 H3 N6 B# s4 Q8 K" U5 Y
- , b6 X, b: ]2 y+ u
- static int acnt = 512;
1 L# @' h: X" q& z2 U - static int bcnt = 8;
3 u9 Y4 g/ O* J* D5 N& M; Q - static int ccnt = 8;7 I9 i2 M! s, A& o+ \, U0 U4 J
- 1 _9 j' Q+ [% X" ?8 T! }9 i" q% E
- module_param(acnt, int, S_IRUGO);5 X G) ?0 K+ i
- module_param(bcnt, int, S_IRUGO);- h9 j* @( T& d
- module_param(ccnt, int, S_IRUGO);
复制代码
5 R7 G( ^7 M2 z1 N& |- Q" ~; p" u4 p9 o9 A5 J0 n& d9 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 c3 _" r6 t+ j' s Y! q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. Q8 `% x* G# j1 q5 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 G% ~, l& k5 V
: A9 I0 G( p$ ^* x# d
: `& `( W- e6 {# U( G |
|