|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: V0 I1 Q! t. Q, N- [code]EDMA sample test application1 X1 O, D2 \" ]- N2 o/ s
- /*
5 I6 @4 W$ S% y( f, ] - * edma_test.c) o5 B! p, @5 {
- *
0 N/ H' ^5 @' s" e# ] - * brief EDMA3 Test Application& I( f: b9 {# J6 I5 [/ O7 [
- *
4 S! i) e4 e# Z - * This file contains EDMA3 Test code.
+ Z! `' a" N. t4 C B4 D) d2 S - *
8 V' r8 D- z! U3 J. E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- R8 F6 A$ r+ P* u" b- R9 V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. T! o5 U& D3 N. y' k$ z/ `; Y% I - * TO CHANGE.
3 K& q. k2 w0 x) t9 M1 F: w3 Q- e# G - *8 H, O# `* N( ~/ }. T; x7 q' e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 l6 J b D! f* g$ w" g
- *+ l3 y" \& t* p6 [% x- y6 ?- S
- * This program is free software; you can redistribute it and/or$ g' E* k4 m/ d
- * modify it under the terms of the GNU General Public License as% r6 |* c3 s: |! V6 \4 k
- * published by the Free Software Foundation version 2.
$ S4 E1 R, ?; A: W5 B$ O( |- } - *+ L+ u7 X' w- D1 X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 I" D, i5 Z& ^; Y: F
- * kind, whether express or implied; without even the implied warranty
* Y- L: K" `+ F; o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 t7 S7 l2 n }4 _0 g
- * GNU General Public License for more details.
4 h. e# b* H$ n1 Q8 `# B: x: i - */
# b; P. v; ^" S5 A8 G - ' L* [% ]/ s, a4 p
- #include <linux/module.h>
; b: X% G# `* m) N - #include <linux/init.h>
% J I/ P9 \0 [: b - #include <linux/errno.h>
# {) e, s L; ?' ^) M. k5 e - #include <linux/types.h>
2 a {' I( T* u) c2 T# r - #include <linux/interrupt.h>2 e. L/ i* w2 d- p. s# E0 f' A }. N- U
- #include <asm/io.h>$ x$ `( Z+ I( R- {0 R' q
- #include <linux/moduleparam.h>9 h6 `# }1 k4 {% J9 Y: Z9 x
- #include <linux/sysctl.h>! w7 Q& H. W3 h* t! _( E$ G
- #include <linux/mm.h>
* m4 h [$ _* J' s# u/ b% A9 J- q - #include <linux/dma-mapping.h>& G" g$ F* u7 S
- 8 B9 \) y1 R# u# b
- #include <mach/memory.h>
( D( E. \; y. b4 C. I: N# m - #include <mach/hardware.h>: }; I# ?6 R: a, ?+ @! P! }+ r
- #include <mach/irqs.h>
/ d3 Y, W8 `: i - #include <asm/hardware/edma.h>1 \" f& s8 R2 J* {1 k3 [# b3 R
m% X( ^+ k" b! b2 h+ V- #undef EDMA3_DEBUG, g7 R; H9 K8 b) G! H: L, K
- /*#define EDMA3_DEBUG*/
1 t& V, e' g( g- m" o; N
) E3 c0 Z, |3 J5 z$ f2 Q) P1 b- #ifdef EDMA3_DEBUG6 P% P# J5 i# C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), H3 V: O& L: c" O) ?( \( S$ A1 l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 t' P! v4 Y5 o7 H3 n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 _' q/ v7 i# t! n
- #else
/ ^* J1 V z6 L: s Y- | - #define DMA_PRINTK( x... )- I2 o0 Z0 ]$ h: a" u* b
- #define DMA_FN_IN
' H' h( v2 P2 g( {' F8 W - #define DMA_FN_OUT0 n3 E' m3 @. v( R# H
- #endif* |, b6 g, d/ r9 a" t& ]4 k, T
+ n, a5 n1 Y& k! B! r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% @, s" B. E) P: s7 ^, v - #define STATIC_SHIFT 35 |# B7 \7 z. |0 G% q
- #define TCINTEN_SHIFT 202 s+ Q% W& K/ {& w W$ [6 X6 g, t& A
- #define ITCINTEN_SHIFT 21
# b& r# v0 ]# K$ k - #define TCCHEN_SHIFT 224 y% L' a% g: p$ m9 f9 O
- #define ITCCHEN_SHIFT 238 K; j! Z0 Z6 X f5 ~
; q4 \8 V2 B# E7 D+ w- static volatile int irqraised1 = 0;
% P1 N& S6 n; ]+ c; L - static volatile int irqraised2 = 0;( M5 e6 r$ v5 v( J0 B
d9 a. ]- P+ r) c- d! R0 ~& T* k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
[6 H8 O' L) v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ b0 V% V& u, ?. s: Z, e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; B/ a0 B( E' N- g I, O
- 7 R' I6 `3 {7 d9 k5 U4 q
- dma_addr_t dmaphyssrc1 = 0;- ~- w6 ]5 R6 h% f; \. }. U
- dma_addr_t dmaphyssrc2 = 0; Y% ?9 q4 C. H3 @1 w- O% b' t2 \
- dma_addr_t dmaphysdest1 = 0;
" O" i' j# s/ P$ Z% G - dma_addr_t dmaphysdest2 = 0;0 @+ W4 L( r% c% h
# }' u1 a' d8 i( I c7 [- char *dmabufsrc1 = NULL;3 m: A" p4 q6 ~
- char *dmabufsrc2 = NULL;
+ D2 }/ D8 l5 N$ ^( a2 S - char *dmabufdest1 = NULL;
$ x( J7 ?" ^7 h$ m1 a - char *dmabufdest2 = NULL;7 o D Y* A* `
- 4 x. @! I z6 g5 ?
- static int acnt = 512;
& ~) d$ B- e$ I0 Y! ?3 G - static int bcnt = 8;
`( R4 C d4 e; T0 X; Z - static int ccnt = 8;# R8 m+ ?8 `1 C0 e% [ Q2 g
- ; x: h" s; o" d! U0 A( s
- module_param(acnt, int, S_IRUGO);
3 G: O; b0 [: ~5 |" j+ d. h - module_param(bcnt, int, S_IRUGO);. G0 i4 d0 C3 v* d7 ]
- module_param(ccnt, int, S_IRUGO);
复制代码
; M8 [# r3 [ Z ?5 D; g; ~) m( p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ E: b. k% B) R1 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* o9 Q! C$ D$ q% a( |8 x& H7 w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 {/ U# n: S0 G- ~) J c/ v. q
+ u! b4 q6 r% I1 b: n+ o: o' i* E4 J; B4 U I/ g: W
|
|