|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 v) N. [# @; z) S
- [code]EDMA sample test application
. O5 J% n0 x: B - /*
/ T+ L7 ]0 X5 _4 m8 h; r - * edma_test.c9 m0 h# A% b8 \9 h5 M1 T
- *
o/ `3 ~; t! i, l - * brief EDMA3 Test Application
& B" ~. R; o1 m+ Y9 Q+ j0 n& {" \ - *$ A& j- ^6 _1 a
- * This file contains EDMA3 Test code.
+ O# Z0 z! j- n - *& b& }6 V. G2 g K* h- h8 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 P. H" E8 T. [# F! n/ c; F, j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 f0 m& s6 R. }+ B/ X- E: r, A9 g
- * TO CHANGE.! ]* k$ J+ ^% ~, A+ B5 i. |* f
- *- s; {- d* A" V. C% t" {" {/ [2 s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// o9 |6 N( E# N) }, R
- *$ o; E: p6 J+ p* |2 j" f" `
- * This program is free software; you can redistribute it and/or
% R2 L' v) \+ g - * modify it under the terms of the GNU General Public License as! u/ L& O) F/ g1 Y; w [
- * published by the Free Software Foundation version 2.
6 i S7 e: q# n+ P - *2 H" M+ t2 T3 l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 O* ?$ K. y6 g; ~3 [7 G
- * kind, whether express or implied; without even the implied warranty) t# `' H9 u- a8 B, [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ ]& C8 q) ]7 C# u7 y( L
- * GNU General Public License for more details.; m# x: {/ M' i% Q
- */
% }4 N. Z, Y5 m- f6 U& G' c: ~4 m
1 m! E' I- p4 B- #include <linux/module.h>
* M2 w- X9 l: J F" L - #include <linux/init.h>, x, ?# k% D5 X9 P e# \! M
- #include <linux/errno.h>
# u+ b' E, {8 R, p7 \. U - #include <linux/types.h>
0 Z: O! H5 t5 Z* g: j - #include <linux/interrupt.h>; F4 ] V7 C a7 G, v' a% g6 G" x- c
- #include <asm/io.h>
) {- v, W5 `: m - #include <linux/moduleparam.h>4 N9 j: U/ t7 K; h* W% ~
- #include <linux/sysctl.h>
( d, S$ n7 [& G6 P/ X9 A+ Z - #include <linux/mm.h>
, S8 q; R6 o. z, y - #include <linux/dma-mapping.h>: G: W. J' i7 S' K. W3 H; G' H) C
2 |. }; H# ]; q8 V& N, l4 X- #include <mach/memory.h>
3 v! ~; v2 X9 j. d$ E3 Y" k1 K - #include <mach/hardware.h>0 r; O1 a: @- M3 Q. j- J
- #include <mach/irqs.h>! v9 x9 Q6 r$ Q, {+ F# I) t
- #include <asm/hardware/edma.h>! @0 W% d9 T1 }1 W& M
- 1 z/ {1 ~. g, u) ~& G( t
- #undef EDMA3_DEBUG7 j g- @ p9 }* w
- /*#define EDMA3_DEBUG*// V1 \* e) W) e% M
$ R4 p( h4 d4 W( L" G4 ]( j- #ifdef EDMA3_DEBUG
1 u0 x" `. H1 o! |1 V& P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' R& M: O8 x e Z% b& o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( p3 a; Q6 b2 d \ Z4 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), y1 V+ o: A Y4 |9 Z9 U
- #else
' H- z4 b6 E$ ]/ V2 [* m - #define DMA_PRINTK( x... )0 |: t6 J1 a+ d* |0 q" }% t
- #define DMA_FN_IN
2 D. r; n; ?' x! r( v8 a - #define DMA_FN_OUT$ y, A9 g) D0 O+ z: d v6 I' D' {2 b
- #endif; d8 P/ Q8 B: J2 y$ W0 N! J" Z
- ! M |+ s/ {' W9 E8 L8 ^8 y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& X: A1 Z l4 Z: u9 `
- #define STATIC_SHIFT 3* j) G/ p. |$ l V% X6 ]6 n+ G# J. |
- #define TCINTEN_SHIFT 20# U5 e+ U: @* I) ?/ K# q) N6 ^
- #define ITCINTEN_SHIFT 21
6 e# A% L0 |: Z% j. Q/ J - #define TCCHEN_SHIFT 223 n# T4 r0 o0 c( a5 I8 x
- #define ITCCHEN_SHIFT 23
5 g L Y9 _6 L& A! M
$ G5 g" p* s6 s- s) }8 g* K7 U8 h; W- static volatile int irqraised1 = 0;8 z4 p. }/ s, v7 V' B6 w0 f0 K3 j2 v+ b
- static volatile int irqraised2 = 0;
# v4 z: r$ f. ^9 c1 k# I3 c6 n p - * w R% G' D' a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 Y$ Q& f, B" }* B, a( n' H, ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. o$ R$ K: A* M% p! g) g+ m3 _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 G9 P0 q; P$ N6 a" P' Z - / h5 D: ^1 g( B v, J+ Y
- dma_addr_t dmaphyssrc1 = 0;7 e! |% [2 m6 U& j
- dma_addr_t dmaphyssrc2 = 0;/ v$ v, @9 y, J# y" ^% m
- dma_addr_t dmaphysdest1 = 0;3 ]3 T5 b7 P6 J2 z: \& D1 I
- dma_addr_t dmaphysdest2 = 0;9 ]3 F" b2 ]3 s
, ` F4 W0 k( V- E- char *dmabufsrc1 = NULL;
# m$ E: j: Z0 o - char *dmabufsrc2 = NULL;3 {1 G! W9 ?6 |2 P( h
- char *dmabufdest1 = NULL;6 S7 @; r, Y* L2 t/ S+ T
- char *dmabufdest2 = NULL;! A( m; c0 S9 e& [( U- I
- 6 V! B g: L" Z( D
- static int acnt = 512;& o6 \3 g+ C9 D$ r C
- static int bcnt = 8;4 x3 v, Z, ~4 n h
- static int ccnt = 8;
" I9 L4 t* g9 K$ w6 y - * v" o. R" B' a
- module_param(acnt, int, S_IRUGO);
: i6 M6 m, Z* h4 k5 m, D) T - module_param(bcnt, int, S_IRUGO);
2 X4 m% e2 H& L& t - module_param(ccnt, int, S_IRUGO);
复制代码 / P2 ]+ M, y& G5 L- L* e
8 G9 a/ h, {- m/ ]4 _+ o/ z) i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! h1 o. w9 L. F# m) \7 R8 |- `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 u# W5 C% F! H3 f; k4 ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% x5 ~: s+ m2 F# ?. h3 [. ~$ E; x7 _2 [6 j* |+ O, d
6 [1 P7 L& R( Y% h
|
|