|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& O% x0 J2 G& ?+ h- I- [code]EDMA sample test application2 h# K( \7 a, i5 p# B6 n6 c
- /*" R z. @5 s9 u0 R C" A" V
- * edma_test.c
q y6 O$ |; [" Q# }6 e+ X - *
; [: k6 t' w7 q, l( i# d$ M - * brief EDMA3 Test Application, S# v& Z# B( X" h" i3 ?
- *
- @! L, f9 E3 ~5 u# [ - * This file contains EDMA3 Test code.0 x) I' X2 S2 i2 i6 v9 _5 I
- *
5 n' G" P' ~. j* {5 j' u" M9 ~3 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 s/ `7 ?( ?' [1 }4 H1 q( B8 V: D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 _+ j+ S3 c- `5 ?9 d0 U - * TO CHANGE.
- M6 [7 v1 c/ F* i - *
/ G* m3 g0 L4 j+ g5 b7 m+ A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* r/ z/ c5 B2 b6 H* \6 a - *
! f" p: f! N( B - * This program is free software; you can redistribute it and/or! V% _0 Q" Y0 i0 r
- * modify it under the terms of the GNU General Public License as
5 R) `" o3 S4 r4 N0 I. ?+ j - * published by the Free Software Foundation version 2.
1 F3 Z$ N! C9 f4 C* ~ - *
/ f4 C! F, A/ @1 p$ v$ J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Q6 t" j1 Y9 i7 i9 v- s% Y
- * kind, whether express or implied; without even the implied warranty) I8 \8 N) L4 G A/ ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the {7 F+ [ M) x
- * GNU General Public License for more details.
% ^) j6 l" ^! Z% A/ P2 W - */! W( i& j* S+ ]
, M: k7 u6 \, C! @( E! [2 V8 C7 T- #include <linux/module.h>
- Q! `: \& Z0 q; U X* w( h - #include <linux/init.h>
. A5 a8 t. j! {$ {6 T9 N - #include <linux/errno.h>
5 L7 y h# B2 l2 G/ y! ] - #include <linux/types.h>. a8 N m$ H, G. \$ y/ E+ a
- #include <linux/interrupt.h>) I3 J$ w: {& ?) {2 S- M
- #include <asm/io.h>4 C9 \) b$ E- _4 p
- #include <linux/moduleparam.h>
7 w! x0 c8 i1 t. z4 z6 \1 K - #include <linux/sysctl.h>
N2 f, |5 S" E1 n$ F - #include <linux/mm.h>
0 W, S6 S4 u( x - #include <linux/dma-mapping.h>+ R! x( ~8 E- Y. C: w+ j& y
- : D2 S! J) |5 D4 G4 H' `
- #include <mach/memory.h>" G& E7 a$ j- s* |
- #include <mach/hardware.h>6 w7 e8 B$ K2 s/ M( ]- \* R7 R3 N
- #include <mach/irqs.h>
' ~5 \; Q5 G3 j3 X { - #include <asm/hardware/edma.h>
0 p1 L# d' o3 e& N2 W1 z1 m( `3 n { - 6 P- R0 g, _) T' t
- #undef EDMA3_DEBUG
9 x: d. y+ [5 ~, ^9 _9 _) l5 D - /*#define EDMA3_DEBUG*/
* S: ]; D8 o" @, d+ _% `( \. X - }: Y6 y" l5 [3 a' ^, n* N8 k3 K! ?
- #ifdef EDMA3_DEBUG
1 D) Z. L/ N, A! a8 c- m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 w( x" X9 S8 K( p% d) |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
x" q9 @, J6 _4 V& L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 C& R% s8 F+ U) X: O( }
- #else9 K0 j. p" ]6 Z# H6 F
- #define DMA_PRINTK( x... )8 N9 K& X- j- A9 s: H2 B/ k- O
- #define DMA_FN_IN
$ i2 U2 _2 j$ ]2 y - #define DMA_FN_OUT5 Y( \! ~# t% |
- #endif
# X5 k3 N3 K' }9 j
' l- S" e5 ~3 x2 {% T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! w" T9 @, N1 @& F) p- r' a) J
- #define STATIC_SHIFT 35 n C# t+ `# ?: F/ N; S
- #define TCINTEN_SHIFT 205 }& Y" a# _/ [2 q+ |/ k7 Q6 {
- #define ITCINTEN_SHIFT 21
- b; x) ?+ @9 W5 F - #define TCCHEN_SHIFT 22' S, b$ F, ~6 s( }: V- c
- #define ITCCHEN_SHIFT 23& R& L, g8 p% c9 f0 x5 ~8 {# ~
; @7 i$ X+ a7 L! s( N- static volatile int irqraised1 = 0;! l: C7 `; u" l6 k1 `; g
- static volatile int irqraised2 = 0;4 y$ i0 u& D4 C# E0 _- B
; }% T# p& i9 a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ?2 X* m4 K1 b3 [4 d5 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 b% `+ V/ ]( V: _2 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 e0 k' i6 f) h. K1 O6 l# |; T
, T2 \! \& ]( t0 q2 e' r8 u3 S- dma_addr_t dmaphyssrc1 = 0;
4 g- T7 ^8 A# B2 x+ T$ U* l, z% k+ x - dma_addr_t dmaphyssrc2 = 0;+ S2 G# _. B6 r
- dma_addr_t dmaphysdest1 = 0;/ k6 J3 I$ S: l) l' [# \
- dma_addr_t dmaphysdest2 = 0;
- i3 m9 G9 A9 N# G" y
" s9 i: s& s/ f+ C1 _3 q! z- char *dmabufsrc1 = NULL;# n2 X6 D0 a3 M' U% e# I/ R6 V' D
- char *dmabufsrc2 = NULL;
/ W g8 \% \ A; { - char *dmabufdest1 = NULL;
0 K9 [- J3 m' A! }9 F7 L, G8 L - char *dmabufdest2 = NULL;
/ n' n* G9 U- p/ l, Z+ M5 D
( h4 Y6 T6 b) l$ d- static int acnt = 512;# X5 J3 t* M: D% A" C2 y
- static int bcnt = 8;
- e! z1 w0 t, A$ e - static int ccnt = 8;
" J5 X8 E- f- J8 X9 \
* f* u# M; L) O, j! S- module_param(acnt, int, S_IRUGO);
0 |0 X3 `' N% q9 k" {- { - module_param(bcnt, int, S_IRUGO);
" s' D( O/ m# X- |1 z0 c - module_param(ccnt, int, S_IRUGO);
复制代码
* c% D- ~/ q- B# j' @$ @" i- [, o4 K+ e2 `4 w: }) @$ n7 C( `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 m! q& f" v: ?* g. ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 A' @4 R! i) C2 C* G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, @* Q( \" r2 R: O9 U
' V; t7 w6 j$ y+ v. z6 n" i/ D% H! r+ n z+ q( B
|
|