|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: D* u; J# d* G0 T8 v- [code]EDMA sample test application
" S( B/ u! H2 ^+ V - /*
% j) V9 l1 Y- v* a a- Q - * edma_test.c
* s, H/ S) y) _3 _ - *- G% K" H, @* C4 J3 b
- * brief EDMA3 Test Application6 @+ ]/ G+ p3 \" ]8 J/ E
- ** ~# J6 \) u; `: l
- * This file contains EDMA3 Test code.( a& `0 ]# U- r: f R& y9 C2 Z& h4 l9 M
- *- \+ [. l; ~9 \; f; _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 t& N: ~. E8 K7 I& T! N! L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* U8 L# I j, D( P& r* a5 y
- * TO CHANGE.
: V" u8 M1 j* n - *
! Y8 j' r. ?$ f R9 C) P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 y# g7 A" C; d. n - *
, ~" i- K/ ^8 W" l1 o2 u5 { - * This program is free software; you can redistribute it and/or
, J: |' j' U+ X( S. N$ E) G - * modify it under the terms of the GNU General Public License as
( M, s7 _8 v& B! Y# G - * published by the Free Software Foundation version 2.( f+ y, Q9 f* s. e, V
- * v3 G m4 B0 I8 j' v1 c8 U# @: }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 [$ _7 f. G5 l, t# y2 ^
- * kind, whether express or implied; without even the implied warranty
$ x/ _# e" o, N2 F6 d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! p, J4 T# _6 v1 n
- * GNU General Public License for more details.
3 D. U1 e3 U' W* ]. B: \ - */
% ?' `8 d4 g& C
7 M c& r2 V" l7 Y; ]: l) {8 K1 U- #include <linux/module.h>) b# P1 }) ~# f' R$ b$ V& W
- #include <linux/init.h>8 X) M& K* q$ N' r9 _
- #include <linux/errno.h>
4 b1 U2 H- `/ a) p/ B; z - #include <linux/types.h>, S' ]- F% t3 e1 t' l, [2 Y# s, J/ L
- #include <linux/interrupt.h>
2 n4 n9 T6 @" k, N" \$ k - #include <asm/io.h>
2 H, C8 R( j+ h1 k" ^ - #include <linux/moduleparam.h>: [7 m" t+ y. m# O! c1 }
- #include <linux/sysctl.h>3 o) e* K. d6 V E
- #include <linux/mm.h>+ T3 A" V+ I, } r* l
- #include <linux/dma-mapping.h>2 {8 U- v% q2 x; M
- 6 l0 p% l3 i; f4 i+ L) G
- #include <mach/memory.h>7 F3 p* s+ z0 J, K- r* P
- #include <mach/hardware.h>- F2 O6 C; Q `4 \& w5 O) A
- #include <mach/irqs.h>
. E0 [; w2 p+ B9 ?7 G; f8 ~5 w3 u7 K. { - #include <asm/hardware/edma.h>; j6 {* O- X6 h g& O
) X* G ?6 B# G. Y! e+ B- #undef EDMA3_DEBUG& H) r# C$ y7 {* W* P# I" Z9 r
- /*#define EDMA3_DEBUG*/
/ t( s' X' e/ s* h8 Q
2 E, H9 ^8 {% k( X# G- #ifdef EDMA3_DEBUG; j6 Q- D% K% G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" D9 b4 n9 e( Q8 H3 Z, f. \: p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) D" D v, r b3 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 W( r. S z3 q+ u1 Q) h& Q- n
- #else
& b# V) O0 j' v+ A Q3 F - #define DMA_PRINTK( x... ). L0 u* Z- C: ?: \
- #define DMA_FN_IN% k. g$ ~+ M9 ]9 y: f
- #define DMA_FN_OUT
! z; r/ T- [; {; b2 U1 h - #endif9 F4 u& _0 l3 m
' B: @6 H5 h! [9 T0 h/ m" O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ }+ N1 D! X$ [; ^
- #define STATIC_SHIFT 3
0 ~" b7 ]# f% V# J7 e- t+ d - #define TCINTEN_SHIFT 20
2 F2 C, p1 x& z& `+ R - #define ITCINTEN_SHIFT 21
& C" `- @5 L3 X" t3 u# ^ - #define TCCHEN_SHIFT 22& R1 `& ^' E7 ~4 f" n; R2 B
- #define ITCCHEN_SHIFT 23
# e4 t( X1 M1 F# U - : k5 o$ o: |( ] [3 K4 q: X
- static volatile int irqraised1 = 0;! [/ I2 L3 i! i
- static volatile int irqraised2 = 0; B! J: b1 J6 D+ w
- 6 ?/ ~6 E0 [9 m }# i4 s& W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. I" J4 Z6 P$ \6 k* D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! @- E: f4 A- d* `& p1 R$ L& x ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ \8 |% A+ ~3 s6 R6 p- r - ( s4 E% ?; G! k, x1 t2 S# h9 S2 `7 f
- dma_addr_t dmaphyssrc1 = 0;
2 R" E j. W8 ^/ Y+ ]' ^6 N% U7 c - dma_addr_t dmaphyssrc2 = 0;3 }$ e( _0 j9 Q% R) A, n
- dma_addr_t dmaphysdest1 = 0;
5 o8 J0 H* r: b3 m) x) t - dma_addr_t dmaphysdest2 = 0;9 L; A0 f2 Y, _4 z& X+ S$ b
* N8 v* u0 f: p; ~ J- char *dmabufsrc1 = NULL;
8 S0 F. s# A& X8 L8 J - char *dmabufsrc2 = NULL;5 B) y$ k/ B( m& Z
- char *dmabufdest1 = NULL;
! _8 g: k7 o6 z) Y4 i - char *dmabufdest2 = NULL;% f# p- Y! I5 a2 u/ s
- ( O* k4 I- y: G# q1 s
- static int acnt = 512;
8 H5 T# }2 h- E - static int bcnt = 8;
- ?- _3 N- Q" L - static int ccnt = 8;
5 x- M+ L' T0 T. x- \: U - 5 ?$ \6 R4 J4 T$ M2 p! S+ t
- module_param(acnt, int, S_IRUGO);
- W6 r/ n. n4 S5 d0 i, \. x - module_param(bcnt, int, S_IRUGO);
; e7 q/ D& t2 W& ~/ O! n: I- P - module_param(ccnt, int, S_IRUGO);
复制代码
- e3 D5 {8 Z) A5 m! e( a; G( q' b! Z! V, Y$ E9 k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 y" G: j: y* z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ n' y4 e1 _- I, e6 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 _' w! ~( K& N& b* u, m. @- X8 K
# T3 k) f9 K9 I |
|