|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , [" Z7 p6 X; m# |; ]8 n
- [code]EDMA sample test application# r x! K3 L% g
- /* W! x# f2 J0 x$ J5 {7 n4 d& a
- * edma_test.c
" e/ g) b+ k2 a - *3 J! c2 |7 f. r8 D6 y
- * brief EDMA3 Test Application4 {4 p! `7 K2 Y8 b
- *
; E+ p: S. z0 p - * This file contains EDMA3 Test code.
. _: M8 w+ Z: U3 [) r' |3 a - *
# k. R s# {4 I5 \% ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ o' ?& x* Q# N( I. m/ U7 X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# R9 s7 N( ~! [/ I. S
- * TO CHANGE.
5 t: M6 ]/ E; J, M" y. f* y1 _ - *+ U. p9 W$ b5 `+ u0 `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 X/ N3 g* X! h# R3 h; m - *
6 y4 [ N% s4 \+ C9 S - * This program is free software; you can redistribute it and/or; n. a; ]4 ^9 U, \ I. Z
- * modify it under the terms of the GNU General Public License as
6 h4 g, |3 I Z - * published by the Free Software Foundation version 2.1 ^8 D! W7 U' j& ^6 U# S8 e3 H6 p
- *
9 e' i( w7 j( X$ K% a5 T# y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! e/ \! q% H- L' G. p' \
- * kind, whether express or implied; without even the implied warranty3 Q" y, a: S$ ~* f: a4 T# Q9 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# |) p4 W- Q, [* V3 {$ L0 A/ V! y - * GNU General Public License for more details.
$ ?. V5 v. z+ L$ r! D - */9 E6 G* ~2 S: }: u
- % i) ~0 Q. ?- r
- #include <linux/module.h>
) X9 k+ Z, ?$ ~: ^ - #include <linux/init.h>
$ W- K6 z" }: F4 s8 |0 G2 \4 B - #include <linux/errno.h>
0 P$ t( j4 @" V8 P5 X) D# N - #include <linux/types.h>
& y. \; k% F @" i9 L1 ^: K - #include <linux/interrupt.h>- [& j0 o+ C0 m7 l d
- #include <asm/io.h>7 A* n5 \( S& h+ U
- #include <linux/moduleparam.h>0 H% r' _. Y0 F7 l4 S, }0 P: \
- #include <linux/sysctl.h>
8 e2 z$ ^9 l) y% | u - #include <linux/mm.h>9 a' S6 i( |1 E
- #include <linux/dma-mapping.h>; h% P2 {0 O$ ^9 [
3 v8 F+ @/ {4 T- Z d5 Y- #include <mach/memory.h>* d- G# d+ @' R7 B5 k k
- #include <mach/hardware.h>/ E& w, r |$ @ R: T
- #include <mach/irqs.h>
* q- o; _4 O$ X/ H/ x - #include <asm/hardware/edma.h>
6 Q- f2 ~# O0 u4 T( C
4 q' |% ~2 J. b4 z- #undef EDMA3_DEBUG
& E I+ d% r! b - /*#define EDMA3_DEBUG*/
2 L2 d b1 s1 Q$ q - - e+ V8 ^2 k( N8 o% r9 H6 T
- #ifdef EDMA3_DEBUG
. F- [2 n0 Y0 [+ z- W" e4 ?% X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# j, o: ^5 F+ R! I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 B V. r V3 h" u- M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" [; N0 |" D8 S* l- z/ `+ Y
- #else& Y4 V( \4 g5 L+ n
- #define DMA_PRINTK( x... )! W5 M9 ?- k7 I5 M B8 ]* Y; o
- #define DMA_FN_IN
9 d- ?" a6 w; M x! U' ?$ J& J$ O. B - #define DMA_FN_OUT3 c) |2 f0 J- F, s9 W6 q
- #endif; C9 X9 k+ r! O9 L! ]8 x
/ v1 l) [) y! D+ H5 A0 T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 d8 ?7 \% ]4 E9 i8 C5 I' N
- #define STATIC_SHIFT 3, e) N) e! ?7 o5 J; t' E
- #define TCINTEN_SHIFT 20
W/ [& Q9 P2 O) r* q; N! z# M - #define ITCINTEN_SHIFT 21
# P! z" n$ t ]* }- f( \1 k1 A - #define TCCHEN_SHIFT 22+ D, j5 ?. Z; c4 s5 b1 x8 x0 N
- #define ITCCHEN_SHIFT 23
) s, L/ N8 e( L9 V6 `+ Z* n5 R - % y) h' \2 R( f
- static volatile int irqraised1 = 0;* f+ P0 ?' _8 r, S) f8 ]5 e8 S& J- M: o
- static volatile int irqraised2 = 0;) F, [0 \6 X! H- t7 T( v% Q
~5 M( ]9 u: m" P# ~4 \5 i: c, O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 I! |4 t5 R, P. j. g( a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& e1 E0 x0 \1 @* C2 j% g* O; J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( O, {' d; \! w6 C" ?6 I1 a
m! t. B: j' ^1 o; O- dma_addr_t dmaphyssrc1 = 0;: o/ j5 j7 t% r$ L$ v8 l6 m: X
- dma_addr_t dmaphyssrc2 = 0;
: u2 B2 U* J! b - dma_addr_t dmaphysdest1 = 0;1 J9 V/ ?, @2 s* E! N) @
- dma_addr_t dmaphysdest2 = 0;9 |9 D6 C6 Y5 M* \# {
- * Q1 F8 Y' z# }
- char *dmabufsrc1 = NULL;5 ]4 d8 M0 J; A) [6 Z) m
- char *dmabufsrc2 = NULL;) g* o$ u7 a' i: ^
- char *dmabufdest1 = NULL;
2 _- `7 `, G8 T5 S - char *dmabufdest2 = NULL;" s. ]: B/ t* n1 `: n1 h0 w
- 3 K: q' k' a0 y' D
- static int acnt = 512;* J" v. ~/ x4 _9 G. Y, N
- static int bcnt = 8;
+ C5 e; M6 k* t1 G' k& U- V - static int ccnt = 8;5 {& @! I4 v7 }5 z1 ]
- ' b7 g( l, z/ _! Y& |) u
- module_param(acnt, int, S_IRUGO);
- F$ I8 w4 _# W4 F: s - module_param(bcnt, int, S_IRUGO);
( P. @/ l9 x: }( H - module_param(ccnt, int, S_IRUGO);
复制代码 % u( g1 }) x( [1 Q, x- m
4 ]; D* M- k8 [8 Y; r) D% q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) p3 a% j" f7 V7 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& Z' E" U9 u+ b7 M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; i U5 i8 r+ {% M j5 U, y) g
, R) A6 t# M" v" n
) {; ?' |3 S9 l+ a& G; Z |
|