|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& f* B6 y- B6 q. W! r- b# c- [code]EDMA sample test application+ F' m( s, h5 v" H
- /** B( J" z+ z2 [# ]
- * edma_test.c3 [( H' _ d! O4 v! T3 ^6 i: ]
- *2 w3 ~: T9 b5 B
- * brief EDMA3 Test Application/ O! a9 \7 x3 ~' O; }- o$ K4 L
- *; E) V2 U/ S7 h. l
- * This file contains EDMA3 Test code.5 F; b2 Q ?0 x) p$ L5 W; S4 R, b
- *. n8 @$ q# V# O5 a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 @1 P- `4 X, J9 l8 Z% |" Z, U6 g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. K# W, c, j5 i% I0 {& U" n - * TO CHANGE.
! P0 x$ u" A/ y2 q' [9 f6 i: E - *$ g. ~, x' c8 q; ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; T; ~1 j8 ]) }3 l- N9 U - *# p8 k. e7 s Y
- * This program is free software; you can redistribute it and/or
- {) f5 Q0 P; H1 z - * modify it under the terms of the GNU General Public License as
9 v! a8 Y/ c9 M( y1 ^5 N: l$ g - * published by the Free Software Foundation version 2.0 n, j' {. j# N8 ^2 D8 \6 l4 a
- *3 S, q; a9 \4 R- t, x1 H {3 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& x% j/ J; D# E" I2 I - * kind, whether express or implied; without even the implied warranty" G3 e* E' _5 J# e: X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. Z4 g7 K0 C1 \/ G+ j( B6 i
- * GNU General Public License for more details.
. v, F5 p5 A. ]3 c( H! M - */# l T6 U; G1 {% ]
. G) M# g/ b7 F" P- #include <linux/module.h>; |, N6 o7 F1 \3 x0 [6 M
- #include <linux/init.h>/ D, n* D5 T& P& }7 s
- #include <linux/errno.h>! P$ u/ g: K2 @
- #include <linux/types.h># z3 _8 O$ T: X# l2 E: W
- #include <linux/interrupt.h>( R" y) O. {4 I6 k8 i8 |
- #include <asm/io.h>. Q B; w6 j4 N- _4 _1 M
- #include <linux/moduleparam.h># K# X/ k1 t" G" [' u
- #include <linux/sysctl.h>
4 y7 K+ m' o9 {$ d - #include <linux/mm.h>
$ L3 a8 ~) ~# I% h' E [4 i8 k7 ^ - #include <linux/dma-mapping.h>/ E3 B% Z% R& B s, d) T3 q( ?
- I3 a; ~0 O* O) V- #include <mach/memory.h>. L* P, K3 h' @/ e( p- p
- #include <mach/hardware.h>
) r3 W! h2 r, O/ D$ n, K - #include <mach/irqs.h>
2 |0 @+ u% S$ w0 |' F; f$ _ - #include <asm/hardware/edma.h>8 b0 ?1 c: z. N4 M( ~
- 5 V7 l3 q: _/ u. |2 T
- #undef EDMA3_DEBUG$ Y1 f! Z# p C% C( e
- /*#define EDMA3_DEBUG*/
. T; k. s; ]3 Z1 }/ W) { - 1 D( u: E# ~# z: u4 C. b+ p
- #ifdef EDMA3_DEBUG
/ B) r z' O R. A3 V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) W: I$ y) l$ B; d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ u9 A, G; C" M. m$ L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( h0 q9 v4 s; y4 W+ R9 _& x, Q - #else5 H6 ?) R* n+ T9 G, Z* Q% B2 V2 _
- #define DMA_PRINTK( x... ), Y5 H Y3 h: F
- #define DMA_FN_IN2 f" U) H6 `8 R4 T3 i
- #define DMA_FN_OUT1 r }: K! _; Y- Y6 W4 C8 R
- #endif
! e) I2 s) D' v6 w3 h1 C2 d - & l- D2 L* ?! @% J2 t* _5 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 ?) z) X! E6 G - #define STATIC_SHIFT 34 E( d- f: m; k/ A
- #define TCINTEN_SHIFT 208 a7 w3 u0 ^6 n! J6 _+ _1 x9 _
- #define ITCINTEN_SHIFT 21* n9 }6 N* w2 K7 J
- #define TCCHEN_SHIFT 22
0 H4 ]0 }$ @3 Y - #define ITCCHEN_SHIFT 23( g. N8 i& ?- l3 v
- t5 E; v5 U3 q& S& ^+ O& F
- static volatile int irqraised1 = 0;
. D8 c- _* _+ ~- v# M; c+ J& u - static volatile int irqraised2 = 0;
1 f. @2 g3 `. U
1 {2 n1 R* I* A( Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% O- u/ ?' J5 A: g4 e* z* G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 x7 X! }; ?5 `. T2 |. q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 G# V+ M" Y' @0 W9 }, f
0 ~8 q8 y8 v1 R- dma_addr_t dmaphyssrc1 = 0;
5 G5 Y; c- W1 Q3 W" w$ X8 r - dma_addr_t dmaphyssrc2 = 0;
, {: W/ l, Z0 X. o w- U) v - dma_addr_t dmaphysdest1 = 0;( j; D2 `$ h# }& s
- dma_addr_t dmaphysdest2 = 0;" P3 [, h! `+ R# m) l) N' {
+ ~" ]/ n4 y" p! a- I/ H, L1 T- char *dmabufsrc1 = NULL;
6 |. ]5 b9 ^0 a3 n' Y' v6 i9 h - char *dmabufsrc2 = NULL;4 l. T$ t1 q0 ^3 [0 w
- char *dmabufdest1 = NULL;6 _' A7 b g5 ^0 G' P# C" m
- char *dmabufdest2 = NULL;3 W- |. w, p2 z9 J. Q
- 4 G/ [+ y& X' `5 g; D1 R9 Z
- static int acnt = 512;1 f& W F) q; m/ t! v2 [; R, T* f
- static int bcnt = 8;
) v7 m/ b/ {4 R - static int ccnt = 8;% O6 E2 H, Q7 Z6 q& e
- 9 p$ C+ N, W5 [
- module_param(acnt, int, S_IRUGO);4 [' ]0 T! U" o+ N; K: `
- module_param(bcnt, int, S_IRUGO);0 |, Q$ I# y7 c# I+ m
- module_param(ccnt, int, S_IRUGO);
复制代码
- o# C+ r: q, T6 \: n' Q! [$ I
" e) k1 s. Z0 K% [) S7 e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# E, f& L! w4 b, c8 ?/ H! Q% Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) e) E4 R$ D" [ o# w) d7 Z+ Y' o3 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 O2 D& S4 G j/ {' z/ U- K) V Q% W' @& s
: s3 E% E. [+ @% X |
|