|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % Z o5 d7 i" s& |6 X3 w7 S
- [code]EDMA sample test application
% b, R- j- S! e$ \6 x0 X2 M - /*! _7 c8 ] `9 j; S B( d1 k6 l$ l# Z
- * edma_test.c
8 i( J, N; _$ s5 F - *
$ ^) c* Y% g8 i9 n - * brief EDMA3 Test Application2 s) \9 j J! N5 H2 w
- *
3 ~; [) T f2 e: d. n/ l" w& F - * This file contains EDMA3 Test code.
8 k# | c% q( V3 V0 H - *
% g$ @( o' D3 X% j, ~* r% p) q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- Q$ f; h1 f7 K; }4 C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' L$ `/ E+ D U# ]# i - * TO CHANGE.8 O& E7 m/ v$ E: P# z
- *
3 B. {6 d7 }$ D* h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& N" m" ?3 a; l' V R
- *
% I7 m) d$ m# w. J5 Y& h3 g - * This program is free software; you can redistribute it and/or
7 p8 f; n+ x6 ^/ T' r( G - * modify it under the terms of the GNU General Public License as
6 _5 ?; Y) t( y6 b0 |! l3 U - * published by the Free Software Foundation version 2.
% S4 F1 S, |/ u - *- Z) _- \0 X. E' y; q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. ]! w0 C6 G, A0 q" B7 {$ g4 T - * kind, whether express or implied; without even the implied warranty
2 z( p+ Y& Y9 ]3 v5 D2 u; q" l- r) ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 L/ l* k l3 ~) P2 v
- * GNU General Public License for more details.
4 b+ l5 }+ `) l, c2 C, g( r' \ - */1 w+ r- j$ {; i2 t" T+ X. E
- 8 u z) }5 k3 e h* x* K
- #include <linux/module.h>
0 a+ Y: _; j( X6 D - #include <linux/init.h>
* A& L& Y7 ~, V! e - #include <linux/errno.h>
6 p7 n v) S5 R0 ~+ h1 [3 u - #include <linux/types.h>. f# s- i% T& r2 a
- #include <linux/interrupt.h>
; M1 Z# ~3 C5 t( w- s - #include <asm/io.h>
' V C. v7 f# m* r4 f! [ - #include <linux/moduleparam.h>) y; \0 b. c! U) l7 @ J
- #include <linux/sysctl.h>
# C4 M c; i5 H# {4 }8 p4 z: S" j - #include <linux/mm.h>
" ]1 n8 i6 }- B5 ~ - #include <linux/dma-mapping.h>5 k1 b: ^( B# A1 a: W
$ e8 y+ {, M+ e# I$ S9 ~- #include <mach/memory.h>0 m/ L& B8 v+ t9 B: |7 o! s
- #include <mach/hardware.h>
" y) M/ {& t+ R5 D& o - #include <mach/irqs.h>
$ a& \# l3 w- I% z: H - #include <asm/hardware/edma.h>
: x8 w; V& d6 v5 i- I
6 d4 Z$ U: L. B$ u4 Q) x- #undef EDMA3_DEBUG4 T/ g" y$ @0 p% q. l
- /*#define EDMA3_DEBUG*/ x9 F! r R+ p' L6 x
- : w3 b" q; V& N: y
- #ifdef EDMA3_DEBUG
0 q) Y2 Q+ a, G) } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) `. c5 I" H8 ~4 b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 P7 L9 @$ R* H. Q$ l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), C/ B+ Q' g& d2 X% |+ S
- #else7 o2 X0 a3 w# @. U
- #define DMA_PRINTK( x... )
" [ t5 T, M! @6 t: h2 f0 s2 S - #define DMA_FN_IN
: N* I* J* u; C$ r% ^ - #define DMA_FN_OUT
T; _' |4 h6 V/ c - #endif
+ T; ~: ]1 v5 _, e6 l
4 W. e" x% l5 y" E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 ?9 P+ q4 m' D" b5 Y& A
- #define STATIC_SHIFT 3' M8 W5 y" B6 f: D# S- P) ^
- #define TCINTEN_SHIFT 20$ A n6 [! ]) j l% X
- #define ITCINTEN_SHIFT 21
* w9 Q, ~; g) ?3 d7 ^& f& L3 p: s - #define TCCHEN_SHIFT 225 a" H! m* k7 B# z, y: K# k+ G
- #define ITCCHEN_SHIFT 23" s# R3 X% P) ?5 a; ^
- % [0 G) N; _' L8 N% F
- static volatile int irqraised1 = 0;1 Z9 y* p* b3 S, g6 M
- static volatile int irqraised2 = 0;
! ]8 F1 T+ q# ]( f - 9 S' h F/ e; l% M6 V# `. L9 ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( D ^. A' i2 @' J/ G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& a2 W- f6 K& q; p! T9 ~" p$ n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" n$ S. \, f! P2 N& q- ~
- 0 h% w) e( U2 l6 N" p5 ?
- dma_addr_t dmaphyssrc1 = 0;7 A- J* F# X/ a5 X, A2 D- W) p
- dma_addr_t dmaphyssrc2 = 0;0 v' v& e9 z1 V2 g5 V% `0 w
- dma_addr_t dmaphysdest1 = 0;
; u+ B1 ~7 \/ C" r/ A - dma_addr_t dmaphysdest2 = 0;
/ Z4 i- Y8 ~- G/ @! y; a
9 `/ ^5 ^6 I: j- char *dmabufsrc1 = NULL;! _& w- }8 {- S
- char *dmabufsrc2 = NULL;5 P5 N5 l# s+ W# T% i
- char *dmabufdest1 = NULL;) U6 m" d5 Q6 l" x2 X) q
- char *dmabufdest2 = NULL;
* y4 v U. r0 H: J; E" M, i
5 U8 X3 W& p* O- static int acnt = 512;$ y# D( x3 `# ^
- static int bcnt = 8;7 U2 Z- i( d7 J8 }- d* S. {/ W
- static int ccnt = 8;, D9 t( Q% f% @% ^9 d4 `$ y. i
- 8 i% n6 G7 Z& i* n- G* a, z! O+ ^: g
- module_param(acnt, int, S_IRUGO);1 P- d" S1 m2 q
- module_param(bcnt, int, S_IRUGO);( _$ j- ]" W' k7 i3 M" A' C
- module_param(ccnt, int, S_IRUGO);
复制代码
, N H6 r- K6 n1 m% c7 l2 U e, p4 Y7 r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* \: T. t; A! q* j* a5 l5 \5 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 q# G/ q2 E# Z8 h! ~, `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) \! T+ v1 D% U- s+ E6 }5 x. o0 i. E# ]
# X: r' E5 Q3 B2 [% b |
|