|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- U3 L1 }# o: W3 v8 v- [code]EDMA sample test application
5 x$ O% _/ U9 a1 a$ K - /** g! V2 h+ R9 {* Z$ i
- * edma_test.c4 Z$ V5 \/ g% I. j; P# S" c
- *
4 a$ |6 h" B G, G" q - * brief EDMA3 Test Application3 t# Z" o1 k7 q) E* D& u
- *, j% U) T. A+ ]9 R) x( j
- * This file contains EDMA3 Test code.0 C: V2 h$ l0 p7 _( D
- *
. v) @1 }* W4 t8 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# |. d. I9 o3 Q, |( q t/ u# Z8 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ S' m9 `0 ^4 R
- * TO CHANGE.5 Q4 ^! m/ q4 R" j8 s0 c2 n. P6 O
- *8 U" Q- B/ I; v# b) G) R" W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ]( _0 G& K& k# A) F% N! m) m
- *' U1 q. T3 C( D
- * This program is free software; you can redistribute it and/or8 k T' o, E; ^+ z; q; ~5 H
- * modify it under the terms of the GNU General Public License as
?: z% A9 Q; b& i# d+ H# ~) C: r - * published by the Free Software Foundation version 2.
& ~! y" B. k, F; q - *
' B3 S# s# i8 t X2 F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# E- |3 K# Z P/ Q7 n0 L - * kind, whether express or implied; without even the implied warranty
* l8 `& V) f# s, _3 s+ h4 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 V' y# N9 L5 H6 E0 H
- * GNU General Public License for more details.
. _, n/ S/ x( V6 }6 N& k - */
/ ?; Y2 E! }0 F6 o9 {2 c- N' V
0 g6 J( l8 b' d% E3 c! z* ^- #include <linux/module.h>
( A* G5 S \" _. V - #include <linux/init.h>$ _7 a8 M* }+ T2 W
- #include <linux/errno.h>
. d3 n; n9 C9 t& J. M2 x9 y - #include <linux/types.h>6 [( @# {) n k+ }
- #include <linux/interrupt.h>
0 M+ h; }9 j) @. Q( ^9 @ - #include <asm/io.h>
7 i6 L1 q# Q6 l& f3 N ^5 T - #include <linux/moduleparam.h>$ m$ L2 X/ K: w+ m/ X
- #include <linux/sysctl.h>
' H# n( y) M v! ?+ f$ b - #include <linux/mm.h>" y9 f. ~& ~3 P4 ]/ S
- #include <linux/dma-mapping.h>; l# j) C; O. E7 I3 v$ T' [' V
0 p5 @- V/ O5 e- #include <mach/memory.h> ?0 D+ ]& t% n2 F
- #include <mach/hardware.h>
) E* U: x- O9 `2 {1 q- @2 i. r* N - #include <mach/irqs.h>' j) i$ g* _ w5 S# ^% ~
- #include <asm/hardware/edma.h>
; \5 a$ ]# D' g6 r; ]# k ]* Q
8 I9 k7 v) J* o% w5 B# R8 f- #undef EDMA3_DEBUG8 f5 t6 w4 O2 w' X
- /*#define EDMA3_DEBUG*/
8 X' @1 y: B9 K! ]" Z - 5 _0 E3 e* E' S" F& X! n
- #ifdef EDMA3_DEBUG+ a8 k- I3 [! B" D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* c0 e' ~$ ^+ M+ b9 z. g$ Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 {. [7 {; g9 i7 { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 o7 ]: \6 u3 z( b5 n- @( O" b - #else
; H7 ]* N" g, }. j( O - #define DMA_PRINTK( x... )
8 r& o0 J8 M' k3 ^ Y- {/ t - #define DMA_FN_IN/ u9 l* z: v: d7 y1 @0 L4 k
- #define DMA_FN_OUT7 L- ]7 n' U: [+ D. Y# U1 k
- #endif
9 f6 |0 f. m/ w9 A2 s) n - : O' \, p8 H/ R" e0 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
J- B2 h. t9 p - #define STATIC_SHIFT 3! H2 O( T, [+ Y# o! _
- #define TCINTEN_SHIFT 205 ~9 `, R+ I. L3 W
- #define ITCINTEN_SHIFT 21
! R1 Z: d! {- L2 V( A9 y - #define TCCHEN_SHIFT 22$ ]# x$ I9 I+ Z# ` W3 [( I4 _. I2 a
- #define ITCCHEN_SHIFT 235 N; v9 \% h2 \( M N
- * v9 E9 r# s$ M, Q1 g
- static volatile int irqraised1 = 0;" V, q7 O8 ^6 D
- static volatile int irqraised2 = 0;: w" h' l" q- ?) W
" R v) @' D9 J, W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, b: M0 c9 x( l3 @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
u5 f+ z. o& i4 L( m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: z2 W$ q; a5 r
- ; }) p: v* @' |3 }
- dma_addr_t dmaphyssrc1 = 0;
! Z3 V2 K# w9 g0 I4 T1 M- N - dma_addr_t dmaphyssrc2 = 0;! N$ R0 i/ x4 {( x6 y# Z
- dma_addr_t dmaphysdest1 = 0;
5 v; M/ e& }' I( i) \2 Q - dma_addr_t dmaphysdest2 = 0;
3 N1 v# v1 c6 f
6 T* ]" A) t6 q+ x4 r- char *dmabufsrc1 = NULL;
! y% M& H% L2 U. s, n& ~" a - char *dmabufsrc2 = NULL;# c' P' H) d& e3 d1 s
- char *dmabufdest1 = NULL;* X) e: W) S, }8 t4 O2 M$ j/ f
- char *dmabufdest2 = NULL;6 L3 {$ y6 D( D+ y2 M
- 9 y$ e8 j! `5 `9 ?- I2 t- M" n
- static int acnt = 512;
1 \; b% ~% J" c8 h8 S+ N/ b - static int bcnt = 8;" b1 r, r# `3 x" j* ?
- static int ccnt = 8;
" S4 p4 _+ a3 |, q5 V
: Z/ Q1 U' q! w5 b$ A1 m- module_param(acnt, int, S_IRUGO);( \ l2 C/ u' j6 k
- module_param(bcnt, int, S_IRUGO);' _! V( J. T6 Q- B, \( K- Z+ t
- module_param(ccnt, int, S_IRUGO);
复制代码
' J Z( V* u$ t3 v& y
9 y, ?5 y! N; e3 m* P+ g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 h; E* U4 o) |( |7 ~* A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) {: Y9 K, T3 k4 K* e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# T8 {: u2 G& O1 ]" x) _0 u2 J/ E P6 d
# q3 s# g/ o' O/ l
|
|