|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 S* V# g* N+ J5 z0 ^- [code]EDMA sample test application
[) e+ M8 ?* Z @; T2 P+ `9 U4 r - /*
5 B5 i3 c; M+ u7 L, ?) P: ^ - * edma_test.c
4 I1 q' i |$ y& u3 {* @4 G - *! o) Z1 g, ~7 Q8 H/ q( r" i: s2 l: @
- * brief EDMA3 Test Application
* o6 R7 t$ i! P# {2 f f - *
1 M/ H: `8 }" U( e7 A8 o8 A - * This file contains EDMA3 Test code.7 Y( V0 B: v* A& G. O
- *
3 Q8 w6 ]( [* \9 x' A9 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' Y6 H8 O% w: o1 ^- K# l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& [: P$ Q% y- v- A. N! X" y9 G% Q5 d
- * TO CHANGE.
7 V6 ~' @# Q% I; G/ w+ ~# w - *
& z+ R4 q7 I1 `$ z8 o9 L" N. K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" L, N2 E, |. H* r$ Q; | - *& N! z' E6 l9 r6 ]; c5 L+ ^; G, [7 c
- * This program is free software; you can redistribute it and/or$ Y `) Q+ K3 {- z4 W
- * modify it under the terms of the GNU General Public License as
$ S* N8 v# ~6 ]7 m: C$ z2 ?& @ - * published by the Free Software Foundation version 2.% d& a- N! c0 @# g
- *
^7 [) \1 ^( {; A$ ^" m. u m t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" b+ W+ T' m% ]9 K0 D( `& r
- * kind, whether express or implied; without even the implied warranty
' I4 t Z, p( [; L5 Y) Q; n0 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 M# S# _" r: N6 ` v - * GNU General Public License for more details.% F. J: ~% A, [- y4 B
- */
/ P# P9 A) \& R* c
6 A# O% v/ ?0 P% S" z4 u- #include <linux/module.h>+ v4 o" F$ J c' B1 a6 A
- #include <linux/init.h>+ l' v2 o0 L6 Z3 M3 _
- #include <linux/errno.h>% t, ^5 q3 p3 \9 \
- #include <linux/types.h>; f$ S& l1 `9 X
- #include <linux/interrupt.h>; N: ?) ^& ^2 ^/ l( S2 t/ U6 i2 d e! q
- #include <asm/io.h>( i k: P' @: s- [0 ]$ j
- #include <linux/moduleparam.h># d' e0 Y5 f6 T' q* `
- #include <linux/sysctl.h>
- u5 N1 G; X2 C# D& ]8 S - #include <linux/mm.h>
K8 T7 ` {! Q - #include <linux/dma-mapping.h>
' n8 H s" ?) l0 h: ?. L - % s; Z' M% b; U3 X
- #include <mach/memory.h>
9 J9 E, e( G& u% `6 X/ O9 Y9 E - #include <mach/hardware.h>) _* E/ T4 F- O
- #include <mach/irqs.h> h( u( S5 V1 q+ [. `
- #include <asm/hardware/edma.h>$ q. c- D/ [8 G# \
- ' ?1 S; T1 ~! n5 B$ F, `! T
- #undef EDMA3_DEBUG
2 x C; G/ e, x8 [ - /*#define EDMA3_DEBUG*/
! C% i2 k9 M& M( t6 J: d% z
7 \# a; \# ~% i a r- #ifdef EDMA3_DEBUG1 B8 [# n* S4 G) f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) w/ z9 r! A& q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ G* h. p4 n; p# R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
|+ l0 h7 N/ e8 y$ r3 Q - #else
# z( }% S8 n0 k3 q1 x: }, X: Z - #define DMA_PRINTK( x... )
, K4 L- [+ B8 g - #define DMA_FN_IN
) S! o( l, ~% S5 O; E% f - #define DMA_FN_OUT3 B5 H3 \0 L" _
- #endif1 p. J0 Z& M3 H
9 V3 n9 U9 |- g$ W( ~" Z: p7 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 C8 n; D) b v - #define STATIC_SHIFT 3
7 c$ V: P! A3 b: a - #define TCINTEN_SHIFT 20
0 @6 r4 ^6 l5 ?5 c) d/ q5 l - #define ITCINTEN_SHIFT 21
, r& V5 i- H+ `+ q6 B - #define TCCHEN_SHIFT 22 J' g+ ~ \& p
- #define ITCCHEN_SHIFT 235 d: _; ]2 ]4 ?2 r% ?
# r- P9 t& M# C d! N- static volatile int irqraised1 = 0;' c: B+ r; J0 Z" ?
- static volatile int irqraised2 = 0;
6 m; X$ F- R' H. S8 A7 u h - 2 H. v3 q8 B a. p% J* I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 y2 s4 t( T; g1 m! ]& N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ]: k2 X" R* ]3 E' [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 ~0 i+ O6 |, Y }
& _7 y S& K3 e8 i- dma_addr_t dmaphyssrc1 = 0;
! J4 }& D2 I; ^ |0 l& |& r1 P - dma_addr_t dmaphyssrc2 = 0;8 h7 d2 ]( T, g( ^
- dma_addr_t dmaphysdest1 = 0;9 P* K1 B6 m& C% K0 X3 j6 x4 P( p
- dma_addr_t dmaphysdest2 = 0;/ z: G" D7 `4 ]1 [! p* ?, \
& g4 h0 f' @- ^6 h" E- char *dmabufsrc1 = NULL;' W; J" s5 p$ u
- char *dmabufsrc2 = NULL;; c7 c" S; y6 C% @) ?+ S7 ]
- char *dmabufdest1 = NULL;+ w6 e' g3 [( [" d ]7 Q8 n4 v
- char *dmabufdest2 = NULL;
8 Z+ O% a2 w5 @9 E. Y7 `7 V" h - 5 M$ P4 Q; y* v1 }5 Z, D" w: _. o
- static int acnt = 512;
/ `" s* @' h3 P$ X7 g; m - static int bcnt = 8;5 A- p& G4 r8 t3 ]6 ~
- static int ccnt = 8;
, T& q8 w" R" D. \, F4 _1 x6 \# R - ! b, A; l4 \: }3 d; s. l7 F
- module_param(acnt, int, S_IRUGO);
+ P E# [% c0 b - module_param(bcnt, int, S_IRUGO);# @1 `& _/ Y$ b
- module_param(ccnt, int, S_IRUGO);
复制代码 & Y+ ^$ i2 h/ l% M% z7 @, H& S
- |$ |/ {. x4 } x- T1 ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& |7 Z& A: r& D/ j. h* q7 s6 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
V- j G* _8 k p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 |% A' i8 m! q7 S- ]6 Y' K
: ]) `' k1 y( u _+ J3 i
% H8 M3 C7 ?4 _) @ }7 u9 |- ]
|
|