|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
w+ o* k& y! _# p0 W* m* Q, ~- [code]EDMA sample test application
+ G, a' n! m1 L4 M. V - /*
$ Z( w8 F2 A. M/ ]. z - * edma_test.c$ `1 M) y; @$ o, i4 [
- *
) r- \0 H2 a8 d3 F# C - * brief EDMA3 Test Application$ s- p v& f1 @
- * z* Z' c6 o" e; a
- * This file contains EDMA3 Test code.5 m$ Q( U7 C' i# g
- ** G1 r3 K5 h) M2 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ I; t' Y8 M" v# ]; | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. _7 D; c' c' R$ M- a3 g& f - * TO CHANGE.
! y5 q6 j5 ]5 @' m" Y" d3 _ - *
2 M; f8 E$ H' N: } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 }1 n1 }/ B7 P! e
- *1 z0 I2 }3 Z& ?5 U F
- * This program is free software; you can redistribute it and/or
8 _/ \1 D. T4 S( M! S7 R% z+ o - * modify it under the terms of the GNU General Public License as# t7 I; P; k' e1 l( e, b
- * published by the Free Software Foundation version 2.* A0 a" N( y/ M8 Q4 T6 O4 j
- *3 I. e3 p& U9 O! {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% w$ W3 @! O" g8 U7 K
- * kind, whether express or implied; without even the implied warranty
/ ]$ D' ~0 U- g. s" Y0 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ ]) M5 K# ~; O5 b6 F - * GNU General Public License for more details.2 r& M j2 I* J7 r2 n$ T7 }" N
- */9 ]- u* C5 s. Z3 p
- 7 }$ |& u# b/ `3 ?7 W1 y% N4 g
- #include <linux/module.h>
" p% z! k% E/ G8 z - #include <linux/init.h> }' p; v' d# s8 ^
- #include <linux/errno.h>
/ @; ^: U% ^7 [+ [% R9 d$ |* w - #include <linux/types.h>) j( {- _3 s4 l9 [0 z5 v0 \
- #include <linux/interrupt.h>' J8 P5 @* k& I
- #include <asm/io.h>
# o$ p0 W7 Z* p: ~ - #include <linux/moduleparam.h>
' T; b" b1 j: Q9 n6 t - #include <linux/sysctl.h>
4 ]# Q" `4 M6 v2 [9 g0 @4 N - #include <linux/mm.h>
" X8 p p, Z u! G9 o; h& | _+ k - #include <linux/dma-mapping.h># G0 i [! }; g
( L2 z; V% m% ]& E3 I' a/ N' B2 q, X- #include <mach/memory.h>
3 Y& h, ~! ]0 J. S/ b - #include <mach/hardware.h>' l/ W1 D* \8 V- [ A# @8 s
- #include <mach/irqs.h>$ g! i+ }& c5 b
- #include <asm/hardware/edma.h>. o2 _0 ~7 p; [7 E& N; _6 K
! Z5 W& B M v/ |" {" {$ B6 K, G- #undef EDMA3_DEBUG3 s; C; y' B; K3 N0 ~
- /*#define EDMA3_DEBUG*/
5 t3 O0 n3 e; D
6 A9 ?8 j# H; c/ }: _; X$ i2 c2 b- #ifdef EDMA3_DEBUG r2 F E' L8 l5 ]; E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 x& X5 O; v1 w2 m6 B3 A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 f& r4 s8 e# l3 x0 [4 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 j, y3 _, K1 X0 U x - #else
: w& Z2 Y5 }/ i; z3 s3 I0 L - #define DMA_PRINTK( x... )
, Y y( r' J: {( V+ m3 P' @, V6 d4 m5 N - #define DMA_FN_IN
}- M- L( b) K - #define DMA_FN_OUT4 j. O. E: Q2 R1 m. n
- #endif
- x) ]8 d7 K' M9 e }& @0 e - % ]/ a1 s1 w1 g; k: P( S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ B, O( B4 H& e' E
- #define STATIC_SHIFT 3
' ~* q* n2 `/ l( p5 v# _+ f9 S - #define TCINTEN_SHIFT 200 i. Z; U/ m" N
- #define ITCINTEN_SHIFT 21/ u+ A$ X( _' h8 u q8 e7 C
- #define TCCHEN_SHIFT 22: G3 V- p/ P; e- W
- #define ITCCHEN_SHIFT 23) |+ B. b* \) b, j7 H7 L) T
- & k5 \& o8 a2 B8 V
- static volatile int irqraised1 = 0;3 P( E7 T( n1 W0 a) c
- static volatile int irqraised2 = 0;! q7 u; H. N% e
# O& P" n. C* e$ k' G; s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! b. q' L1 i- {- Y- `; A$ M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 k# D X' P. _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 v4 P" Y6 Z8 M) Y) m
- 2 N3 j: Y' t- e/ `3 C
- dma_addr_t dmaphyssrc1 = 0;: A( f, j: Y [4 i5 X/ j
- dma_addr_t dmaphyssrc2 = 0;" i0 A' h, U0 U* U" `- w
- dma_addr_t dmaphysdest1 = 0;/ D5 |+ s* {; F' }4 Z. W( Q
- dma_addr_t dmaphysdest2 = 0;, B9 `! J% K; T+ L
# y% S0 C0 ~' b- i- char *dmabufsrc1 = NULL;
9 N K4 W6 M# @& I. ` - char *dmabufsrc2 = NULL;2 x* Z! [7 w; ], C9 ~ y
- char *dmabufdest1 = NULL;6 Q: q5 f- E z* b3 Q9 ~. f
- char *dmabufdest2 = NULL;. Q4 j' M% t* L' V6 l. B
+ W( t( P8 V( |5 }- static int acnt = 512;; Y" G# e8 X& i6 i) ^
- static int bcnt = 8;3 h- p7 f1 e0 n A, ^' {# b4 W
- static int ccnt = 8;. o3 o, c9 o* f7 ?9 @7 q
- \, i3 p" l2 [! B: ~
- module_param(acnt, int, S_IRUGO);3 A7 D# y: X# X3 D
- module_param(bcnt, int, S_IRUGO);; t; w6 G' A# m/ i
- module_param(ccnt, int, S_IRUGO);
复制代码
4 h1 _0 B9 E, B0 B h! \: c+ c+ t. c) A8 {9 h6 E; M$ M* m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- Z; Z* _# p. Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: D1 x$ X4 n. i6 Y% k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- R% d. M& Q- l+ A2 T+ s
8 O F* r$ Q! } j% g
1 f4 L- `. l; E# c. U0 J# F, y
|
|