|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 u$ R7 o9 i( @7 k# p! x
- [code]EDMA sample test application6 J. Y& y( I$ |0 _. c" K
- /*
' U$ s, E4 L6 x* I - * edma_test.c
& h9 K3 o+ ^2 U/ O+ R( a - *
- p1 C5 Y! ^) { U5 W$ S - * brief EDMA3 Test Application4 d% X6 @! Q4 g% y& {. }
- *2 o; z/ Y! Y1 q; A. R6 R* D
- * This file contains EDMA3 Test code.. e" S( s+ o1 r# l) [) I! l4 d, r- ~
- *
3 U P1 `- {" Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 m5 s; q" u [4 ^* W H) g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 w+ W+ T4 J# k. c& ]; X - * TO CHANGE.
/ Q) C: p @4 D% u/ _5 U4 q" S - *
, `6 S, }) P' w. I1 T9 c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( D4 E4 d) O( v7 c6 W - *- C5 E0 B% [! f3 Y/ x
- * This program is free software; you can redistribute it and/or
; l; B$ b; g+ e - * modify it under the terms of the GNU General Public License as+ v3 u5 n" s! K) ]' F
- * published by the Free Software Foundation version 2.: H5 P: ^' b3 I T) Z% L6 r
- *8 J: U0 J- D, u, S% E# H$ D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! P) d% t# Q8 I# A0 }8 H3 \8 F
- * kind, whether express or implied; without even the implied warranty# Q5 T0 v; S; Y/ \/ `2 N, i8 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 f/ k) y% w% o: ^
- * GNU General Public License for more details.
! d6 }2 ?+ e; g& I - */
H8 E, P- z2 }; e. t- L8 C - 2 V0 t) n; g$ b+ n
- #include <linux/module.h>& `- X! i ^& H4 Q7 ?. h
- #include <linux/init.h>& d- }/ T; h4 a
- #include <linux/errno.h>) c& A- N0 Y5 d9 F/ A
- #include <linux/types.h>
: ]6 z% q6 y2 O - #include <linux/interrupt.h>& C$ B- U) C7 I) I
- #include <asm/io.h>( @3 g9 ]& _2 B' h6 A6 O
- #include <linux/moduleparam.h>4 M1 q* U8 B$ ^
- #include <linux/sysctl.h>
, J$ B9 r4 b$ i X. [ - #include <linux/mm.h>3 v& P* t% g# I
- #include <linux/dma-mapping.h>
0 h* v& U G& Y, m1 O. i0 R5 I% s - @& S" l- g- J% n. n0 k: Q
- #include <mach/memory.h>" p( q: F9 v" U% l- P- `* W
- #include <mach/hardware.h>
- s, j! y9 v1 z5 i9 `+ }* O8 f& \ N4 E - #include <mach/irqs.h>
( r( o: g9 ~1 f: V - #include <asm/hardware/edma.h>1 a# p: ], ~$ e z( M
6 m1 b. {7 J1 Z' d' z- #undef EDMA3_DEBUG; {; H/ _. f! B' Z
- /*#define EDMA3_DEBUG*/
4 v5 W" Z* V G; _ - + q. X" E/ ?* W4 x- \8 \. w
- #ifdef EDMA3_DEBUG5 h, |- L7 i1 l" t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 s+ j, m, |# k0 ^, k2 P8 |% O i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 n' G) F+ K1 k0 F. u- Q5 R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 i3 x5 d8 ]3 r5 f: P - #else
: t2 p, y; C g7 ? U9 z - #define DMA_PRINTK( x... )) w% K: _, a. C8 v
- #define DMA_FN_IN
0 [# g" M/ R! c+ U! t! V - #define DMA_FN_OUT
( G9 \+ Y! Z9 }0 i - #endif
* w& g) M, r6 c7 N) W
0 k# K Y8 N8 ^ y; }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 J; f- K7 r+ Q" y - #define STATIC_SHIFT 3
0 b" O, d; W5 j& N% D- d* J$ V - #define TCINTEN_SHIFT 201 i7 G( M6 e) b+ r
- #define ITCINTEN_SHIFT 21: Y. f3 \# q5 ~% C
- #define TCCHEN_SHIFT 22
9 }% q2 ~" \( ~ - #define ITCCHEN_SHIFT 234 Z- [) |) `6 C* l- {/ q6 H
' ?7 o8 K8 Z- T- static volatile int irqraised1 = 0;6 C: t+ }1 E" {- R- _; D1 L
- static volatile int irqraised2 = 0;
) n+ D* m8 J: ^1 C9 E* ]: \" ~. B
& A! L2 { E; W+ O/ G! q8 L/ d: q) E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 k' |7 t/ a* X2 X2 H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% b+ E; }. Q0 \/ C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" u) K8 j: r3 d* o7 Z5 b
/ d3 ?; o2 D' I5 K- C+ }- dma_addr_t dmaphyssrc1 = 0;
( {4 J& O" s( }: _4 s - dma_addr_t dmaphyssrc2 = 0;
4 F7 O, i& x/ L0 |4 W+ j# T - dma_addr_t dmaphysdest1 = 0;1 a/ g }9 V' Q: W, \+ Q
- dma_addr_t dmaphysdest2 = 0;+ x( K/ y, h- x& V3 G4 |9 F
- + G9 { J% q U% J4 g z! L q
- char *dmabufsrc1 = NULL;6 `/ f! H4 `5 z* E
- char *dmabufsrc2 = NULL;" h+ V. K. {: V& s' J
- char *dmabufdest1 = NULL;' c! p7 v4 C+ R# s j* R, Z
- char *dmabufdest2 = NULL;* _: D' }- @/ `6 h- Y" n: s0 Y
* y$ T4 c% h# r- static int acnt = 512;" l/ [; K( q! \9 t
- static int bcnt = 8;( m) s r K' a, i+ Q
- static int ccnt = 8;
' Q$ J7 U/ N5 j1 g
0 Z* l- h% e, M9 q) d- module_param(acnt, int, S_IRUGO);
% B; H2 ~/ D# ?4 j, M) U - module_param(bcnt, int, S_IRUGO);
# ]8 c: d% O# i; m# n/ J1 L8 G - module_param(ccnt, int, S_IRUGO);
复制代码
0 i0 I$ B7 A7 A% }5 C
8 Q, [- f+ b" S4 A. S; c1 r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ Z1 F0 T: T! u& G) T8 Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' v! _) }0 ~6 u! a! _/ R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 c: O& @# f8 [/ H. N
( X2 Q* d2 }( ^, S0 B
0 Y: Q) \9 d9 W, L' X* P0 f |
|