|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& X! j- E* T( P" }& _# E% Z- [code]EDMA sample test application6 T, O# Z" @; t: R; x" d
- /*' v F" J* [) o$ T6 n$ b; ?
- * edma_test.c
4 Q, x1 P% a/ R: o D - *
9 S- N/ {* a: N4 { - * brief EDMA3 Test Application
" a9 `6 p( X. y3 l e' [- d - *6 l7 a6 _; d* v, u( N! J
- * This file contains EDMA3 Test code.
- f$ l1 U* \. ]5 \5 ^% l# u" P* r - *
' C. U# Z, M( k1 w& O' i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- L8 y) u* d) r5 P( c' v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! D2 [% O) s# n6 h' f, y - * TO CHANGE.5 V4 V k$ I- z7 C- I+ [3 L
- *; D6 Z- a: ~9 e8 h6 B3 z$ F' |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ B/ G( M# O% ? q$ `' } - *# T( v: X+ o5 B$ w/ P) C
- * This program is free software; you can redistribute it and/or
) p4 z8 T6 m' q6 h) f - * modify it under the terms of the GNU General Public License as: S' n2 N V( u D
- * published by the Free Software Foundation version 2.& D6 M8 j5 J% q4 D. P; u. A
- *
6 ]& w" k8 P0 N1 k8 z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 P- `- o, i; k p: [8 o
- * kind, whether express or implied; without even the implied warranty
6 N0 I$ P; q& ^2 i/ f a4 ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ t+ F# M' g8 p) `- [6 c! }6 L
- * GNU General Public License for more details.- E( N! c) P% m! T" o/ R
- */
0 V4 i) Z E' X9 n; y7 `% X
, g o' H3 t+ o2 r& |) t5 W- #include <linux/module.h>1 [$ T# f; c- m; o4 ]4 T3 X; K2 F
- #include <linux/init.h>, X6 [0 m5 i! @0 C r) l
- #include <linux/errno.h>
5 k; X! s1 F8 T7 u - #include <linux/types.h>: ^) G8 i* r# h, f+ k
- #include <linux/interrupt.h>, P" \: |) z! m: E& u
- #include <asm/io.h>5 a0 P3 n: X; }
- #include <linux/moduleparam.h>
- ^- E- ~# U& H A+ I! `6 C - #include <linux/sysctl.h> e0 G5 c/ R1 T* \+ k; \% v
- #include <linux/mm.h>
0 \: r. C8 z5 P5 a1 q! v - #include <linux/dma-mapping.h>8 e' f( W) I: A5 V5 ]0 c0 W$ d
9 z1 M9 s Z% m1 X( G- @- #include <mach/memory.h>2 G4 {! ], a+ m; f, }8 J
- #include <mach/hardware.h>2 r: F- L' d. T+ P, I
- #include <mach/irqs.h>1 i1 a# |3 _* q9 a
- #include <asm/hardware/edma.h>0 ~1 x$ m$ E* t/ U
- ; F: j/ p! ~0 W+ z$ F6 e
- #undef EDMA3_DEBUG+ m: ]: u) w, m! D. v
- /*#define EDMA3_DEBUG*/
& T0 x2 C: F( X, q5 \2 U0 I - 1 w. g* ]8 _# F1 @
- #ifdef EDMA3_DEBUG
- N( s. Q: q5 R* {$ w6 E' j" ]0 r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# g# o" J( g+ u6 i# Z0 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& g2 m9 a+ u' H1 f9 P! ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' j7 O# D. ?/ C( r+ {0 M# @. q
- #else
! S; Q* C) O+ M1 X% W5 t2 h - #define DMA_PRINTK( x... )' c0 \2 Y; Q) V" @9 d
- #define DMA_FN_IN
' ~0 \! c0 }1 o - #define DMA_FN_OUT
8 A+ t0 d( E7 i/ c4 X - #endif" n4 P! x0 @5 l, x, C3 Z) I( C
- + [9 a: N0 Q/ Q4 I' i$ T* G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* i1 K @! M' g7 {" j; c; d
- #define STATIC_SHIFT 3: q& G! L+ Q& n6 V: r7 V% K' l' i
- #define TCINTEN_SHIFT 20$ [- w1 ?( E$ \8 p2 X ?2 Y( K
- #define ITCINTEN_SHIFT 21
) ~) D3 b' j* V& e- z# M - #define TCCHEN_SHIFT 22
# j h3 G5 G( i1 g - #define ITCCHEN_SHIFT 23
" [ i( r u8 t$ M& g( j5 s+ |+ F
$ B* @3 S% z; L- W) s% w% M- static volatile int irqraised1 = 0;
0 a( s& n2 M% R+ |1 Z- x0 T - static volatile int irqraised2 = 0;4 ] D. j1 U( P4 S0 L
- " L; Q7 @ j0 I( i* Q5 C. u1 c( C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ x8 z, ^9 m, N* N; F1 U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, K; x+ o: A9 a8 T e5 W! Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ~5 \# o: i( H8 O
, x% z- h0 d8 G# J- dma_addr_t dmaphyssrc1 = 0;
- V" F6 P% F l; p; F4 i* q - dma_addr_t dmaphyssrc2 = 0;& H" O# O( y% |8 H% u
- dma_addr_t dmaphysdest1 = 0;: S% X% ?! H2 p" O% S( X9 h$ n! P
- dma_addr_t dmaphysdest2 = 0;
+ T5 H3 ~# U, C4 N4 V, \ - 8 z9 n! B# s- C! _' W" l
- char *dmabufsrc1 = NULL;
; {: P. k5 L# H% z2 m3 X7 Q4 t - char *dmabufsrc2 = NULL;. @5 K0 `; N$ I$ t+ b, W
- char *dmabufdest1 = NULL;7 {) T t* k: m2 L
- char *dmabufdest2 = NULL;3 ?: ?5 W( x, l
3 q# k% ^1 G. u2 C; o6 I- static int acnt = 512; w) y" p4 j2 h' s2 h M: {
- static int bcnt = 8;4 I- a! U' g8 `4 E+ [3 o* k$ b- ?
- static int ccnt = 8;7 D5 l- t" L2 c4 v
}# R, P7 T f% ?: c) g& s% L- module_param(acnt, int, S_IRUGO);& |) D- ^' O+ R" j5 [
- module_param(bcnt, int, S_IRUGO);
) b! f0 M C% L0 j7 H$ b, m% M - module_param(ccnt, int, S_IRUGO);
复制代码 & h N/ j; f* q
4 b2 J9 a1 D1 t/ `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 }( w. f* ^! e# F1 @% l, v* a' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( X T3 r0 a2 Z2 b. l0 V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 T# U. ]% N2 z2 {( j7 A" P9 Y
, \+ O+ r9 l# w; ^
, Q: a# m9 d, Z6 ~1 x
|
|