|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Y; E3 R7 l# U* p# L/ x- [code]EDMA sample test application
6 }' } |7 C! N: f6 s T2 I - /*/ u: }1 u: t5 {' l" b+ @+ V
- * edma_test.c
* M; ~4 R* j/ x- }+ p - *
9 `( O( K ?# N+ m# V" r4 ] - * brief EDMA3 Test Application; J# U& V' _" Z9 W% @4 Q
- *
3 k4 }- W( @. j/ y5 `' O3 I - * This file contains EDMA3 Test code.
) z! b9 K' I1 m! E9 M - *5 ^. T) O7 w! }% g& G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. h3 D1 Q; d+ I: l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 x E4 f! v5 I* j* P! ? - * TO CHANGE.8 }3 B1 e9 [- q. T2 C5 M1 y) U
- *. H, W/ w0 A h0 I0 `& t* L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" Y L. _( Z5 B# F3 i$ Y3 o# \# @: { - *
9 O& [* w1 ]" R) T Q$ q1 q) N - * This program is free software; you can redistribute it and/or1 s* ~3 ?, E- A
- * modify it under the terms of the GNU General Public License as
9 E3 F8 Z$ A6 K' [ - * published by the Free Software Foundation version 2.
* V9 [4 p9 N# o4 U - *
' {! Z& U$ o0 @/ f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, c9 E% E# |, v+ f$ A8 ~& B' P( A
- * kind, whether express or implied; without even the implied warranty
! H, D3 ]0 e8 k" q4 N5 [ N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. d: ^+ n0 [7 ?; ?* ~+ m3 c+ \9 E
- * GNU General Public License for more details.
# [/ p u6 k- b1 `7 B" O8 @ - */# [6 n2 n) F- g: H, x; D3 i
/ m/ f0 W" V0 s1 b& A! X' ?' w: ~0 C- #include <linux/module.h>) m) v5 [& v0 Y4 j" V+ S# W
- #include <linux/init.h>
4 h Y w$ F: M3 Z+ F, M q3 W - #include <linux/errno.h>4 c7 Z2 w6 l* L, m" U
- #include <linux/types.h>( d3 k2 D! Q8 Q5 z1 ]- S/ C1 H5 I4 l/ [
- #include <linux/interrupt.h>
& k7 W- E1 v6 L/ E/ l+ l - #include <asm/io.h>
) r3 ]! G# \6 _/ D/ p8 N- i - #include <linux/moduleparam.h>) }; J# N: G2 m: `
- #include <linux/sysctl.h>: M. p3 x6 L3 x
- #include <linux/mm.h>8 A N! c6 _) v5 j1 E" Y! X1 ] c
- #include <linux/dma-mapping.h>+ t1 g. [$ \8 `$ M4 K6 ^2 g
- ; v# \1 E( K, I% [2 i: n% u8 |: V1 ?
- #include <mach/memory.h>; ~' |2 [, H: V: M- L% D0 J6 V
- #include <mach/hardware.h>
5 V, l9 ]1 Y0 g2 |* N) U8 e - #include <mach/irqs.h>) S8 B w* T; ~) l5 p
- #include <asm/hardware/edma.h>: ?" D6 A9 T* f2 U# g3 n
- ; M7 T5 d3 i3 a& V; N
- #undef EDMA3_DEBUG
8 K$ `/ n4 M" D2 u z - /*#define EDMA3_DEBUG*/) ^6 z5 Q) v3 w, J3 y% B* U5 u
# W, f9 a1 a0 P1 \- #ifdef EDMA3_DEBUG
7 ^- V8 F. J' d, p# o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* g& ?5 B% Z2 K/ C6 c9 K1 f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- ]. f2 R p$ I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 {1 r0 L( o" `' j% ]
- #else, L" @0 w. J" K% f' Z
- #define DMA_PRINTK( x... )
6 g; V0 m' \2 k9 M' E7 D8 }% L - #define DMA_FN_IN7 y1 L* |9 `- ~* R9 d2 v* g7 T
- #define DMA_FN_OUT- }! b; V. p: g9 @# W7 P/ A
- #endif
9 w2 z+ f* H; a5 u6 r* V" {% X% |6 w: h - . V% k" K" A2 b3 M$ p3 q( [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 n6 W0 k/ y/ k8 y2 z: R. l* F - #define STATIC_SHIFT 34 I' \7 z6 S/ l9 F4 h5 e* [
- #define TCINTEN_SHIFT 20( [1 n" V9 y; r6 j- Y$ `7 P
- #define ITCINTEN_SHIFT 215 Z9 k0 f3 u$ b4 }, n- F b8 _
- #define TCCHEN_SHIFT 22
" y3 \! R0 f1 U7 e; K - #define ITCCHEN_SHIFT 23
8 n. f6 E0 ?. [7 _- E# y9 T/ L - + ~- g& x3 E+ e& ]' t
- static volatile int irqraised1 = 0;' W- S* A" H' R; U$ @, Y6 R
- static volatile int irqraised2 = 0;' ~$ N" D8 l0 _8 D$ A
- : g5 m2 v7 Q6 m0 m( Z% J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* X/ e2 k0 d# ]' q/ Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 }$ Y0 P! Z* G& z0 f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 t# `# b9 t' f& g2 S
' ?0 `& B4 G5 h( _" L: c; _- dma_addr_t dmaphyssrc1 = 0;+ S% y, B: S1 c( Y6 W8 ^
- dma_addr_t dmaphyssrc2 = 0;* q2 g% m7 v) H8 Q1 [
- dma_addr_t dmaphysdest1 = 0;
8 t+ C- m; M X6 o% q - dma_addr_t dmaphysdest2 = 0;
" w3 E, b2 q: d) k: z7 Z. Y - - ~& X3 h5 n. j, L8 g6 h
- char *dmabufsrc1 = NULL;
3 [# x: r- t7 U+ j3 T0 r - char *dmabufsrc2 = NULL;
0 ^4 [/ G& t- ?3 D9 p - char *dmabufdest1 = NULL;
5 N. ^- I. ?- u! [0 r- U - char *dmabufdest2 = NULL;, ]* u- b: ~4 k5 b' s7 c
- $ q$ E, m% M0 ] \/ h3 v
- static int acnt = 512;
" V6 l o3 S, t# e: j5 p' X9 z - static int bcnt = 8;" Z+ w' k. y' t6 L# d, E
- static int ccnt = 8;
7 ^/ j3 h8 |, H1 v! t7 j) v- ~ - : U' |4 e0 e5 c% e+ M$ x5 u
- module_param(acnt, int, S_IRUGO);
$ ^3 |6 L4 ], H" l - module_param(bcnt, int, S_IRUGO);% m7 @7 X" M1 }* M, ^) v
- module_param(ccnt, int, S_IRUGO);
复制代码 # I' F7 p. g# l+ W9 U5 D: i
) m: E7 }6 R9 a8 |) ?$ ]; G8 [1 _7 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. n' j& e% O3 {( K4 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 t7 @2 [, ^3 v) L H n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; F1 B6 i3 D% J# e* Y9 N$ o. t; Z! ]
! m L- B! W) c; D# ~" K5 f7 ~/ U! I5 |# [- W
|
|