|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 k) V% ?3 p3 U/ ?# e9 b- [code]EDMA sample test application5 Y0 k( d- L' i& ]1 Y1 ^* I" d
- /*0 I1 T5 t I; }
- * edma_test.c
3 P+ w+ J5 s* }3 n, z2 w# _ - *: M8 W5 T( Z0 I3 T+ p, a% G) l
- * brief EDMA3 Test Application9 D4 p/ U' A) q! O$ x7 r
- *
' e# w+ y0 B1 Z4 Q8 w, t4 x3 a - * This file contains EDMA3 Test code.- U+ l; B) G% }& ~
- *7 `1 H2 u; ?: l" ~7 X8 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# [5 y4 M8 [# W7 O4 h# ?) C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 X# A1 X0 L9 p% q7 n+ Y& Z
- * TO CHANGE. ?- ?9 D8 j' x0 _/ F6 n, z4 j
- *' W* t& }4 e4 ^, V, ~6 M5 r }3 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# Q6 V" B& N k3 Q
- *
# I! g! }' y0 s$ F/ D: K/ x& N - * This program is free software; you can redistribute it and/or
* F2 z7 u9 I) \/ H. r8 y# C! D# D - * modify it under the terms of the GNU General Public License as. |7 _) ]6 n+ n& C9 R. {- f7 M. z
- * published by the Free Software Foundation version 2.8 k- U2 t. u2 v. D1 P: y. g( b
- *
2 }* G3 ^0 F4 V' G$ c( q/ P; r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 E, s* [5 e4 X8 D1 k9 _) G
- * kind, whether express or implied; without even the implied warranty
$ V. X, c* ^& v( d2 W% O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; g+ f; d. S2 C v" J, n3 {
- * GNU General Public License for more details.
, _9 f) m* W: |1 t( q - */
. L# H# U2 w* ^- i- ^ G/ k+ s. @; k - , { t; V2 z# _1 o- z
- #include <linux/module.h>, ~7 i6 x J* b) \0 ~. ^. ~ R
- #include <linux/init.h>
/ ~" l: L/ [) D: b4 t - #include <linux/errno.h>
5 }4 }; Y- G# s* a9 j* m1 C - #include <linux/types.h>
! U& h+ t# I: F1 y* I - #include <linux/interrupt.h>
6 w) Z L. V3 C% Q - #include <asm/io.h>% `& G: i: \0 k H. u- v
- #include <linux/moduleparam.h>1 {- C) E3 {& ]2 x, j ]5 G/ {1 Q
- #include <linux/sysctl.h>
: u( m! V0 }. F - #include <linux/mm.h>
" S5 r' m8 z- H+ k- s" p - #include <linux/dma-mapping.h>
) k5 }( C, I% V' _8 V3 E: `& ~ - - J# u8 H5 G7 W* T2 F
- #include <mach/memory.h>
( r8 g/ w+ q! X. ~$ T0 q8 ~ - #include <mach/hardware.h>
/ {8 F% c: E0 m8 y, o0 Q; j - #include <mach/irqs.h>
+ x; _5 L: P1 e - #include <asm/hardware/edma.h>) B6 } |$ q ?* ~
; q6 }: L$ @5 a- #undef EDMA3_DEBUG6 ~4 L3 l7 { F/ e3 c/ o) G E
- /*#define EDMA3_DEBUG*/5 I7 H6 a. X0 S, e) Y0 E$ J
9 Q N9 M: H4 `9 q4 ^/ \- #ifdef EDMA3_DEBUG
$ C+ m- _" B3 P7 h/ p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): s3 E7 l; e. O6 ]' ~2 [1 G( ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 U8 Y+ L* `5 v2 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 I6 p" `* @ y6 L% m6 _6 w( Z+ A! { - #else4 C. |6 [& v* F( L
- #define DMA_PRINTK( x... )5 C! I) Q5 s0 n8 l' ^
- #define DMA_FN_IN2 z. C. V! q. I" L5 G+ Q `
- #define DMA_FN_OUT
' M4 \3 u- p7 J2 y! c - #endif
+ d3 L% y: j7 |! C" B3 {8 d# d - 8 N5 }; g0 b- R2 c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 A( G- L- [) Y7 s/ E: O - #define STATIC_SHIFT 3
6 S$ f2 d8 X+ Q% g* A - #define TCINTEN_SHIFT 20
- S0 O! Z' V6 F# J- ^! j$ d! e3 j - #define ITCINTEN_SHIFT 21
; V( d) z$ ]& L8 M& ? - #define TCCHEN_SHIFT 22
& m, o, [- v- o* [$ n& J, _6 f - #define ITCCHEN_SHIFT 237 E) x6 _3 I) }& a
- % P6 m8 P. x6 O; A( V
- static volatile int irqraised1 = 0;+ D2 T4 o& C+ `" N
- static volatile int irqraised2 = 0;
5 {* j* A/ A6 p" L7 Y) I0 F8 P9 ] - / a0 i1 M; o% M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; z- `. x7 `5 Q( i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# r$ a6 P$ l. k- E: y9 T/ S7 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# U$ Z- R# g# y( t! M4 I - ' R6 V( s0 S E
- dma_addr_t dmaphyssrc1 = 0;
% Y/ b) f- T' F' ~8 j# Y - dma_addr_t dmaphyssrc2 = 0;$ z, T3 p- \& N7 m3 g) x4 U8 G+ a
- dma_addr_t dmaphysdest1 = 0;
) L/ k- N8 D8 [3 p% i - dma_addr_t dmaphysdest2 = 0;
8 @7 h. D8 g* A5 Z" O4 K7 q" d& s
4 y/ K' ^; \ \) G* w/ H$ \0 b- char *dmabufsrc1 = NULL; I% U) [' L0 ]9 E1 x+ K: \; c
- char *dmabufsrc2 = NULL;
+ g0 H' i) F/ A. v/ U+ \ - char *dmabufdest1 = NULL;' g' |3 x! Z5 z7 @# ]
- char *dmabufdest2 = NULL;4 }+ a' j7 v! J3 F
- 6 u1 `7 e9 d( x1 w
- static int acnt = 512;
; k6 f3 ?$ ^' `. T9 w3 r/ T# E. G - static int bcnt = 8;+ f- [8 g6 X# T* I# k$ `
- static int ccnt = 8;
c( v) }' X3 z/ X. V Z4 f
7 j) ^: R$ W m# i- module_param(acnt, int, S_IRUGO);
# y& i0 p4 O7 c' w% W - module_param(bcnt, int, S_IRUGO);" {2 k3 B( ^% N2 L3 {
- module_param(ccnt, int, S_IRUGO);
复制代码 ! ]) m- ?2 I8 \# _+ A4 @* [5 b
: ?$ ~. T* G6 o. O* r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 E4 F( g6 v. b# Z& varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ?4 D- K7 D0 J2 V4 P( F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- W5 Q( m" ^+ f4 r, p
6 R$ m" s9 f n$ ]; h1 y3 J% i. _; |4 H. K% F9 S7 F) y* l
|
|