|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 E7 A# R7 t2 X- J/ h' d- [code]EDMA sample test application( A1 @0 `. H, ?) g! r# X" N x* D
- /*
! E! {1 ?# ~* m7 D+ \ - * edma_test.c: F7 M$ x2 j+ T& q
- *& N9 u" f. r0 {3 J
- * brief EDMA3 Test Application
1 B K& q0 }- n' Z. ?5 u) o( X: X: z6 X - *+ w! ^. O! b0 E U+ z
- * This file contains EDMA3 Test code.
: G' W% J# D9 w: C: t, B - *4 r' m- L6 ^& p8 x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: y' B' A! I6 f% H# U+ y1 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ I5 u2 b- D0 Q. a
- * TO CHANGE.! Q4 d7 r! |$ y& v, t- |$ \
- *
1 q4 M+ n# ^ K7 C3 {- m, Z' ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ C' r! ^0 \* v; X, t
- *. v0 T+ g: I+ ?8 T& q6 C& e
- * This program is free software; you can redistribute it and/or
3 q* l4 }/ o. x - * modify it under the terms of the GNU General Public License as! y3 Y M+ M/ m* Q; }6 e
- * published by the Free Software Foundation version 2.
1 M& H3 z r$ e! D - *
Q" s! m( `! m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 c0 f& n, v! F
- * kind, whether express or implied; without even the implied warranty
% `% f( m7 V2 B( C6 w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, |" J/ X7 l1 X7 I: c1 X
- * GNU General Public License for more details.$ ~2 H) o/ I5 I, g: u# J! |6 F
- */
* b% Z9 }" l% j- s* ?1 ^: P - * i8 J. f$ Z( l2 C; V- |, l
- #include <linux/module.h>+ u* R. o6 x: }0 F2 Z, m3 j, w
- #include <linux/init.h>6 c1 G4 z b2 Q: n4 P
- #include <linux/errno.h>. l2 o$ m3 _* {5 _
- #include <linux/types.h>9 G2 c' m/ P- x$ ^/ E
- #include <linux/interrupt.h>" f3 k. E3 u6 U F; P- y
- #include <asm/io.h>
0 @" h, ]) L% v2 ^. _7 M) \ - #include <linux/moduleparam.h>! J; ^% K1 a4 |* n9 r
- #include <linux/sysctl.h> T4 W# S, g- s8 n& o
- #include <linux/mm.h>: _* y" k! Y1 o* m
- #include <linux/dma-mapping.h>$ k/ U. g$ K4 F a9 W# h
- % h1 a% n5 E9 z3 y+ E) I
- #include <mach/memory.h>3 c% D) g1 e5 ?; a% c; q) n% q
- #include <mach/hardware.h>. T# y" y" V( N5 I+ l p
- #include <mach/irqs.h>
3 ^, m+ I g% b& b& ^2 X - #include <asm/hardware/edma.h>$ c! b& t6 d3 H' h0 N
a0 ^1 g) Y8 Y4 ]( p9 j1 {! ?- #undef EDMA3_DEBUG
+ y C4 a6 m- v! _* w - /*#define EDMA3_DEBUG*// v' F7 X0 |0 p: Y4 p+ C
2 r+ w4 B& p3 x* @0 ?1 K- #ifdef EDMA3_DEBUG
5 {/ e4 g0 {( P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- K' y3 P$ _6 X( Z6 T# W2 r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 X, [; B6 X+ U7 ?0 Q* O' i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& J- `, n8 w& g$ ? - #else
( O* I" m( u9 r/ h8 o! F# \. U& w: S - #define DMA_PRINTK( x... )
2 r! f$ f# ]* j3 f4 } - #define DMA_FN_IN( ~0 p3 X K3 r, e" w: H2 X% [* H
- #define DMA_FN_OUT
0 O3 ^! Z0 `: { - #endif5 }( x2 {; D2 ?! ]/ z& G6 K
- # b! s/ A1 [8 ~: P7 j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 E: a$ j7 m2 N7 m+ t
- #define STATIC_SHIFT 3) g+ O) W" E4 t& |0 v
- #define TCINTEN_SHIFT 203 p1 h! S! h5 {$ r* y
- #define ITCINTEN_SHIFT 21# {4 g, E7 X, [6 F9 \9 T
- #define TCCHEN_SHIFT 22
3 ~4 n8 P0 S/ z$ m: d; B# J' Z - #define ITCCHEN_SHIFT 23
+ s+ A$ X3 {9 j5 D& l4 n
- f- T) ?% a$ l3 R& [- static volatile int irqraised1 = 0;
' t/ s! j5 m+ t8 o/ p; L1 v - static volatile int irqraised2 = 0;
$ D5 L& }7 C, V, y v
: ]& `- p7 Y( `, r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 b% r& `, g- x+ _, ?! F( n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 k5 ]0 T% l* w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z( z. X9 I3 y( S- e
- " `5 b* u7 _% T, @& L/ O
- dma_addr_t dmaphyssrc1 = 0;- ?8 V; p2 n: Z, B, B) X3 |) o+ a& O9 D
- dma_addr_t dmaphyssrc2 = 0;
& F- H, C# I; O2 q - dma_addr_t dmaphysdest1 = 0;
) v y# W7 ?2 h3 {' w* e - dma_addr_t dmaphysdest2 = 0;
6 f9 Y1 V7 C! d: w2 @ - % p* _; g! \+ j0 ?5 v( p) R
- char *dmabufsrc1 = NULL;" `" P! k, _; c; t* J$ J
- char *dmabufsrc2 = NULL;
7 j5 L* r6 P5 C5 x6 q - char *dmabufdest1 = NULL;% V" D5 q9 g) S! |, O
- char *dmabufdest2 = NULL;
. z, O% u6 E$ O$ T
3 c/ m- Z- `& l0 J" U* K6 G- static int acnt = 512;
# v5 G4 L7 }: | _& | - static int bcnt = 8;
7 `; [7 C8 |' o, q6 u! K/ J - static int ccnt = 8;
+ @% m7 ^5 l/ D0 k8 k/ o" ? - $ R0 \3 e8 R: R7 p) |% X8 Z3 e) X
- module_param(acnt, int, S_IRUGO);
1 {( j) A6 s0 y1 X9 Q4 C6 ` N- A' P6 _ - module_param(bcnt, int, S_IRUGO);
: i: I, m* C/ t: Q( ]* s4 T - module_param(ccnt, int, S_IRUGO);
复制代码
# ?7 ~+ j. p0 S/ U% f5 [4 f G3 g7 |" t* ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 k# M" {; \( N$ m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 r2 N: f0 @8 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" K! L% S; q. g( I) Y2 j7 M
, w6 i! D4 n* S+ n
6 v+ S! x" ]. \4 B* l |
|