|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 I7 G2 P( X# d" l# N" K( i3 E0 n" k
- [code]EDMA sample test application5 \( H- L7 a( F2 r) Y% T- D
- /*
, A. A4 l4 T4 o9 `5 [) h - * edma_test.c% Z+ C# u* ~& N/ t
- *" [$ p' {# b. h) [, e. h7 J
- * brief EDMA3 Test Application
6 f8 v: E7 g( l/ T* [3 Q - *
2 J+ |+ t, x/ O - * This file contains EDMA3 Test code.4 E% X8 K, k) f6 J
- *4 w0 B) ~7 p4 @2 o, h" X6 M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- y8 i7 L3 P+ Z5 G# h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" U/ w6 A5 R) O2 R7 U0 x5 z k; e - * TO CHANGE.' }! O2 Z% w* O2 P7 N5 G& k
- *
* R: [; _9 c1 B* ]1 {7 O# K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ K: V3 _% }2 x2 B' y! c! a2 G9 F: U
- *
) T; h& j7 z5 ~( b - * This program is free software; you can redistribute it and/or, r3 F5 P: E- t5 g8 A+ L# X
- * modify it under the terms of the GNU General Public License as
1 x* C& H9 Z3 q1 o: p0 T4 { - * published by the Free Software Foundation version 2.
' s2 T4 i3 b- S: q) e2 `6 g - *
& L" f" [' D& e' z7 F* ^0 q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ a* e5 D G+ J8 p# J& I8 l9 H5 x - * kind, whether express or implied; without even the implied warranty
1 ]: I2 m+ N: y& m4 B5 b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! ~6 t7 n& G; F7 R% w - * GNU General Public License for more details.
9 x: K" p: h' v8 p - */
1 J: q! ~) P% Q1 n; _" ^: L. Y - . Z m+ E$ m; D- B
- #include <linux/module.h>; k8 @4 m5 \4 ^; Z) P, N! v% v1 n
- #include <linux/init.h>
/ d6 L9 X8 R7 I0 V) v4 F$ C - #include <linux/errno.h>4 f* ]4 o7 g, x
- #include <linux/types.h>
- W5 n( \. t+ c3 e; m3 U3 c - #include <linux/interrupt.h>( k$ X; i& w: ?% X* w/ u& y, F
- #include <asm/io.h>( e. C9 Z% r" U' f2 _
- #include <linux/moduleparam.h>
; }% H" g [$ A1 I% n1 X8 f5 `2 j - #include <linux/sysctl.h>1 Z$ l7 p; Y# V+ P: [
- #include <linux/mm.h>" c5 t ]7 B9 F* Z: \( _5 W0 v
- #include <linux/dma-mapping.h>
1 a# \. Q5 Z M# N. O+ H8 R
2 q& k: `: n/ g) V% A1 S- #include <mach/memory.h>
; e9 ^" ?# ~2 x+ `3 ]- `8 e! R" p# B3 r - #include <mach/hardware.h>% D4 ?. u c4 `4 }8 k1 L
- #include <mach/irqs.h>1 E% N7 m3 K& U8 D+ V
- #include <asm/hardware/edma.h>
% F/ o& v" u4 b+ a. Y - " p# {) x; H8 `2 p
- #undef EDMA3_DEBUG( d, B9 ^1 a% M- X; u: O
- /*#define EDMA3_DEBUG*/2 X; k) M9 G0 p3 F" k& e5 H1 u& l
- 6 K( ?: G6 c' A5 _; h
- #ifdef EDMA3_DEBUG
! R& \: O+ y! H3 { H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ Q7 b5 O6 u2 x4 \( t$ ^9 o; C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) y, r" w5 y/ Z% T& k" H% L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# k/ d. _* }4 A+ h- y" E! y6 b' x( z - #else
1 Q H% E" x1 B - #define DMA_PRINTK( x... )8 H, {- x6 r" [
- #define DMA_FN_IN
! q( F$ c' K4 C5 z: X! N) R, i - #define DMA_FN_OUT( z8 {" c! o9 ?; [% r5 {3 g" r
- #endif. c4 k( n, \7 P. B" y
- & e/ v" M6 J$ n+ v( @) v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; n4 F# a+ w- H8 _7 a. j1 H1 ^ - #define STATIC_SHIFT 3: {, S* ?4 i4 Z- y7 d) a
- #define TCINTEN_SHIFT 20$ l7 T' K+ n& T( V' f# B8 |
- #define ITCINTEN_SHIFT 213 e8 f6 Q9 z+ b# q. N3 v
- #define TCCHEN_SHIFT 227 b5 q. X6 C% F6 |
- #define ITCCHEN_SHIFT 239 k/ f; J3 h2 X/ t& k4 M
- " u# j: r/ A2 e
- static volatile int irqraised1 = 0;' i! R" w f5 w7 z, U9 e M
- static volatile int irqraised2 = 0;
/ L+ [, J. Z/ i3 [5 D: Y4 `' v - 6 h7 `! ~8 K R. D+ v o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S4 c$ {' ~1 ~7 f$ o" d" @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. e2 {3 K0 M" q' T0 W: v4 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 l! ?' M6 P! ~& q
; N z" _. h( Z8 Z1 V5 n7 V% q$ U- dma_addr_t dmaphyssrc1 = 0;- d: N# Q; E2 Q A
- dma_addr_t dmaphyssrc2 = 0;
( N, S& J- e: D( g. ~. s - dma_addr_t dmaphysdest1 = 0;0 l+ t, _0 \( E; i& s7 q
- dma_addr_t dmaphysdest2 = 0;
9 x. @2 E" A) A. c. _+ n
% [4 ^3 S3 ~- V6 }4 Z* \- char *dmabufsrc1 = NULL;
: S+ H, t0 i v1 [0 ? - char *dmabufsrc2 = NULL; H% H4 Y: f5 A) W D
- char *dmabufdest1 = NULL;
" v }* Y( h: v' \/ S - char *dmabufdest2 = NULL;+ a, n& J) Z( _4 i* [
- 5 o7 d! t/ B) s" Z) l9 t- e2 A
- static int acnt = 512;0 d& g! G6 j* j$ ~( }
- static int bcnt = 8;2 z$ m% h6 j# N2 l
- static int ccnt = 8;
% W' z, _$ g5 j( {/ P% X
4 e2 }4 R0 j8 H* u- module_param(acnt, int, S_IRUGO);
* y; v# ?; ]% {% {3 g' C% i/ X$ i - module_param(bcnt, int, S_IRUGO);2 g: X$ S! |& }5 D* t# D" v" R
- module_param(ccnt, int, S_IRUGO);
复制代码
: o* k W& Z0 `: g8 \; G! Q7 F% \
: r6 P; x+ l. O# _9 x! Y; I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, n4 i3 x& v5 m; `- g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: r4 e1 j, h s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: h& p0 N2 C3 l' h2 O
y+ t: K+ d# [; q' Y2 Y
, G8 {: t# C$ d: K% J |
|