|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 @3 s5 v& X+ ^) ]
- [code]EDMA sample test application4 g9 @& R' b4 w# b$ e/ r
- /*8 I C0 M6 v" ^( `9 b! ^
- * edma_test.c
3 p r/ [0 [4 Y) p - *
3 I( Z1 p" g! m) \2 F - * brief EDMA3 Test Application4 w, v: q( y# p" K- a4 X
- *) G9 |1 V- s! v+ z) A, o
- * This file contains EDMA3 Test code.
0 l5 Z$ J4 i" t7 [% p% s - *5 q9 i1 }; j. S8 T; M" X; d6 K! ~! \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 j R( b: R/ n8 l& s+ D! Q7 p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% C( G+ d4 Z* s; ~. \9 Y - * TO CHANGE.9 n& f* ^ [3 J* @6 s
- *
$ H& `$ I6 i' z3 M0 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ?* o( ~. {. ` n5 G |
- *6 c: w8 `. N! R, O2 G/ e7 n' Y) X
- * This program is free software; you can redistribute it and/or
6 A. W6 |/ D( p- G* x - * modify it under the terms of the GNU General Public License as
% c" p( ^- k. a" i - * published by the Free Software Foundation version 2.
- X ^, x. {# |, ` - *3 I1 \, u1 A l' b9 g5 z# v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) P! S* o1 Q$ h7 H - * kind, whether express or implied; without even the implied warranty6 _3 R8 h, a2 [ e: c, T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; f5 o+ K' ~4 S8 Y7 I8 L0 G
- * GNU General Public License for more details.
6 v) ]6 c: F( a0 X; X - */
9 \! g" j5 W/ T
' j7 F+ b/ a% q- #include <linux/module.h>
" x/ r" s- l2 c9 m& K- u - #include <linux/init.h>" `! @) u5 @7 j
- #include <linux/errno.h>! Q8 \' Y$ R; E- `* q& L# u6 E
- #include <linux/types.h>
" `/ t8 x' k6 N% o( h. y6 V* ~ - #include <linux/interrupt.h>
7 M5 K4 Z t+ t+ @$ B - #include <asm/io.h>
" g" @4 H- p3 h- f2 L$ P - #include <linux/moduleparam.h>
9 b3 u* g, }0 ~* j7 X" @; x - #include <linux/sysctl.h>2 {2 k0 w( H! F3 T7 Y/ } m
- #include <linux/mm.h>
, |6 ]/ I' z H4 a - #include <linux/dma-mapping.h>
! h9 |9 E0 D* V; g - 9 P- N5 A% n* @0 V3 I/ l- J
- #include <mach/memory.h>- S/ K- `/ G6 m. x: U
- #include <mach/hardware.h>
% _ m' R: b8 D5 A' D - #include <mach/irqs.h>
3 U. C: [9 ] E# Q - #include <asm/hardware/edma.h>
: I% L) D! y* P
5 |* f1 c% p( g: K3 w- #undef EDMA3_DEBUG& w( J6 @+ Z: b0 w5 Q
- /*#define EDMA3_DEBUG*/& V" h1 `9 M" g$ ?/ J+ W
& j* I; u; _ S9 M; [- #ifdef EDMA3_DEBUG8 e+ D; y ^+ w' q1 n9 s' S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ g& V X/ e( a3 y% B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 ^8 T: g$ B8 ?# ~. T7 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ E1 C; P3 D* k5 {" d* ` U - #else
6 R0 @/ K/ l; K0 W2 W - #define DMA_PRINTK( x... )( n# a: v: _3 M9 S! g
- #define DMA_FN_IN
! a5 q: u! H# _% J, y3 |; S - #define DMA_FN_OUT
6 j5 ~8 z) M5 R; ~ - #endif
3 A% G* `, T( r$ I, t# B9 R6 n2 D
; O) O3 @" ]# w: Z, `/ ?# w0 y# g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 H4 v0 X/ Q8 i/ G6 n
- #define STATIC_SHIFT 3
% B; @' U! _4 K) N1 k- ] - #define TCINTEN_SHIFT 20, H8 w0 F7 J9 W# v) y% |
- #define ITCINTEN_SHIFT 21( I+ Z9 P o! F$ _# u( R J* G. z5 c
- #define TCCHEN_SHIFT 224 R' G" ~: L0 L0 w ~6 b
- #define ITCCHEN_SHIFT 23
6 I. y# z; g/ f! T - 4 u' ^6 j9 \8 P# T K" I: P! n
- static volatile int irqraised1 = 0;
! u' \0 I" L8 \. ?5 W: a - static volatile int irqraised2 = 0;( E1 m9 d: r8 I$ p
4 E- f& G8 ?4 g0 C4 y) h& C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 x4 Z) B' T2 `/ t* | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" I, C# I- R! v7 g% J/ i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, J- B8 S+ L9 |3 v$ ^( ^( Y' p
4 t J+ Z1 M( P* [ D9 Z- dma_addr_t dmaphyssrc1 = 0;
6 J, J7 m) Q6 J" s! [9 C/ ] - dma_addr_t dmaphyssrc2 = 0;! R0 b+ V3 x6 t5 e! u1 V6 R
- dma_addr_t dmaphysdest1 = 0;
* D$ c3 J$ o3 ?3 U7 p2 g- J - dma_addr_t dmaphysdest2 = 0;* K- B; n* Z' R* P
- : c: v$ d" ~4 A; H
- char *dmabufsrc1 = NULL;
4 z& b- f8 N. G. ^' H/ Z8 u - char *dmabufsrc2 = NULL;
. J d; C7 W5 r5 {: q - char *dmabufdest1 = NULL;
3 I8 a; v2 C$ z$ R6 c - char *dmabufdest2 = NULL;$ F; H9 C1 F* I: S* N0 D8 b
; }) e8 {( I) h- |# D- static int acnt = 512;/ h8 y0 f& L& J
- static int bcnt = 8;
?* Y" }: P% w - static int ccnt = 8;
" s. c, _9 w1 o3 [* V - : F: q3 P P8 c+ y8 Q2 _
- module_param(acnt, int, S_IRUGO);% P; P8 |: f4 Z9 ^
- module_param(bcnt, int, S_IRUGO);
0 Z- ?6 f! w7 h: R7 s' R8 M2 E - module_param(ccnt, int, S_IRUGO);
复制代码
0 m2 Q/ Q! b- ]6 }& Q+ _ H2 f6 c, e- e! i( ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 a0 n4 l% E# V4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 f3 T7 @+ e7 Y7 ~* N2 R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' x% |* W0 j' y% q5 ]* z
9 i& c, @! c+ [+ G9 G
l& a6 \) h& y2 u! [' g+ T
|
|