|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. [# T7 L" |+ j( c5 q, j+ i- z- [code]EDMA sample test application& D, t* O* A D" p# r% s
- /*& _2 h6 t4 o, V$ b1 k# s
- * edma_test.c- L: Y3 a- z/ o8 U1 U
- *) \7 j* e; ?% z4 C
- * brief EDMA3 Test Application
/ y( W4 ]2 [: V V! Z - * f" j9 ?1 y* c* q% x2 [
- * This file contains EDMA3 Test code.- ]+ E# H3 V% F# {, n i4 y7 z6 v! L y" \
- *
# F6 m' X; [: F0 n1 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( Y: b$ \/ \4 G5 D" S6 k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' l5 Z: ]" ?$ ^6 \0 S) ^
- * TO CHANGE.
Z/ }8 z5 L' q. r% |8 ?; T$ W2 ? - *4 r: Q$ D8 u# B X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 A6 V! `4 V# o% S/ c0 Z4 a
- *
, D7 B1 o1 S* @8 p - * This program is free software; you can redistribute it and/or
5 `/ ?: m6 I0 L5 p% G5 t2 j - * modify it under the terms of the GNU General Public License as
L2 ~0 R9 ^( C5 A - * published by the Free Software Foundation version 2.# j4 r" A! s) E& D
- *
5 J; g& E E# D8 U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& f5 V) y( e7 w# ` - * kind, whether express or implied; without even the implied warranty
, h! d5 Y; v" m3 f. t* [) K; W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 x) a. h% S% {' ] - * GNU General Public License for more details. c+ N9 D! [2 A3 r0 L$ x) ]- O
- */( e9 ]7 q& z: ~3 }9 M9 I! a
- " u0 r. P! u% C/ S% t
- #include <linux/module.h>6 B0 {% S5 e2 f1 Q9 S
- #include <linux/init.h>6 B5 A& a9 u# c# `
- #include <linux/errno.h>
1 s2 r+ T& k$ J/ ^8 M - #include <linux/types.h>
& `" F: N9 b. t6 ^ - #include <linux/interrupt.h>
( e P) B$ T! c4 ^0 ^7 ^ - #include <asm/io.h>+ Z# i$ E: C+ R' i3 J7 l; X. U, c3 ~
- #include <linux/moduleparam.h>( O0 `8 O7 h8 S7 t
- #include <linux/sysctl.h>! v/ i& L1 k- Z \" h5 ~9 u
- #include <linux/mm.h>. t" D. x4 @' `$ t3 X! ^
- #include <linux/dma-mapping.h>
- s L, v+ \# v
; J1 Q, n& l8 ^8 \6 L- #include <mach/memory.h># E( n' c) x; H
- #include <mach/hardware.h>
# X u- l, q* i - #include <mach/irqs.h>! X2 X! L" w. v) o- Q
- #include <asm/hardware/edma.h>, ~# x1 i; i* B; a1 q! E" ^3 d
- 8 v& T6 A; Y1 a( ~
- #undef EDMA3_DEBUG
" V8 z& t5 }/ G% B0 W s0 _6 x - /*#define EDMA3_DEBUG*/
! b, J+ \# G: e
, M" a) b* ^. d* M. k( }/ U9 H- #ifdef EDMA3_DEBUG
$ h3 T$ [2 x! f! G7 [$ Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 F: w& n8 U) t5 k- n' g$ w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" M$ C* u% i1 X, X8 B" P) [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, k) {0 n5 }/ g- C6 D - #else' J! E9 s( p& m
- #define DMA_PRINTK( x... )
/ |: W% C, d( l! I" M - #define DMA_FN_IN
; h; j( ~1 @3 o1 X - #define DMA_FN_OUT6 G# Z4 q; N6 R' w+ K0 @1 y' a
- #endif, |% y2 d% u: Q; u# ^) ^3 F+ U @) C
- 5 q* x: j4 {2 j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); q! K& H+ j* u% f2 R5 Y3 C+ G+ Y* }
- #define STATIC_SHIFT 3# h, q- F" Z8 K* T( X: J( B: H
- #define TCINTEN_SHIFT 20" t. E1 E! ?- N' h4 n
- #define ITCINTEN_SHIFT 21! c2 x! V& I+ D) O( v- d, x
- #define TCCHEN_SHIFT 22
2 i) w* a6 c' K4 M2 H - #define ITCCHEN_SHIFT 23) b! o# O3 m' U' U
- " K' X! ]# J% V1 V
- static volatile int irqraised1 = 0;) q% l$ W( ^* s! e' ]
- static volatile int irqraised2 = 0;- @ l# Q I# T7 s' f
* @3 K) \) R! n$ p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) |) Q/ k Y( i5 a0 X- L: D y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 C7 y1 q2 l/ y/ _: T7 d0 G2 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ~$ m# l0 H' c* R& g2 T
' Q R: ?4 a* X7 s% L. I/ B( W- dma_addr_t dmaphyssrc1 = 0;+ d0 F) h0 _# z: R1 Q1 g
- dma_addr_t dmaphyssrc2 = 0;
# }/ B! _ v& k4 W% ^ - dma_addr_t dmaphysdest1 = 0;1 a2 L. G: F f; U
- dma_addr_t dmaphysdest2 = 0;: ?1 f1 V7 S8 z6 N- w1 X& y
$ H8 n7 x# D. K5 f6 ]) L0 t- char *dmabufsrc1 = NULL;
. a2 V1 \3 }% r3 X+ t( n - char *dmabufsrc2 = NULL;
+ o* y0 V' a% h - char *dmabufdest1 = NULL;1 ?- A7 l' Y( S1 H* \: E
- char *dmabufdest2 = NULL;
# }# M, `* r! S1 P# Q2 D# G* X - 2 v2 H" H6 U& I. Y S
- static int acnt = 512;
. y1 n5 W5 F' @* f, F - static int bcnt = 8;
. p2 R5 @ {6 F' s - static int ccnt = 8;/ j$ S) M+ F- j: f+ L3 m& o
- % k; F9 e% p! I8 t0 ?& k
- module_param(acnt, int, S_IRUGO);
" C! g5 C ]3 M3 c' R - module_param(bcnt, int, S_IRUGO);8 U# T0 ?; v$ Z% U8 w( D
- module_param(ccnt, int, S_IRUGO);
复制代码
+ P7 r! F( L: y: q* j2 V8 t8 j
1 d5 `. A$ u$ H* a( T& e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 v4 d; ~& t# V; yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 w( Q, \/ W* A$ g8 |( G/ r% i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 @7 b& q' f. h, ]; q @$ C( M; d5 [; E3 @' K4 b3 r x& C9 ~0 h
. q) {# d- d% Y% j) y6 D- o |
|