|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 S S2 q* U$ L A- [code]EDMA sample test application
4 u2 ]& d4 d( M; a - /*" s1 Z, k# _8 N: Y# A
- * edma_test.c
3 L/ g+ t# r9 b - *( s1 V r n: l7 V4 _
- * brief EDMA3 Test Application. ~- G6 P. |/ t
- *6 H, ?3 o+ o2 ]( H F
- * This file contains EDMA3 Test code.
. ]/ u6 n, i9 a, v - *
* E+ W- A- I2 l9 {' C# G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 l$ I. F; w# O4 H; G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, T, N8 k8 N8 M1 Y! W
- * TO CHANGE.
$ U) e6 ?4 e1 y7 k - *; s r. v6 |: ]% d% o: a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 u& @% _( G: ?- v& T - *# o3 H" N, g6 p9 {
- * This program is free software; you can redistribute it and/or3 k# s% t4 W5 {# V0 J" Q
- * modify it under the terms of the GNU General Public License as/ [/ Q! ^6 \8 A- f
- * published by the Free Software Foundation version 2.1 _, n6 [( y8 ^8 p. o8 p
- *
3 d9 B! u/ X& E7 d- C! s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! _" ]3 z+ Y6 F. o e* k
- * kind, whether express or implied; without even the implied warranty4 S$ a# D; D1 ~; F+ r7 X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- H2 ~( v% b# o
- * GNU General Public License for more details.* n& C7 ?, E+ {. z; P
- */( H" \9 l1 {- a" {: S# E* K$ a; R
- & |$ [& ? O# Z- c$ Q( n/ Z0 Z
- #include <linux/module.h>2 b+ s/ V \7 ]! J# o1 M! ~
- #include <linux/init.h>
" _( Y1 l( w/ [9 C+ g - #include <linux/errno.h>
& R: T1 c& f4 O. i. I - #include <linux/types.h>
% _4 F; t& V0 O4 X$ [1 w - #include <linux/interrupt.h>
7 ^3 e1 l8 z5 W' x+ f - #include <asm/io.h>8 {; i7 g* z( U- [5 ~9 r' I2 ^
- #include <linux/moduleparam.h>0 X6 J; ]! l4 z
- #include <linux/sysctl.h>! K7 O& h' l- K- D5 S5 c
- #include <linux/mm.h>, x( s1 c# C5 i4 m+ _ n
- #include <linux/dma-mapping.h>
6 D: O% \& h$ S5 ` - 7 [- d' d7 D$ h% C) w
- #include <mach/memory.h>
6 p+ A6 z* j8 ?% C, @$ R - #include <mach/hardware.h>
2 n# a4 p6 q3 V. ^ - #include <mach/irqs.h>4 P; G! s' E& q4 ^+ s" p
- #include <asm/hardware/edma.h>
5 F$ S" c; s! u
7 b# ~" ]( s5 C m8 D( z8 _' f- #undef EDMA3_DEBUG/ P- {3 g' l' `& k5 Q
- /*#define EDMA3_DEBUG*/
% l4 Y6 b- X# H* }' I8 {1 S - + n4 I, I% i6 C9 j2 J- r. {# [! R
- #ifdef EDMA3_DEBUG
( I0 b n: h' N# U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 |! P; x/ q4 C! @# X, R/ B- v1 E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 u8 z4 u7 i, W; z; w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ \5 J0 w, @0 C) m3 d - #else5 S4 x1 J( {" G1 J' ~' F1 S
- #define DMA_PRINTK( x... )9 k. q) }/ }: O
- #define DMA_FN_IN
& L! Z+ V, m J |" a - #define DMA_FN_OUT
% P/ x6 K: V5 E" z; M K, ~, a - #endif; n+ w/ z$ ~; v% \0 [* C
- 7 N; }- Y. t! {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& e1 n# Q$ X. n$ _* a: h, P
- #define STATIC_SHIFT 3, K1 J/ V% v, R* |. A
- #define TCINTEN_SHIFT 205 k' P6 q! Q3 H( n) m- m' O# W
- #define ITCINTEN_SHIFT 210 y1 w2 Q: C6 ~ k( `1 A n
- #define TCCHEN_SHIFT 22
5 W; I% H. p- H* s - #define ITCCHEN_SHIFT 230 u+ z7 |7 E4 U! x
- 5 t( v) j, l& g f8 s A! I- X! y1 _
- static volatile int irqraised1 = 0;& R) T& `4 j9 q+ `1 m1 {% V
- static volatile int irqraised2 = 0;8 r/ g0 }+ q0 D' b0 }
- % y7 w8 S/ j0 f$ L3 [0 u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 H+ u, I6 b/ p5 W! n4 U' ~% G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ B: D2 [; M9 z% d! z& i- O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ d: G T5 X. A4 a/ p0 v$ C" R% S - 7 }5 _, }! R! F# a% p$ d; I
- dma_addr_t dmaphyssrc1 = 0;
2 F, j4 j9 p" p: L4 A - dma_addr_t dmaphyssrc2 = 0;0 H4 C5 B( s1 z( i. w
- dma_addr_t dmaphysdest1 = 0;
* z% n" h7 P# j& ^- b. k+ L# r - dma_addr_t dmaphysdest2 = 0;
/ l& O& C* D4 { Q6 p - 4 r! ^2 d' G V
- char *dmabufsrc1 = NULL;9 J6 H( c( @9 ~1 C. j4 J- p: q a( v
- char *dmabufsrc2 = NULL;
+ v; v6 m+ m! w - char *dmabufdest1 = NULL;
" W9 U3 a5 x" N, x7 z - char *dmabufdest2 = NULL;6 o4 D: h4 ]8 I- R; f" e) ^0 d3 j# B
1 {& G' j s# n# f- static int acnt = 512;
# F0 L0 K# P6 T: J8 y7 u) g2 j - static int bcnt = 8;) h& H& ?3 u5 l; B9 R! `3 s
- static int ccnt = 8;, E# f3 s; Q- k; ~
- ' p3 Z2 L$ L. u# j# Q; `' q
- module_param(acnt, int, S_IRUGO);
1 |2 U7 C: J. J) m* W - module_param(bcnt, int, S_IRUGO); ? X4 _- S$ T1 h k8 K
- module_param(ccnt, int, S_IRUGO);
复制代码 ; I. H; \5 b: t9 f+ T
! S8 V+ f. V1 @8 ]: Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 Q, F/ y! }1 i8 Q( _7 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 b0 k8 f Q1 o$ u# h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ Q7 x* L* T/ T# @' _( }
, U& k0 P+ O$ J" n) z/ [& a/ J% a1 {# B
|
|