|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# P1 a$ u( O' v' e/ m! S- [code]EDMA sample test application d) K( H" y. M
- /*3 C' S0 h4 N: |5 V( U
- * edma_test.c
/ m: T$ P$ O7 F' R3 r: s - *
( _' Z$ ~3 y8 y9 I! L" ?* b( ? - * brief EDMA3 Test Application
w1 H; T1 M# I - * @! n, |& \) e# r$ _; K; L
- * This file contains EDMA3 Test code.
/ s* [; f% S5 z9 }. z9 L; N4 C - *
4 A4 S& T* A$ G& a0 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ]2 [& [9 o9 u3 `! E$ u0 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 W- @* z C; F) C
- * TO CHANGE.( ~% P2 t6 E; E0 M3 }; ~# t/ \
- *
. t3 g& E3 G2 d& j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! a: T8 z/ r. n U$ B/ b$ d
- *$ |5 N0 k3 n$ q! j0 v* X
- * This program is free software; you can redistribute it and/or5 |5 J8 ], }( v2 h3 U, d, p
- * modify it under the terms of the GNU General Public License as3 v6 t! Y) U( h8 P- h* m0 u5 ?7 C
- * published by the Free Software Foundation version 2.
6 H" o* Z& c9 o/ Q, \ - *2 _2 Q5 b. r9 r4 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
x( O) b @4 W/ v+ V) ^ - * kind, whether express or implied; without even the implied warranty! r$ W9 w8 B) {) F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 m2 o6 V L& t8 O& V - * GNU General Public License for more details.2 ?. g5 G9 g9 c9 H. g, }1 z
- */: r. ^) y D8 f( a& R, i1 `- w
0 _% B1 _7 u7 @# j; l- #include <linux/module.h>8 m8 K' m! P4 Y6 s
- #include <linux/init.h>
+ A, G( n/ Q0 _: ] B - #include <linux/errno.h>
7 k5 d; C6 ~- r5 q5 j; W& ?! s0 K - #include <linux/types.h>
* o( ?! {0 Z6 w - #include <linux/interrupt.h>
0 U- K8 g* |4 d6 M - #include <asm/io.h>
' _1 r; c2 T. f( t - #include <linux/moduleparam.h>
# `. p* i0 g- N! `, U8 v) J - #include <linux/sysctl.h>9 [% o. w5 C6 A' o* h
- #include <linux/mm.h>+ F( Q; F& {( K* p( t7 C- Y0 q
- #include <linux/dma-mapping.h>
5 y9 s! ^; P, d2 T* m6 `
+ ~3 b0 s$ R* ]6 g G/ e4 _; I- #include <mach/memory.h>
3 D3 }- H* V6 @6 H - #include <mach/hardware.h>
' s6 e" ]% e6 z+ `: j - #include <mach/irqs.h>
9 u5 J1 s$ i6 a# B! H) m3 _4 P - #include <asm/hardware/edma.h>
9 e! z* `4 C7 z+ K0 I, y9 n$ ]( j - 2 v ^$ {2 d4 u! ~% [
- #undef EDMA3_DEBUG
* t; r0 h; |1 M3 [; ^+ h - /*#define EDMA3_DEBUG*/2 {( R$ C; P( O: r
- ( Q! G4 E6 A9 a
- #ifdef EDMA3_DEBUG
' u* Q# v# J, m y R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 |6 P6 C% n8 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 {3 O8 G+ q/ v* O' H$ q9 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; w' x2 _( g0 h; f - #else6 I! F7 i3 ~4 [% D8 j
- #define DMA_PRINTK( x... )
1 N+ K1 o! W4 g - #define DMA_FN_IN
& v' K) Q: r3 z& J+ [! B7 P - #define DMA_FN_OUT
' v; s& t; E" e5 ? - #endif
$ j- c. ^; s! t# l- `3 @
3 ?4 N. D0 i& v1 e9 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# e1 z& u1 X, _# \; D6 u
- #define STATIC_SHIFT 3
: C. Z7 o3 ^- p5 w$ s' c - #define TCINTEN_SHIFT 20
' C I/ H3 N3 I$ L7 C6 q6 { - #define ITCINTEN_SHIFT 21
+ m; K: E6 [% ^& x' a" Y& B' p - #define TCCHEN_SHIFT 227 m+ t: b l( ?2 n
- #define ITCCHEN_SHIFT 235 c e0 @7 ]0 }) n1 ?, @
- 3 _3 R; L/ F" n \* C7 q$ D
- static volatile int irqraised1 = 0;
! h) ~2 R: a: D" M - static volatile int irqraised2 = 0;( Q R. g( Y& f: A) l! \$ `, T* L
- * P+ J6 Y5 }4 ]) @9 E5 o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ i$ Z# Y J2 B6 F) N1 f# U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) N8 s9 W% ]* K/ o5 d2 `) h7 I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 K! m2 u) b4 e6 s3 w7 {
- 3 d/ u$ a, \5 n( Z
- dma_addr_t dmaphyssrc1 = 0;9 o" t5 d; P, T$ v! x5 L- h6 p4 p
- dma_addr_t dmaphyssrc2 = 0;- o, Q# a k9 N& o& {
- dma_addr_t dmaphysdest1 = 0; i, x S3 E/ ~! C. C
- dma_addr_t dmaphysdest2 = 0;' @: P7 Q" y2 w
# w' D3 p$ ^* p- char *dmabufsrc1 = NULL;6 r v* a) X3 Q, A# f& Y7 A
- char *dmabufsrc2 = NULL;( k: J" W" U& u" J3 ^ k' [
- char *dmabufdest1 = NULL;
9 `4 e, ~3 z" Z, n3 v8 [ - char *dmabufdest2 = NULL;
0 D3 J$ i8 p5 O, B - 5 D/ ~& D% b7 L$ F
- static int acnt = 512;* X1 r( |0 f* {7 g! D# ^# Y" ~+ w
- static int bcnt = 8;, E' R7 D6 ^1 ^
- static int ccnt = 8;: P! K1 e# h6 g. |% }! L
4 m9 K9 k+ m. Z4 n I- module_param(acnt, int, S_IRUGO);
6 v; W7 f# }. S$ q8 D* H" e n - module_param(bcnt, int, S_IRUGO);6 j. Z0 p! g$ q t9 }) e6 p
- module_param(ccnt, int, S_IRUGO);
复制代码
" B0 U, o- M% M3 P+ c1 J! Z* R% q) b% E! C2 z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- G2 A7 f% s' D/ l. C; Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 E: b+ L: K" _/ k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 R. D3 |+ E! s
4 [% H) k( x% V8 Z: ]/ ^) r8 {) s6 C; c" z* C, w$ |- ]; l
|
|