|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 Z+ N* [$ [' _! }- [code]EDMA sample test application6 C' s& v8 k* C9 w" z
- /*4 `' s d, _ G! r
- * edma_test.c) ? L" i$ e! q6 Y9 T
- *2 I8 c& {- Y6 b1 u; S
- * brief EDMA3 Test Application: p6 Y; b$ b2 t( S1 S' C1 ?
- *# [% W2 ` b2 @0 S
- * This file contains EDMA3 Test code.. q2 N8 w! F- Q* n6 B9 p) x, G
- *
6 W& I3 U/ F9 T" ?/ t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- r( v+ i, a" ]2 f' |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 S7 s4 f, S6 R6 P# `( I - * TO CHANGE.
3 w. H4 s: c4 r1 M! M - *
! A6 L# S6 I" n0 i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: d3 |+ l) S; e* H, x1 O; h& U9 D
- *) L) e6 R4 N) }) X
- * This program is free software; you can redistribute it and/or
1 }& x5 Z7 F; S% ]5 d% J - * modify it under the terms of the GNU General Public License as
; N1 u9 F' g' D, F5 ^1 R& z4 n - * published by the Free Software Foundation version 2.: [- K/ [" ?' g" G: t+ R+ q; P# Y; N
- *
8 Y& ?) Z; }8 r( P2 A/ l- \) a' P7 F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 W7 ]1 C% ~1 |( Q: i; R
- * kind, whether express or implied; without even the implied warranty
% L" o4 C; a* R" ]' f p. f* e4 G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: e4 E4 I. t8 p+ \8 D3 u( n3 k
- * GNU General Public License for more details.
# V, k4 ]* Y0 k$ P - */+ K* m7 U+ E* ]
- 3 h/ M7 E0 D- X' M- x
- #include <linux/module.h>& s' ?& y: y+ l( }, u# f
- #include <linux/init.h>) {9 l& J# C' g9 }; T2 e
- #include <linux/errno.h>
, i+ ]$ L$ {/ v! V: p- [/ b& T - #include <linux/types.h>
0 w2 x+ {2 E2 H+ r, B - #include <linux/interrupt.h>% A5 ~9 _( ]1 Q8 }* `& }5 L( h# D
- #include <asm/io.h>
! Z+ }/ |9 p8 g% O& Z @ - #include <linux/moduleparam.h>
7 D3 k& [7 D. t1 U J - #include <linux/sysctl.h>
3 q! x5 G# D* y) k% a! T' W - #include <linux/mm.h>
8 X) Q# @4 k% o% [! E - #include <linux/dma-mapping.h>
2 @& q# Q+ t% }& K" i2 O: M - 0 \6 [5 l* Z& V. p
- #include <mach/memory.h>: v' o; `2 Q7 B
- #include <mach/hardware.h>. m( T4 z" V: ?* O$ c
- #include <mach/irqs.h>& E: Z+ ?; S# a% O5 ^
- #include <asm/hardware/edma.h>8 k, M" n9 Z" o( c
% e. `: n% ?8 t- #undef EDMA3_DEBUG
3 ^" N, k8 i$ X& ] - /*#define EDMA3_DEBUG*/
6 W: J5 e* x' Y; \8 A U3 v1 N
2 Y- B& w. s* K! W! m& r1 W- #ifdef EDMA3_DEBUG! }4 s( ^6 Q4 V; g S3 O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) i( l+ N5 Q) P; ~$ [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ B" U8 k; k7 q5 y. m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% v8 |; f! k7 j7 i; z: ~% e - #else y' p; g# y( V; T! Y7 n% ?! P
- #define DMA_PRINTK( x... )
8 P7 @3 b+ P/ r% p% C - #define DMA_FN_IN/ O+ B3 F1 Z1 \# u/ d' w" N8 ^0 d
- #define DMA_FN_OUT& I! x( w0 y% B; i, T
- #endif7 q; J, i. S" I, V9 c
; B% P% B( i' R. h- #define MAX_DMA_TRANSFER_IN_BYTES (32768): D/ p6 V8 A+ v- N8 l7 s
- #define STATIC_SHIFT 3
) E7 l& o, M5 A6 u' s - #define TCINTEN_SHIFT 20
' c# _ U. d, ^ - #define ITCINTEN_SHIFT 212 Q; I! z' Y4 L! L0 O# Y
- #define TCCHEN_SHIFT 221 H$ j$ `7 @/ C
- #define ITCCHEN_SHIFT 23
+ f* j; @/ ~' Y% O9 x - ! {; J4 R; o' N1 Q
- static volatile int irqraised1 = 0;6 `6 a" V4 |1 l
- static volatile int irqraised2 = 0;
: S% l2 U) D+ w
0 J* X/ g0 h1 g+ I; N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: \% ^2 k6 N3 l% N, Y- F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, o) l4 c; G% h: b% [9 y# j' I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 m7 {# H/ c% x* r- a' ]: h
9 R8 p5 |. U1 T/ [' l, _ U. L/ ?- dma_addr_t dmaphyssrc1 = 0;0 q4 D/ Y' n- Y- y: l9 ?
- dma_addr_t dmaphyssrc2 = 0;
1 f+ F4 S' |( i; M6 _$ w - dma_addr_t dmaphysdest1 = 0;3 _* `* @* S( G: M; o& b- W
- dma_addr_t dmaphysdest2 = 0;
; @1 F: B6 j( s- s4 V - - K6 V' c% N. f- [. l# J1 w
- char *dmabufsrc1 = NULL;9 N# c- X; N& D
- char *dmabufsrc2 = NULL;
& w2 ]- t5 v' }, \8 b- ? - char *dmabufdest1 = NULL;
$ P/ y5 Z& V' E. e9 r - char *dmabufdest2 = NULL;; M# J" J" z1 E7 G8 j
, @$ M6 I; j1 Q: ^5 }5 ]9 B" [- static int acnt = 512;
* t- Q5 n% Y; |; x: e) \. _& v - static int bcnt = 8;& ]% F1 @8 r k+ X7 r
- static int ccnt = 8;6 A( q. D9 M: H4 j6 [
- - }/ n5 l+ @! A7 u5 V O
- module_param(acnt, int, S_IRUGO);+ k$ h6 G& R6 d1 @; e5 b0 V
- module_param(bcnt, int, S_IRUGO);
) d5 v' \1 y' @. g. G4 l1 o - module_param(ccnt, int, S_IRUGO);
复制代码 0 |* o, u1 B7 U, G" R2 B
) z9 H( {6 N3 H9 T+ d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- ], e0 Y% ^3 F) S0 Y# f) Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 j$ a2 R! ?( i ~3 Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ X& L% A% {* ~3 }
4 K# K) x/ g8 |: T
, X ]3 K7 }$ l" v
|
|