|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( \3 P: D! |5 A+ R
- [code]EDMA sample test application
6 {9 ^9 a5 @5 `% k# B9 ` - /*
( h7 V1 H9 J7 h - * edma_test.c" y" D5 \$ F# a4 P) l
- *' J0 z5 w! N; x: t4 [
- * brief EDMA3 Test Application
& J+ |$ y" b+ c; S8 a. u8 d* n - *
1 r1 M8 O8 r3 e( G4 Q/ u* c - * This file contains EDMA3 Test code.. R4 q9 S( d# R' J R
- *
, ^# U1 t% K2 _3 f4 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 O( @2 g9 S% U2 K3 y( @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 B+ Q. Z- _+ v; z
- * TO CHANGE.
" x8 t" @/ o( u- `' W - *
1 N6 i( q4 g4 z' M7 B$ A4 i2 i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& r2 |4 k8 J3 ?3 | - * V* Q3 Q% k, i) @ @
- * This program is free software; you can redistribute it and/or( Q2 E! ?. f* k4 s( l
- * modify it under the terms of the GNU General Public License as6 `3 ?+ Y3 \4 z3 T, \5 T1 d* I! D
- * published by the Free Software Foundation version 2.
' X4 M5 g. [+ i& l* W - *
- R# I ?! J' ^; X r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- R5 @ F- {2 v1 z - * kind, whether express or implied; without even the implied warranty
. f8 z4 ?$ `/ _7 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% O- n- Z: X2 \* U2 K$ k9 m - * GNU General Public License for more details.9 G! j# o: [- K, o7 ~, _7 J' N* a
- */7 d8 F6 I* u8 t# m% m) b. B, [# h
- 6 Z! ^- m: z1 ?$ s& T% O
- #include <linux/module.h>3 i: e- `$ B1 B- i- O# ^
- #include <linux/init.h>/ Q4 M2 F1 C8 l
- #include <linux/errno.h>1 q) z1 `3 g& M8 V9 l
- #include <linux/types.h>, n& e7 o$ Y2 ?
- #include <linux/interrupt.h>
& S: w3 i3 f& W$ C - #include <asm/io.h>
2 b0 r; I; K: `% ?' G. M2 m+ g - #include <linux/moduleparam.h>
' h/ F7 i: B. T+ {/ x - #include <linux/sysctl.h>
9 e9 }! k z' G, A1 o% k8 X - #include <linux/mm.h>
3 Q o4 S/ c) H5 i( Q/ ]9 _ - #include <linux/dma-mapping.h>
; I9 J, H5 o" r9 f6 f0 M
, c# D: ?* z- x( ] A+ D1 V- #include <mach/memory.h>
2 v+ c" y1 @, L4 q" g - #include <mach/hardware.h>1 t- R) e# B) j
- #include <mach/irqs.h>
0 D7 \* r- A1 r8 ], k- @8 K: N - #include <asm/hardware/edma.h>
' C1 y5 j$ @. L/ e4 x/ T) S7 k9 q - ; w& G! M: O0 F& l. Y
- #undef EDMA3_DEBUG$ w. f4 a% a7 U6 O% l
- /*#define EDMA3_DEBUG*/5 k- Y! h8 E1 H7 N2 z6 H" K
5 f* l0 g' l# y$ H5 S- #ifdef EDMA3_DEBUG" a* u8 R( d! O* H8 y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' O, u$ V$ a1 l6 j) g G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& @. V# |4 x w' ^! z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! i+ a+ W& z6 Q4 d; P" u
- #else
) r) [2 G. ^, _1 y, o! a. r - #define DMA_PRINTK( x... )% O+ Z3 U r( M N
- #define DMA_FN_IN/ } \9 O( ^9 K- L3 G
- #define DMA_FN_OUT
1 {5 A8 n- ]% M- W. L' ^ - #endif
4 k* F# M. h1 J, n6 q - - d2 Q; c/ Q% l, v4 E- i1 V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- b, L- k% n, {7 d) \9 t - #define STATIC_SHIFT 3& }! |6 V' m. m, T) e3 y
- #define TCINTEN_SHIFT 20
1 L7 f& i* J& z7 l( E& a w0 _8 r - #define ITCINTEN_SHIFT 21$ I0 A" E1 X& L" ]" `5 I
- #define TCCHEN_SHIFT 22
+ L1 m- y/ I' c: f3 D - #define ITCCHEN_SHIFT 23
$ \9 H: P; |3 X4 j6 q - u7 V& e U; |9 [' ~7 T
- static volatile int irqraised1 = 0;: R+ ~+ Y& {7 d6 t% C
- static volatile int irqraised2 = 0;. q3 ^8 v) a1 @& q4 V1 u l
. {: h' S% `0 `/ x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& P9 K" ~4 ]9 ]' m& Q7 Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e4 O, j; e' e. w& ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 G+ y! x c0 h$ J& e$ }
2 i% q/ b0 `7 n& d1 J- dma_addr_t dmaphyssrc1 = 0;9 F- D+ |3 M1 s- e
- dma_addr_t dmaphyssrc2 = 0;0 q- d' l, s' B c/ O% E
- dma_addr_t dmaphysdest1 = 0;0 M: u6 L0 B; ]' M R
- dma_addr_t dmaphysdest2 = 0;
: m9 h) d* U4 q" Z$ U' H# N
5 u% ~0 ]+ S' Q F W7 s- char *dmabufsrc1 = NULL;
4 m% [" G1 D/ h# P. o- s; A - char *dmabufsrc2 = NULL;
, K s! O6 o# {0 E - char *dmabufdest1 = NULL;
/ H- G8 {$ u1 _ R - char *dmabufdest2 = NULL;
' c% e7 G4 L1 Q7 V" P7 W - 6 M8 x$ n6 t+ x4 n: a
- static int acnt = 512;
9 \# E& c# }% @9 x - static int bcnt = 8;
* V' _ ~$ q6 v" t - static int ccnt = 8;4 M# @! @- A: Y9 E4 o0 ?! ?
- * R* ]( P5 r, ?& i: _5 L4 k
- module_param(acnt, int, S_IRUGO); Q$ x3 I9 a6 |) f# M; h: ~. @
- module_param(bcnt, int, S_IRUGO);
: ^) c* D1 C& `2 C - module_param(ccnt, int, S_IRUGO);
复制代码 - h% n, c8 J, ]* j
6 u, J! U! b: ~" M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# J& U6 V* q Q3 Y/ d* c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" _1 j1 f% d/ Q& \* C ?' q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 ?, Q1 N) I2 t9 g9 m
. p% Y+ t7 a: X! w. J' \+ d
( D A6 M& ^. t3 P1 O; z; L
|
|