|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 |) W7 I1 _6 K; P3 v, t* R- [code]EDMA sample test application# Z$ O/ u2 W9 |, Z. P+ R
- /*
0 G4 ~2 G% p" z9 G8 o! \% n5 Q - * edma_test.c
* u9 p. W3 Y% d( g - ** l1 \+ Z6 k2 p3 K. {) Z
- * brief EDMA3 Test Application
: l; | R/ W+ U: S8 Q8 b1 t - *, Z" g; m3 D9 r+ g+ R8 H( j
- * This file contains EDMA3 Test code.- X" U8 B# A3 Z, O: W
- *
2 q) m) [* M2 y S& o7 J) R4 K+ {( A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ^" C* S; Q; V) [, w) C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- f3 @( S, P |3 Z9 t* x
- * TO CHANGE.
- Y& s8 }5 o; S7 C - *$ t }+ u9 Q" u. R; i* G# p7 D3 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" t2 a `3 @- g& l9 ~/ T% O6 A - *! F4 d6 n8 B( y' I5 {( y4 X% Z, f1 S0 y& e
- * This program is free software; you can redistribute it and/or
2 n; U/ J8 Y e - * modify it under the terms of the GNU General Public License as3 G; [1 G' f1 J8 K
- * published by the Free Software Foundation version 2.
" w- a/ a: r$ S4 l/ w8 [ - *2 D$ B; P& u, F1 e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* V9 A4 x: l j0 D/ v - * kind, whether express or implied; without even the implied warranty4 u4 V! I6 c' a; b2 d. c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! J$ j8 d2 _$ T. y% y) C1 [ - * GNU General Public License for more details.
7 a5 j# w7 O j3 R$ f - */
! V3 [- F+ D' C% g - 9 }' A$ [; u" f" w4 d# S
- #include <linux/module.h>' P& V0 ^ J) @* H
- #include <linux/init.h>7 `1 |/ A% p+ X% c, l7 r
- #include <linux/errno.h>
/ u P9 R8 l) \9 e" v) n7 U1 v: a. a - #include <linux/types.h>- e- i! X& t8 `( H0 x
- #include <linux/interrupt.h>+ j y' c! E: U! o$ d/ n
- #include <asm/io.h>
3 A7 w6 _8 Q( u. d3 j - #include <linux/moduleparam.h>
( V, {7 Q1 X C2 @ - #include <linux/sysctl.h>8 N: Q! C3 ~# D
- #include <linux/mm.h>
) P; T; U& p# b8 q/ H - #include <linux/dma-mapping.h>2 M& g- C" E+ Y/ `4 C
- 0 v8 d( h" }3 Z
- #include <mach/memory.h>3 z4 J0 C# S+ u: }$ O
- #include <mach/hardware.h>
+ H' j- o5 \# m- k - #include <mach/irqs.h>
4 R( f+ g+ l8 S* O - #include <asm/hardware/edma.h>
9 F9 G6 I" O) F' K0 ?
# h: T8 I- y* r7 @- #undef EDMA3_DEBUG
) N2 E1 X+ M8 U4 w( m# }6 S9 ~ - /*#define EDMA3_DEBUG*/
5 [3 g% J' g& a% J1 `/ b' x
* K- a, {/ n* F( V* d: u6 w* U! o; X- #ifdef EDMA3_DEBUG9 m# ~7 C. H- B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, g- {$ c0 G4 r4 y9 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ Y8 h. X7 Q0 |% Z7 v2 q- B7 d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& F( H1 t6 Y1 u- U! p. d4 J& m9 \
- #else" W7 G& z, J8 j8 l5 F, i q
- #define DMA_PRINTK( x... )
1 o# n! H. j3 R r - #define DMA_FN_IN
5 m1 [& M/ [% V- X3 V9 R - #define DMA_FN_OUT
M- A1 O) C& ]2 B# V6 A - #endif
; u' y* ?7 I6 O3 R! }# e4 d - " J* d6 i+ a/ k. j. J7 a4 R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# c$ y- a3 p4 a
- #define STATIC_SHIFT 3
* R8 I# I% \0 J/ m - #define TCINTEN_SHIFT 20* d! N6 V' \% z5 @: {! ?
- #define ITCINTEN_SHIFT 21- q3 q/ ~% h1 |+ Q6 P! j
- #define TCCHEN_SHIFT 22
v! _# {# m. Z - #define ITCCHEN_SHIFT 23
% C5 \ k$ t: n! d* O( } - : R9 c& q7 G+ ]. F' t( G' o
- static volatile int irqraised1 = 0;0 e; i, }% m+ G, A7 x
- static volatile int irqraised2 = 0;/ ~6 ?3 \* F8 I' X( `# N
- 8 i' T: n ~6 ~# x' g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; o0 V; ?8 r, U& E- _* u' u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 [9 P$ [- B' i- c4 ^' O* ^. N1 n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ {3 e$ ~3 n& r, T8 g! s
- & q: q" c4 ]% t8 [, [9 ~% B
- dma_addr_t dmaphyssrc1 = 0;
/ T5 d9 o2 k' D. O7 [, `/ n1 y - dma_addr_t dmaphyssrc2 = 0;
" ?1 T Y4 z7 C" m# H$ S- V - dma_addr_t dmaphysdest1 = 0; C- J# W; l" ~7 S+ ~% d
- dma_addr_t dmaphysdest2 = 0;6 T% m6 r0 B$ x3 K+ j& Z
- 6 ?9 `' n7 _5 n, f1 _; f9 j
- char *dmabufsrc1 = NULL;
" m/ t, g4 N' h" t+ g( M - char *dmabufsrc2 = NULL;
% C* _4 t1 L9 e3 S7 e - char *dmabufdest1 = NULL;, p, m8 Z- I) X3 u# U3 M
- char *dmabufdest2 = NULL;
1 L+ I& \7 B1 }- J$ s) V - 3 b/ i& L8 k t- P# I. L
- static int acnt = 512;/ h- t. d8 T( p
- static int bcnt = 8;
1 a) H+ G/ c$ j4 P - static int ccnt = 8;
3 I* g3 X& r) P( Y- u
3 ~: E% R! l2 [" \! C- module_param(acnt, int, S_IRUGO);! U( l% c! Q. P1 `2 q: r" @
- module_param(bcnt, int, S_IRUGO);
6 \% L0 B4 B; n, `7 J7 E% A - module_param(ccnt, int, S_IRUGO);
复制代码 & D7 f% ` B4 T( \( }
9 i( u9 S1 H4 V. k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 _8 R8 x& i- H! [1 e- q5 e1 `7 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ r" D: _7 k. ]9 c. U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 M( ^1 F# Q# m T3 L, h
: O, n& t- ~0 g6 F Z' I* c; C
1 n9 Q+ K; j! J" h" p |
|