|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! z0 g+ x6 m& f
- [code]EDMA sample test application% S& K0 x: u1 O% L' R
- /*
* R; B4 Q1 z$ @0 H - * edma_test.c! J* u$ N( S" U1 P6 d
- *4 G7 h. z5 f# W( g9 G- U
- * brief EDMA3 Test Application; s1 X. u* \, C/ d+ _
- *9 H0 v6 r+ }& `/ A, H
- * This file contains EDMA3 Test code.1 U$ A/ g6 _2 F$ d: ~( `* ~. E; v( i
- *8 l) G* t G2 z" N. c! n# B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; c$ P* V: @6 [/ z) P/ _7 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: o, Z$ h& h* D; n& i9 G - * TO CHANGE.! w% t2 J7 C0 o( B
- *
9 ]3 O" c6 o2 S0 E6 s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 A/ F" ]0 l" d1 U" `% P$ ]+ A - *
' O0 S8 h: I" L5 R8 w3 b/ e - * This program is free software; you can redistribute it and/or
Q' ~; E" M, e+ u - * modify it under the terms of the GNU General Public License as
) S d0 x6 Q; w( C - * published by the Free Software Foundation version 2.
* j/ U6 V0 U1 a6 k+ j. `' g! s - *
2 o# B* o7 F3 e& ~$ \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 S8 x" w: G9 n& N: \* ] - * kind, whether express or implied; without even the implied warranty
1 \, v: u' H* J; K) E: `! R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( W6 `6 t- h9 x# N0 K7 L
- * GNU General Public License for more details.9 Z+ K V( r1 L1 z- v1 @2 @" J
- */- v$ U" ?3 o' E1 s4 r
- 9 q8 T5 `; B, ^7 U/ G
- #include <linux/module.h>, d5 F4 |' W) S$ b
- #include <linux/init.h>+ I& B2 x$ n4 [+ k% b+ D
- #include <linux/errno.h>" @9 [+ [0 _+ q, ~/ f' v% A
- #include <linux/types.h>7 V# g: u# w) Z) U4 b2 |7 c! ~: K
- #include <linux/interrupt.h>! I4 B7 Q5 G {
- #include <asm/io.h>
c% t- }/ m# [6 y - #include <linux/moduleparam.h>
6 N$ G* F2 k( u - #include <linux/sysctl.h>
: i& r! L2 W, c - #include <linux/mm.h>& p) W0 g4 {7 R5 B7 P8 v6 ~
- #include <linux/dma-mapping.h># u' H6 ~( ^ W
6 i9 c; c ]' }/ a$ A+ f( G1 K z- o7 P- #include <mach/memory.h>
) Y" B+ B7 O3 M5 O! ?; R) h - #include <mach/hardware.h>; L' {4 W# W( ^9 W: i3 G& h
- #include <mach/irqs.h>1 o6 Y6 z' j. T/ Y, G' G; R% ]
- #include <asm/hardware/edma.h>
& C7 \, R; z2 h5 j/ `" H& v - ' l1 W$ x( {2 |1 u6 ~! \
- #undef EDMA3_DEBUG3 G* Z' d" m& O
- /*#define EDMA3_DEBUG*/* b) n( C- i) ^! ?" E, J) F
W$ L2 ?2 g# H' d- #ifdef EDMA3_DEBUG5 F* Y% \# O9 T$ H4 T% S3 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ]2 [9 @3 B9 K. F h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 e7 I9 d; Z5 i: e8 \* ~0 }/ d6 o r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 H0 ?( l5 G" o, O+ L
- #else
$ c) R- ]% W% P" p% z2 f1 m - #define DMA_PRINTK( x... )
! p7 Z2 b9 }, v w: f - #define DMA_FN_IN
% T/ X7 G4 S) L. {4 r - #define DMA_FN_OUT+ _ D- U( j0 Z9 `
- #endif
6 T/ o2 o- a" Z7 g$ M& ^
4 t) y: _5 O- H& b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% c$ T, a% ]. d* g M
- #define STATIC_SHIFT 3* A3 Z, J1 _9 y& c b
- #define TCINTEN_SHIFT 20
1 K9 y' d' l) U% j+ B8 w* {) Q - #define ITCINTEN_SHIFT 21: D6 {' i0 V" N+ ]% b/ t2 V
- #define TCCHEN_SHIFT 22
7 t. W- o% K5 e% q+ m4 d3 g - #define ITCCHEN_SHIFT 23
/ q: s/ Q. z8 j6 w5 Q - # L$ Q- \, j5 {0 V/ A* s) C3 R1 D
- static volatile int irqraised1 = 0;3 G" o% o! j: q2 r# ?
- static volatile int irqraised2 = 0;/ U7 i$ r. U1 t5 g7 D! j' D
( d; g0 c; E2 U" Q9 k; d3 @' A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ?- E/ b! P- _+ e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( W2 ]# d7 |5 S2 m. [6 P" q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 V4 b+ H, O$ T8 n: x - / |! t! A! ]3 m: g7 o# Z
- dma_addr_t dmaphyssrc1 = 0;
% l* i" l2 }+ ~3 O) l" `, w - dma_addr_t dmaphyssrc2 = 0;
! F; E' r" i4 R4 H$ ^+ | - dma_addr_t dmaphysdest1 = 0;
! D4 }% }# [/ q% l' F - dma_addr_t dmaphysdest2 = 0;
$ A9 N% w0 y( o5 y' g+ y2 d- x
& Q. U$ h* n. l& J8 [9 X- char *dmabufsrc1 = NULL;$ V* Q+ o0 h# W! x' R' p
- char *dmabufsrc2 = NULL;# P1 f$ p O$ V! i1 Z0 O
- char *dmabufdest1 = NULL;! u4 w+ J3 Q: }2 D% b
- char *dmabufdest2 = NULL;( t6 u5 b; O7 B: E: T
- ! ?6 U6 e4 H8 w
- static int acnt = 512;
: _8 u1 H8 z( m- C - static int bcnt = 8;
' u2 y" C* U$ q1 T( ?( I - static int ccnt = 8;
6 m, Y- o3 Y2 d0 { u. I
0 H T( W9 K+ r- module_param(acnt, int, S_IRUGO);) {5 D7 \5 p5 V7 z7 X
- module_param(bcnt, int, S_IRUGO);
5 S; f! M% o4 q j - module_param(ccnt, int, S_IRUGO);
复制代码 * ^7 z) A4 S+ ~9 j0 `) ]
! r! L Y# ]& X4 P: u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ?3 M8 G7 ^$ B Q# k+ E; C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- b, `1 \ o; D1 K# h/ J6 N1 u. _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ E& W2 S- e( o6 \; Y, K
X' I- \$ e: _/ H
: o3 [- j+ Q3 J
|
|