|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( g( @" }4 O7 W# V! v5 i' R
- [code]EDMA sample test application
O' Q5 S; {0 {, I - /*; M1 n$ L3 o" {5 M
- * edma_test.c/ W0 x# c8 V3 ~3 ?; P b' b! i- p" _& n$ I
- *
* D/ P% l5 s4 k- a7 l. A) ? - * brief EDMA3 Test Application$ B, e `7 |# j7 ]; f* s7 J! j
- *
! ~, u# E6 \7 \! [$ F7 p$ \ - * This file contains EDMA3 Test code.
1 k- l5 |, l! h- E: [; ` - *
$ K' u" m/ Z. U( `/ f; K+ a* J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" o% F( H+ o1 e4 B Y' d& G D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 Q: W/ N$ }8 a8 `: p' W5 I - * TO CHANGE.
F" g) d9 W. A: ? - *9 d, d$ Z" L8 {9 [$ Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ S# r+ o: i( S. y; z - *! y! x$ _5 @0 x2 ~' F
- * This program is free software; you can redistribute it and/or
# X6 n! q& ]8 U% ~. I3 b - * modify it under the terms of the GNU General Public License as
1 c9 m0 G* y- A0 f- T1 |. S( c* q - * published by the Free Software Foundation version 2.% v P- U" P' E
- *+ D2 m" J+ _) a% D, Q, Z x. x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any v3 `1 Q1 K+ i4 Y! s, ?
- * kind, whether express or implied; without even the implied warranty0 R$ c' u6 ]) o( b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) V ^8 Z/ T/ ^ - * GNU General Public License for more details.
4 [2 x' Y2 s3 \. Y- \1 ~ - */
. o- `# i, V; o: P - / p! D4 q( ]1 R: h
- #include <linux/module.h>
# }/ x% Q W: F2 f. m, z) ~ - #include <linux/init.h>3 A3 G8 w+ E r* M% ]
- #include <linux/errno.h>
9 ^, t1 D! o2 \/ i3 H" j0 V* ] - #include <linux/types.h>
$ N/ f3 A( q! u& Z. K - #include <linux/interrupt.h>7 M8 _( x5 h7 Z2 H
- #include <asm/io.h>
A# A$ Z) [" ~) S% h - #include <linux/moduleparam.h>
$ I4 @: o, L: p8 @- N - #include <linux/sysctl.h>
# k+ H7 E2 |& k - #include <linux/mm.h>* u! m4 \/ S# M8 v
- #include <linux/dma-mapping.h>
& E% C- U! W( x' O, u1 b - 9 C! i' H- r' `" I+ j2 a& |
- #include <mach/memory.h>
* U# `7 Z6 i( ~. k) t: T - #include <mach/hardware.h>
1 y# ~$ [2 x+ C, `$ N - #include <mach/irqs.h>/ W$ e' ?& p4 F1 a6 Y8 }! g
- #include <asm/hardware/edma.h>' J# p. a7 Z4 U% K0 Q
- ' z4 \) u- J, `3 k+ \
- #undef EDMA3_DEBUG1 j( p6 J# Y' m- o/ y9 {
- /*#define EDMA3_DEBUG*/
& Z, ^) }. j2 `$ }, @
2 L( R: T: {) A/ v+ S- C! j- #ifdef EDMA3_DEBUG5 x: p$ A! J# `! q0 y, C7 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 u2 F% @6 m6 _. c$ W8 f; Q' p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 m) M8 _. D4 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 H, z4 t! L q - #else
+ R7 I4 b+ R( H* O - #define DMA_PRINTK( x... )
" e2 W5 ?) E1 n0 b6 X/ U - #define DMA_FN_IN- r R1 S: Z \& R# |0 ]) s9 g
- #define DMA_FN_OUT# e- W, {2 f# D# T$ k$ q9 c# E
- #endif; O9 B P! V' Q3 ]. _7 r+ x& B u) x
- , h1 r+ p2 U0 ]; G7 ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 o3 x9 \1 [# K5 j1 f% ~% J - #define STATIC_SHIFT 3# [5 u1 O. U$ D6 c
- #define TCINTEN_SHIFT 20
6 v9 U/ l' K' _6 W- g$ R5 {9 f8 r - #define ITCINTEN_SHIFT 213 s+ l; M$ Z9 W- `
- #define TCCHEN_SHIFT 22
6 q- d6 l v3 W& U3 o, E# g. f - #define ITCCHEN_SHIFT 23( b4 a1 @' T8 `! {) p, H
- / V2 a8 k. O* E0 ]+ i0 j* L& n0 y
- static volatile int irqraised1 = 0;2 \8 T0 c: V+ m* c
- static volatile int irqraised2 = 0;- s; f ]) @. c Z6 E( z9 ~
2 `: F% [$ T+ r1 I% R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 k" Y" D! c! `7 j% y$ W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ S0 g. z/ F# f8 U, H5 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) n' c0 w- r: r3 j1 m! _
8 |2 w* M8 C! s) z- dma_addr_t dmaphyssrc1 = 0;
+ g9 F' O0 I" `9 M& x* v - dma_addr_t dmaphyssrc2 = 0;
5 t' S$ i% k7 z a - dma_addr_t dmaphysdest1 = 0;! R( n- B" Q/ ^# J) G0 C4 M
- dma_addr_t dmaphysdest2 = 0;# S" e* E2 k1 h+ o
" ]: P) U. G& p& Q; h9 l- char *dmabufsrc1 = NULL;
8 M" I; ~" n3 M) \ - char *dmabufsrc2 = NULL;9 s) |/ g; {. D6 b
- char *dmabufdest1 = NULL;
; N, S. z( h/ P+ | - char *dmabufdest2 = NULL;+ n {. i7 q* t* i7 H
- 7 f/ T4 ]; f6 C2 o: B, ?* J
- static int acnt = 512;
* v/ R( }# t, ^) M - static int bcnt = 8;
. i6 \9 y( [. d* r2 ?% n7 P5 L - static int ccnt = 8;" u# Y& m5 r m; g# M4 o( f
- , Y6 q9 [5 z9 ~
- module_param(acnt, int, S_IRUGO);% A1 [% E. I7 o1 \* v+ [0 V
- module_param(bcnt, int, S_IRUGO);
+ Y' H5 D: F0 B6 v2 u2 T - module_param(ccnt, int, S_IRUGO);
复制代码 ; Z5 ]. ?. n# E9 g' N
3 y3 |( z" \8 Y$ K% R5 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 ~- o9 e1 ]. } [2 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 r7 ^0 u# Z5 ^+ i% f# k/ K/ n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 j* {. p$ t; {% k/ ]; x3 b0 G/ `6 ], z) `/ W% N/ O
/ y) p* b$ x2 H9 g% b; Z) n
|
|