|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 e+ P( j2 j: L, _- [code]EDMA sample test application' ^) ~$ S& b8 A, y
- /*! z- q5 c' {2 u2 q2 t* b7 _( d
- * edma_test.c/ {* `9 i2 h, \! D2 ~' {8 h
- *
4 J4 \/ I# E' m- z - * brief EDMA3 Test Application
7 \8 }/ w* I2 D7 z( ? - *: c P& v) k: u- u2 h- o) E; L
- * This file contains EDMA3 Test code.. w6 W8 ?, ]$ B$ c1 C( S7 t2 T6 ]
- *+ ]9 }! l& x. v0 h; z$ r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ F, {* r- `- ?& K) t5 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! a4 H% r" e1 S, m2 a* y - * TO CHANGE.
+ ?5 F% d: x, T; T0 [ - *
! l) B% E. _* C* x" e: q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 I- v I( t3 `: }& _ v
- *
4 L5 R* N6 Q: x0 g# ? \- ? - * This program is free software; you can redistribute it and/or2 w/ |8 l/ j: {8 B0 i' O
- * modify it under the terms of the GNU General Public License as1 H* A" ~/ \3 c
- * published by the Free Software Foundation version 2.1 b/ K- O0 A O4 h- n
- *6 B7 A9 J/ \8 v3 U: i, ?: R$ G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# {7 P' [1 `2 C8 ? - * kind, whether express or implied; without even the implied warranty! {' q3 B2 T/ A ?! [ S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# p# F8 |1 ^# s/ r$ l+ r - * GNU General Public License for more details.
( w6 D. Q% K% L3 X4 [2 l. D - */7 I! m0 E6 e6 e# V& b2 I
- 3 K( v4 y f) v9 M' v
- #include <linux/module.h>
/ G% ~3 M2 ]& B4 Y& W' H - #include <linux/init.h>
; Y w! x8 y# T/ }4 p - #include <linux/errno.h> P) J4 S7 O& M) e
- #include <linux/types.h>4 Q+ G* n' \* E$ c9 ~2 ~& K" g
- #include <linux/interrupt.h>8 x5 x0 u/ m- ]" ~) w! q
- #include <asm/io.h>( B# R! k: h6 V
- #include <linux/moduleparam.h>+ m$ z7 T: @3 O) G! z" f+ v
- #include <linux/sysctl.h>
4 T( \; Z! S+ T$ n) N; Y( p7 d4 b - #include <linux/mm.h>0 C7 w% o& c4 M5 z9 q/ Z+ v( u8 |
- #include <linux/dma-mapping.h>! R0 t2 I. k. C# [, g
7 \6 E0 s5 L: ]1 e, }: W5 ]- #include <mach/memory.h>
1 I# i, P! r2 `" [, o8 t; M( Q - #include <mach/hardware.h>
3 Q/ a `/ }. J6 @ - #include <mach/irqs.h>) y, W7 P' i. Z! G4 Y# }* z
- #include <asm/hardware/edma.h>! i; Q* I2 ^! }% C1 o: |
) y9 V( x# [9 s1 h; M- #undef EDMA3_DEBUG+ l2 m4 Q# n6 h7 E2 D+ t1 |3 i2 K
- /*#define EDMA3_DEBUG*/
, ~5 F/ h1 s7 H; N
3 d3 I0 _. B" r2 F7 P' @# N( L- #ifdef EDMA3_DEBUG
/ v# Z) O- c1 F5 I2 o2 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Q' c# R& O: Q" ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 @6 q/ B3 S. z) h' j' s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) i7 Z S v8 W7 O
- #else
c, J% f ~: ?4 H( C5 G, E - #define DMA_PRINTK( x... )$ Y& s8 t# Y+ U( F- ?$ y# ^: M+ N
- #define DMA_FN_IN
y, T0 S) x2 k, K# e - #define DMA_FN_OUT% Y: b4 ^6 ^7 U- R8 S
- #endif5 g, ?. p/ e+ I( e6 P$ z+ j. Z
- 6 y! a( E) Y' ?1 u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 `3 ~4 q' F- F( t+ O& z+ O2 ]. r - #define STATIC_SHIFT 3
% b3 ?; y7 S8 o; G; l+ c, K$ Q5 P9 j - #define TCINTEN_SHIFT 202 M3 X- w. A" h2 j
- #define ITCINTEN_SHIFT 21
8 z7 j) M, z: P3 ]# d' D - #define TCCHEN_SHIFT 22
U0 R' y/ }: V3 z+ p& t - #define ITCCHEN_SHIFT 23! R& \. Z0 U9 r% P1 Q' B' [/ a# Z+ H8 I
" y: B! `8 p5 ^! _( b/ W/ g- static volatile int irqraised1 = 0;
$ c' C) g( j: f, [% u - static volatile int irqraised2 = 0;
) K: u) J5 I; t4 }; l - 4 N* q" \' F1 N9 b- f9 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 v" t% X3 a8 U2 d2 J# V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 `* u7 X0 k' r+ b/ m+ I3 I! c% i! r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 {* C8 v6 c- I
( _1 d; ~ c2 Z" w- dma_addr_t dmaphyssrc1 = 0;
; U8 u( m' v: G) P% _ - dma_addr_t dmaphyssrc2 = 0;
. Z8 S3 M$ m$ W+ F2 s - dma_addr_t dmaphysdest1 = 0;
' j* ~1 f! a, O) t5 n7 n B8 X - dma_addr_t dmaphysdest2 = 0;
' E# q1 X2 Z, [- g& N' k- s - 6 Y& `8 i- ?4 {! J$ g6 p) w$ o2 X
- char *dmabufsrc1 = NULL;
5 _6 N- S+ w5 M' p7 Y - char *dmabufsrc2 = NULL;
* L, F: w7 w" m& D' M. J/ w' d - char *dmabufdest1 = NULL;
0 u" x$ h9 F. U - char *dmabufdest2 = NULL;
6 q$ G# A/ W2 i4 P9 }8 ?3 e
1 i" H' l: x( h6 w% I& n9 R- static int acnt = 512;& [6 J8 ]% z- |# y* X5 n+ X+ \
- static int bcnt = 8;
- `* S! f# N$ a1 P8 Z. ?! L& i - static int ccnt = 8;3 X+ i" P, G9 k! r: K2 d& `
( j( p6 y! ?. A- K- module_param(acnt, int, S_IRUGO);% T5 y. H/ G. b" K1 Y; f
- module_param(bcnt, int, S_IRUGO);7 n* @; }5 z( y" ~7 q: G6 a& \
- module_param(ccnt, int, S_IRUGO);
复制代码
, D m: A8 B: e" \: [3 z1 L- |
) t; L) e+ F) ?3 ~) ^6 K& B0 A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 N' H0 k1 N) Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- c; {- G9 {2 I4 e6 d# V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, E8 I$ x) k" D" x3 z% U
* f4 s. Y6 n: r4 }; ~5 d: ?8 v# p y4 O* U3 z" l* w! q
|
|