|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 S2 B! s% j+ L T3 p
- [code]EDMA sample test application* D* Z& E5 f, E, J$ s' M
- /*1 o# I9 N# U5 J$ |: G( I% y& n
- * edma_test.c
* t, e) k5 y* u* R& O( k4 ] - *7 O' q+ x& A" d. j7 K0 j o8 k% v2 C
- * brief EDMA3 Test Application
6 }9 f- B) `' }, j5 w7 w - *' g& {6 K8 l* ~
- * This file contains EDMA3 Test code.
+ K. S8 d3 N( Y! @$ t! n" R( v - *+ D8 d! r" K0 d- t9 J/ @+ ^$ C8 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 F, q: S C7 [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& Z! c# Z1 m& i) H - * TO CHANGE.# ^* f) N! Q- l
- *
0 f P" D8 k6 x. a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 h# H" T1 ^; [9 [
- *4 Z7 ]! `$ ~8 ]3 I2 _5 `& ]9 T
- * This program is free software; you can redistribute it and/or- B; @- t3 N T V
- * modify it under the terms of the GNU General Public License as
3 _. R" i: u8 E4 H% d+ k. S& g - * published by the Free Software Foundation version 2.
, D0 n3 i9 m) a: M! t5 ?2 ? - *" C, \& _- s* H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ k1 H2 Z3 C9 r$ y0 z) p! _+ \# p' D3 E
- * kind, whether express or implied; without even the implied warranty- W8 G8 I0 Y+ y' e/ }8 ]( {; E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) u& v5 b0 U6 {1 |3 f; E
- * GNU General Public License for more details.
! `9 `( ?# }& W" ]9 M - */
* y: z; j" {* w% x) E - ( r. C3 h% o0 D6 ?: m) @6 z/ M
- #include <linux/module.h>
- [3 g( ?/ p0 w! I - #include <linux/init.h>: s+ D% J- O" C- j6 n
- #include <linux/errno.h>' r1 L9 i9 y$ X/ P* k( ?
- #include <linux/types.h>
/ w: A7 b7 Q" I/ G! h - #include <linux/interrupt.h>9 s7 k. J# \% q# F
- #include <asm/io.h>
- R @3 K5 V$ {, y+ P - #include <linux/moduleparam.h>9 {: ?6 j. U' h1 R
- #include <linux/sysctl.h># c7 L9 F/ q. y; S' ~: G6 _
- #include <linux/mm.h>
5 J% @* Y( F+ Y+ M7 L% w& o - #include <linux/dma-mapping.h>
J4 A- @- C- m
9 a7 W3 X$ M" p4 G0 z- #include <mach/memory.h>! ~; x! W/ G; x9 N' u9 V4 U0 Y4 d7 D
- #include <mach/hardware.h>* S6 T! v! v+ i5 \. R+ v
- #include <mach/irqs.h>% z! A+ X1 @! A# w1 E3 `
- #include <asm/hardware/edma.h>
# s! v _+ C$ G4 a - i9 j5 c! N" i. }1 ^
- #undef EDMA3_DEBUG5 h6 h; _0 h: D, `3 G! r& c
- /*#define EDMA3_DEBUG*/
- L: o; b) Y2 q. y; f
% ~3 e: A5 Z$ @$ M- #ifdef EDMA3_DEBUG
2 [% W! w0 x% o; p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- p( a) S3 Q* L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 F H: h: |9 E6 `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 R. t* J- v) J
- #else
2 B! l, p: \* @5 w, Q b - #define DMA_PRINTK( x... )
7 j: N; D. @2 C* E- K - #define DMA_FN_IN
! B: b8 \ w! x7 s1 Z2 \: E$ _% u - #define DMA_FN_OUT( D4 M) r% ~' a: \4 @$ i7 M% K: f
- #endif. {" \$ _# H6 {* [
- 1 \; r: s( e2 g! O% n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; \* h; p: E4 }, E - #define STATIC_SHIFT 3
$ ]9 k$ i. h. N# x - #define TCINTEN_SHIFT 20+ o* g1 V8 O- a" r2 ^, G) A8 a
- #define ITCINTEN_SHIFT 21
1 r0 l9 o5 `% N; q: i! l - #define TCCHEN_SHIFT 22
4 d& X7 f2 q4 j- b1 R+ E - #define ITCCHEN_SHIFT 23! A& Q( s8 y$ M8 J* [
7 T+ A2 I) u9 M+ {1 Z- static volatile int irqraised1 = 0;
& j1 }+ ?8 v) i - static volatile int irqraised2 = 0;
1 Y0 S1 z* ~; p8 b) M* T+ [
" h% T# t y7 n+ l0 G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# m( ?- j& q1 y# t5 ]4 {: j" R& x. y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
t4 L$ c# |# X7 J8 g3 S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w' M% W" S6 l( `6 }/ O% ?* {
/ I% q6 [$ y9 K0 C0 l; l" ^5 d- dma_addr_t dmaphyssrc1 = 0;
) C9 ^3 L: t/ q6 n& l - dma_addr_t dmaphyssrc2 = 0;
: Q- h4 ^3 Q' j& X5 M; c# w - dma_addr_t dmaphysdest1 = 0;0 i0 _5 t/ I6 S+ F* }9 ^5 J
- dma_addr_t dmaphysdest2 = 0;2 \4 G x g/ J; `( u- c
- A, K* ^, c* N+ r7 A& u6 N
- char *dmabufsrc1 = NULL;8 c( [ O. V! g. K
- char *dmabufsrc2 = NULL;) j; r; F; u9 }, _8 @. B
- char *dmabufdest1 = NULL;9 [' J8 y! v2 F% Z' R; u" ?
- char *dmabufdest2 = NULL;
4 Q" O5 ]) r2 L& Z
9 q8 ?# c# A* i- @- static int acnt = 512;2 n( O6 X8 q. e+ u9 \/ W
- static int bcnt = 8;
& _3 e1 s& N- n - static int ccnt = 8;! t2 d% z( }! m$ j
! {* s$ F; l8 s# z j. ?- module_param(acnt, int, S_IRUGO);
* @) Q5 C3 c9 h3 f5 n - module_param(bcnt, int, S_IRUGO);+ C+ { ]1 W& e3 }* s# r
- module_param(ccnt, int, S_IRUGO);
复制代码 ' \0 Y; a- S5 F9 G9 b
' T/ i7 |. W3 p$ d# Y2 M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: v& G8 a* y7 J( Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 [# _- c: \( ^3 d+ a( g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 y; ~& {- h& n; o6 ^+ k0 u2 ` R
4 }3 j V8 ]. y- M' R6 U2 G
( R/ s f+ X+ m' ?9 }$ A |
|