|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 V5 U# G, e+ M" z2 O1 z- [code]EDMA sample test application4 a6 X" ]# r$ W, }
- /*
! M+ Q3 a* u% n. z/ b - * edma_test.c
8 W3 X, M D2 T, f! b" K - *
+ S/ W& }8 `& B: z - * brief EDMA3 Test Application7 I& H6 ~) m# O
- *
% j/ n9 C! [) v* u9 j9 S4 ~8 j - * This file contains EDMA3 Test code.
! g+ S. \5 w% q& Z$ I& o+ o- q - *6 ?/ c# u+ k- _7 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" A7 M1 W( l/ B* A) N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 }* Z- M y) [+ g. g
- * TO CHANGE.7 N; J8 p- [4 N' O3 D
- *
% z Z& a. I$ o8 S5 w# | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 l, w4 J4 _/ v+ L' e. } Y - ** [ R. }# T5 J
- * This program is free software; you can redistribute it and/or1 Y1 C/ J0 q* i8 D, B
- * modify it under the terms of the GNU General Public License as
; _& Y) ]! B7 @ - * published by the Free Software Foundation version 2.1 }7 s" {5 I! R
- *
# b4 O5 u; i. x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, f M ?7 }) O6 d/ @
- * kind, whether express or implied; without even the implied warranty, L8 B3 g8 u* I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the R. y0 z& ?0 k! n+ T; \) }' ~
- * GNU General Public License for more details.
- Q* m0 x* B) ]6 b& c1 j - */+ s' @4 j! }8 o' t
- / _4 ?/ e" \& _$ t: H6 }
- #include <linux/module.h>" A. J6 i. X( {& y
- #include <linux/init.h>
# ~% M( b/ R: Z# R - #include <linux/errno.h>( \7 V, w* `5 K
- #include <linux/types.h>
, B4 S2 l1 ]% m. M+ ~ - #include <linux/interrupt.h>
0 a9 \1 _3 H7 _9 k - #include <asm/io.h>8 |" S: N% L4 L! `! B5 f o5 @% \0 \
- #include <linux/moduleparam.h>
6 m2 J$ F7 F- | - #include <linux/sysctl.h>
# b# ~( U0 v" r, l/ G - #include <linux/mm.h>8 [- x8 d7 F; f# P
- #include <linux/dma-mapping.h>
" Q3 g+ P- c9 X& _7 x
& ~: n4 U3 D- h4 T6 @3 \' B- #include <mach/memory.h>$ V6 u4 i" P+ S: Q; B
- #include <mach/hardware.h>
{2 ]9 ]( e5 a. {- a - #include <mach/irqs.h>
' o& x. p" x; d! b5 ]- I% X& G6 y& _ - #include <asm/hardware/edma.h>9 O1 B& E! E! v$ ?6 Z. n
- 6 x9 l0 Q# C$ B% a7 L0 k$ {. L0 G8 u
- #undef EDMA3_DEBUG; y, k+ [* {% i; P u4 i! K% S* x
- /*#define EDMA3_DEBUG*/
( _2 I9 Z8 x% b& L; {% l( t* z
8 ~4 I' o, M& k: ~, `- #ifdef EDMA3_DEBUG- t( b- Z5 C( C3 o: p% B. q5 _) _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- I9 j: [+ A" s! ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ g" S0 B! e/ k* V6 i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ v" q. l# x$ N, l* n" h/ J. g - #else1 c4 i2 W' }6 I
- #define DMA_PRINTK( x... )
6 v6 W6 _2 A$ t, q/ W - #define DMA_FN_IN
8 E3 ^ P6 q* v( o& ?6 G/ ^$ p' ^ - #define DMA_FN_OUT
, D+ X/ S4 R4 G( h: p8 z) s - #endif. F% V; m, y6 Q) t8 R
- & o3 Z, c( r' f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ N7 U3 U9 L& |$ k - #define STATIC_SHIFT 3% w9 u. p A3 ]
- #define TCINTEN_SHIFT 20
; |% ]; @3 m# k0 Y1 d7 h# K - #define ITCINTEN_SHIFT 21+ T# i3 G) T; Z+ P" q
- #define TCCHEN_SHIFT 22
! I" Z: {, n% L9 `! \ - #define ITCCHEN_SHIFT 23! K3 }# s3 n' }0 D: F
- 8 H( P. y5 \% M- c0 h" h
- static volatile int irqraised1 = 0;: p% j- {/ S) v! k3 [ V, ]
- static volatile int irqraised2 = 0;$ J5 }& E+ y2 G( F2 L
7 c( M" ], V$ w# h1 l: s, B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ K% |5 g3 J9 d$ {: k$ E' Y h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ~6 ]/ D, n# l% c0 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, _, W- e' Z) F - 1 ~8 ^8 z' j1 h) J; s# J
- dma_addr_t dmaphyssrc1 = 0;3 r; o2 D; j$ e8 K
- dma_addr_t dmaphyssrc2 = 0; I! Q. A) [( @& x, |! {, T& f
- dma_addr_t dmaphysdest1 = 0;/ Q8 j% F7 }! O$ f0 N. l" c
- dma_addr_t dmaphysdest2 = 0;
* U1 o5 _$ L% J$ B( x. F
' `0 T$ X* [+ a5 I0 ]# j- char *dmabufsrc1 = NULL;
2 K( @7 |; p0 `( g6 A0 U0 [ - char *dmabufsrc2 = NULL;
) Q, J- l. d& y - char *dmabufdest1 = NULL;* t2 ~) B/ B& T% n9 A* n% N2 M
- char *dmabufdest2 = NULL;
2 }: D$ R6 u' [1 E. L - 3 X- J/ d1 x4 n/ R5 d9 ]
- static int acnt = 512;
7 c& l( _- J6 |+ l1 Q- ^# F - static int bcnt = 8;
6 k$ i. G L0 b' O - static int ccnt = 8;* z4 N0 f8 L7 f+ I
- - ~0 L% K) z) z3 Q1 a+ O* d
- module_param(acnt, int, S_IRUGO);
& S4 U+ s+ w) q$ o - module_param(bcnt, int, S_IRUGO);1 e+ R: Y3 i' e1 L; L3 H5 `# b& a
- module_param(ccnt, int, S_IRUGO);
复制代码 ! N% E; J# W# R+ v# H
2 o$ d! d) ?7 i6 j- M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ x& w! ?( p1 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 z3 m8 V# u$ _' j& \ O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 Z; Q( |2 s- R5 [ Z$ U% H
- y7 F( F, }' l& x: k0 T
" a/ q3 U) I% s+ P( M- k* @ |
|