|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + w G' {, Z* F6 }1 `" ^1 x2 X% ?
- [code]EDMA sample test application2 k, ~- U9 u- @4 e) V# s1 F
- /*
4 t3 Q- @' ~% W0 c4 ]1 k* s - * edma_test.c
1 N) y7 U$ O# K1 |0 T - *
J! Y$ r3 O! \' }2 ?" y - * brief EDMA3 Test Application# u: F* V& d/ j( @
- *. y+ v, z& l. O* t- p
- * This file contains EDMA3 Test code.
% |3 M5 X8 ^3 Z" H: S - *
, S6 l H5 d7 }% R8 ^+ y2 Z+ V, \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" w. o) _) U0 B; f0 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 S$ p# c% E& u/ T. x7 ? - * TO CHANGE.
, ~: L* @( o' ^8 H - *
6 U- E0 Z+ R% s% J: U# i3 j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% R0 r- a) \6 g8 P+ \
- *
6 x- t* D' ^% E( P5 I' Y: Z - * This program is free software; you can redistribute it and/or: S& X5 V- A( ]! T2 ~
- * modify it under the terms of the GNU General Public License as
% ~& \, [9 @) l7 c" F - * published by the Free Software Foundation version 2.* i' k& T- p7 ~
- *
# b# f& ~* z( } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- b+ G4 S$ }* |
- * kind, whether express or implied; without even the implied warranty% r) n$ o" K8 V r0 ?5 R& f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 n' @; C' X& N4 M" u5 m0 b - * GNU General Public License for more details.0 D, `4 X1 @/ `( L
- */
a" T" `, g! [: N, D$ l - 9 m2 ^( T0 B! T1 Q2 M+ h' d) v
- #include <linux/module.h>
( c+ e" c) Y. @! B% g6 } - #include <linux/init.h>
) y9 N5 A# T( p; d - #include <linux/errno.h>
3 N9 `0 E [. m3 @$ { - #include <linux/types.h>
3 k1 X ]8 |6 F8 [# @- E3 m - #include <linux/interrupt.h>
3 g2 f+ h+ C. O7 @' @ - #include <asm/io.h>+ G+ m& J8 g4 G+ k% e
- #include <linux/moduleparam.h>" |8 f0 [" J& T8 K' B! L
- #include <linux/sysctl.h>
6 Z* u; L; {- r' z% `8 m. _- H6 r- L - #include <linux/mm.h>$ ?) t7 p7 i2 l: I- i: E
- #include <linux/dma-mapping.h>
$ ^# K& b$ c0 w; u( c6 K - " Z/ E4 k! w7 r1 T9 j
- #include <mach/memory.h> K+ ?9 r% x. m6 q
- #include <mach/hardware.h>2 [, O2 z8 K) C* q' q
- #include <mach/irqs.h>1 I1 D2 t- C% {1 b! q0 w: H5 V- k% V
- #include <asm/hardware/edma.h>
3 I, v* ~2 F- E1 l1 }0 l
% T/ u3 j# K0 `% f$ J" q0 @+ A- #undef EDMA3_DEBUG
0 m8 L) H- @* O7 y5 t - /*#define EDMA3_DEBUG*/( F4 x, X6 E; e% ^
2 L0 \" n1 {) ^8 n( t- #ifdef EDMA3_DEBUG% Q, V6 |* V$ y, r) T7 y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 ?& S" F ]' i' ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. K0 b6 C: _% f' @3 _; l) C6 L8 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 q! y8 I& s7 M7 j
- #else
* F0 Q$ n: U& R: n0 i0 u - #define DMA_PRINTK( x... )
/ D5 ]) f# f$ N4 V( D+ a* ] - #define DMA_FN_IN( ^5 i! N2 ?: o0 z' f3 q! Y
- #define DMA_FN_OUT6 C' H; |3 d8 w2 f5 n) W& Y4 I, A
- #endif# [0 d8 L3 x; I# q3 H4 y2 h) U
- ! k! D u( L7 W1 p s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). X6 |: [3 @8 B( H' K& e1 i. u3 Q
- #define STATIC_SHIFT 3! h; F' H+ [5 C( }2 X+ g. o1 M
- #define TCINTEN_SHIFT 20
* d+ k# N1 _: |' b* A. Q* f+ g& p, [ - #define ITCINTEN_SHIFT 21
& E3 l& Y/ P9 p. W5 Y6 M! @ - #define TCCHEN_SHIFT 22
/ T: M: w, Z q! w- I. z* Q/ C - #define ITCCHEN_SHIFT 23
+ p2 D7 f5 H) z2 ^ - 2 @: {1 F, }) A% p. N% n
- static volatile int irqraised1 = 0;7 C% n& F+ y. y1 w1 l. y; Z
- static volatile int irqraised2 = 0;
$ E6 U- e3 K y7 q% C - " A) [- v; b7 W8 S' H' R i, e6 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 {4 s8 Y3 ?% g2 D! K! O! f, h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ T6 x7 O9 _+ a4 q0 c9 b6 w+ ~0 t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! _) }1 o0 v+ @5 F3 [$ a, }4 T& { - 7 u4 c! D4 v- V+ h
- dma_addr_t dmaphyssrc1 = 0;
0 f4 m( m2 m3 z- B/ o+ @5 j - dma_addr_t dmaphyssrc2 = 0;
* R9 |) D9 X# R' J, ~' b - dma_addr_t dmaphysdest1 = 0;
/ z$ C8 d# @( f1 M% L8 c' G - dma_addr_t dmaphysdest2 = 0;
. `7 ]4 d! n4 D2 m) S" v+ n
' h3 T' k- N$ m* m" n+ f I- x; ?- char *dmabufsrc1 = NULL;$ E5 e, N5 F- E; U9 d" B% Q
- char *dmabufsrc2 = NULL;
! u% V, e# Y9 @1 c/ Z - char *dmabufdest1 = NULL;
2 l& v t8 ~3 N3 B0 \ - char *dmabufdest2 = NULL;
" l( L0 K3 }2 E7 Y - 6 T9 c; y- ?% a. s
- static int acnt = 512;
7 \: Y/ a7 g1 t$ B- d/ V8 H- r5 m6 g - static int bcnt = 8;3 S7 ~' u" [& ]
- static int ccnt = 8;
6 I$ Z6 Z3 J2 ^+ P1 m+ f! s: w
( O8 _3 k0 f; e9 v w- module_param(acnt, int, S_IRUGO);
# Q# k2 ]2 V( c% G4 f6 s/ t. V - module_param(bcnt, int, S_IRUGO);
2 M3 r4 ^ @1 ^- d, a9 `# a d - module_param(ccnt, int, S_IRUGO);
复制代码
d) a) Q# e0 l* Z6 X' T; C! {7 K1 | g5 u: z' o8 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ]! u2 x) y o6 p" j, @. e1 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; k5 S' l, t" R% n7 z7 Q) \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 I/ x' m5 ]3 H$ M
* T' u+ n5 i4 @' _6 w1 c* F3 A* F
3 q8 B$ r% c! T" m+ K* \) s
|
|