|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 B7 h4 w5 A" l* G2 m z/ P
- [code]EDMA sample test application, n) D/ x, R( J
- /*. E R0 ]7 U7 C$ T/ s& |% X& \
- * edma_test.c* W& w0 s3 R! V& k5 U4 o! r
- *
; P# o. p; F- q8 W. h* d1 J3 h - * brief EDMA3 Test Application+ L, R4 d4 r2 F; a/ r
- *) G0 U, e, D7 f+ [6 `- T9 f; X
- * This file contains EDMA3 Test code.
' ]4 @5 E) o8 R - * q, G5 F0 J& J) i3 T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 x8 r: z9 i3 z3 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: f' v4 k k9 j4 R4 F% {4 }' O3 { - * TO CHANGE.
) Y: m2 L o9 [% }0 ]" h# b - *; d V% K8 s: E/ P5 t3 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* R+ @+ u- {1 v, s - ** Z% i: h$ v! c& j) C- V
- * This program is free software; you can redistribute it and/or1 M4 T1 b. a# K0 _0 D
- * modify it under the terms of the GNU General Public License as
( x1 K6 {1 Q' V8 b0 h& }/ C Z! ] - * published by the Free Software Foundation version 2.
_& p4 r8 \1 f9 L" `8 i - *, X6 k$ k8 }) p" h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ |9 n* q& E' m* Z4 z' c - * kind, whether express or implied; without even the implied warranty6 W0 G9 [: J& w6 z0 C" ]5 @9 ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ M& {, k q3 x1 d6 u8 O - * GNU General Public License for more details.
1 p5 H# f+ s; M2 m$ ]3 [2 I& W - */
$ g4 U; ~$ z1 ^' }- s4 B - 8 V6 x9 a! N. y. \* ]
- #include <linux/module.h>
# [( ]) h9 Q( U+ i) R - #include <linux/init.h> V3 t' H. W" K5 ?6 b/ M
- #include <linux/errno.h>
* @0 Q4 Y' g5 R - #include <linux/types.h>
3 t+ F2 k+ w- ]3 H/ y$ S6 S8 O - #include <linux/interrupt.h>
% d) Q1 P# {; f - #include <asm/io.h>
" Y7 t- w# q, i- \% O - #include <linux/moduleparam.h>! y* x9 W" D v6 y$ }
- #include <linux/sysctl.h>
# r W- n4 j$ L' s) b5 R1 D0 g - #include <linux/mm.h>
; g. h; l1 J+ n - #include <linux/dma-mapping.h>
: U- L& z5 ?) S - / G0 b' M3 M- ^: U! a" ?
- #include <mach/memory.h>8 k8 ~/ V, f0 V
- #include <mach/hardware.h>
! X3 L2 v) x/ S2 R( P e - #include <mach/irqs.h># @4 o! _0 R. @. \. q3 `
- #include <asm/hardware/edma.h>
5 A/ q- m$ ^( k& o( b8 Z0 H' [2 Q - $ Y* K+ l* R8 D
- #undef EDMA3_DEBUG
! H! Q2 ]: V; t% L$ I4 f* t - /*#define EDMA3_DEBUG*/8 x1 P% }6 @7 k- m: a& y4 i/ a$ m! n
% ]- Q- Y7 Z" M" x- #ifdef EDMA3_DEBUG( S* G; r* n( t T! |: L- r$ w/ v# R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): Z3 L Y5 i& \! {) K4 j" V2 J4 N4 U K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) m6 f0 e2 ]; b! ^% c" Q5 G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 i$ y% c8 _& h
- #else
* T$ q7 }- K$ y% Z) P; c - #define DMA_PRINTK( x... )
$ N- F8 g# ^0 K/ ?1 q& X T2 O - #define DMA_FN_IN
* M; g0 A/ e N4 [' ^8 | |$ X - #define DMA_FN_OUT
, S; \* r8 e' N3 e6 m - #endif. ~8 B4 d3 O6 B1 w/ G' N
- % f; @% ?9 B, _* n: I$ |. c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: P% K0 Q% _( k6 N( ?! s. y - #define STATIC_SHIFT 3
5 m3 ^! s) D0 Q" L - #define TCINTEN_SHIFT 20
2 @3 u/ H3 q1 x# e9 k) k1 S' S; Q - #define ITCINTEN_SHIFT 21
- y1 J+ ?3 F0 `. p4 m% z! ? - #define TCCHEN_SHIFT 22
; E7 f& A3 R! L+ W - #define ITCCHEN_SHIFT 23
( d2 i" G9 N( T" B1 t
7 B9 Y& l. |, A* i9 f- static volatile int irqraised1 = 0;
( y7 [% G; q5 ?- t, K) G - static volatile int irqraised2 = 0;; K5 }( l; u( K+ {% [- Z5 ^) r
- 6 [4 O# D6 Z& a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& x* @, C$ D8 N- g5 f% }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ J. h" Z0 q! k0 j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 m: t# V+ C* x% a! C# ] - 4 }. M; q3 C" m. ]
- dma_addr_t dmaphyssrc1 = 0;
/ F" s- j; @) N. Q - dma_addr_t dmaphyssrc2 = 0;& i% s0 L) P" w, x6 t- w4 t! ]# \
- dma_addr_t dmaphysdest1 = 0;/ K9 Z2 o9 p) D
- dma_addr_t dmaphysdest2 = 0;1 A; |- h' d; S, B3 Q* w
- - c/ t& Y: t- e( r# @2 n
- char *dmabufsrc1 = NULL;
" v, P, v1 I: V) H1 k' a" u7 w - char *dmabufsrc2 = NULL;7 a& [4 P s+ T" W# ~
- char *dmabufdest1 = NULL;" ^; z( p$ Y b" r) y2 {: {7 a
- char *dmabufdest2 = NULL;
8 B. P. p* X$ b5 V - / _. m" E0 P- ]% t" N& s4 B
- static int acnt = 512;2 v1 _) ~; F5 ]0 q" y
- static int bcnt = 8;
% A3 O- j" ]- A: f5 a - static int ccnt = 8;5 L" I8 D* o4 o2 L$ }
- " \ T* o- x2 Y( ~' Y
- module_param(acnt, int, S_IRUGO);
' N6 M6 i& j/ Y% C' g5 ~# u - module_param(bcnt, int, S_IRUGO);
" r [% B1 @6 ?, A* i( I/ y- C - module_param(ccnt, int, S_IRUGO);
复制代码 8 N9 m% A4 d9 A5 F
# i# g v3 j* y0 a$ A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 [; v- M9 p b! _4 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& R. h, U" B9 S2 Z0 v F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 W% ?& [$ q/ Z9 _; a
. `8 T- @! L" S5 |
9 P( @9 }" A( Q' V. l) @" y' C* M |
|