|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 z6 F" g, @, p& U; I- [code]EDMA sample test application
& b6 {" b6 E/ e) S - /*" u% u$ M! t3 _, D. b$ f
- * edma_test.c! Y4 {5 T0 ?& R' @; b# S9 T
- *6 B9 {: [$ v! \
- * brief EDMA3 Test Application' A) ~" ^2 m. M
- *
3 v8 {% p- l% `" }: m2 X - * This file contains EDMA3 Test code.
7 d7 p Q3 q- I, |+ q& q7 i - *9 C) a1 | h8 W. Y) \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% k0 G# D5 h9 U! `4 @# f7 K- i# ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) U$ G% G3 P- e& o4 B3 I C+ Q( y3 I4 [
- * TO CHANGE.
# j) Z, M% ~2 ? - *
- q4 d- O0 z, Y( e* K" Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 x0 V' i1 V/ B+ ^7 C5 a8 m7 L
- *
5 G6 d4 F9 p1 ? - * This program is free software; you can redistribute it and/or8 t' S9 \* y0 V9 Y
- * modify it under the terms of the GNU General Public License as
9 k; m3 m/ T/ k" H/ m |" Z - * published by the Free Software Foundation version 2.1 N5 ^* w# u. O& e Q6 _; J+ M) B
- *! R4 \6 L& _/ f. f+ g: {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- j [# N4 g1 Q' Z- d' m - * kind, whether express or implied; without even the implied warranty2 C2 _. |5 r3 e. f& _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
A! Y& u7 C0 L - * GNU General Public License for more details.: m. i0 t* V5 u
- */4 v3 P3 n( |/ X' X3 n: v# v$ Q9 W
1 v4 Y: V8 ^- l- #include <linux/module.h>6 s; v, X0 Z3 n2 K; K
- #include <linux/init.h>
) N' g2 _3 c4 D% [ i. i - #include <linux/errno.h>
/ F7 I5 {' {* K" `! G - #include <linux/types.h>
3 D0 U7 z0 B5 _" o. E - #include <linux/interrupt.h> r% B4 f; X/ D; J$ _
- #include <asm/io.h>
/ U8 e- J& P! ~/ @6 f' n - #include <linux/moduleparam.h>9 Y* M; w. A1 j! X# Q
- #include <linux/sysctl.h>
3 b3 m& U4 x" I" A# p+ t - #include <linux/mm.h>! C# g* V5 K L- p: D5 e
- #include <linux/dma-mapping.h>8 ^. u' ^, |0 m: N! r5 v0 Y+ {
- 0 y7 r0 V' T( j6 w
- #include <mach/memory.h>4 m) D) ~6 ^: u- J7 q6 L) k
- #include <mach/hardware.h>/ C7 z' M8 f0 C& Z, g8 |
- #include <mach/irqs.h>/ f; [1 Q# _: h7 r5 M0 p( L
- #include <asm/hardware/edma.h>
8 o c: M5 I( q+ I - " M% {4 W6 e6 }( i/ {
- #undef EDMA3_DEBUG' r9 B. {' e2 P2 M3 x! ?
- /*#define EDMA3_DEBUG*/
4 [4 B( e* |4 }; ]* j* r* L - 7 R$ E r! @3 O! J9 H% p& R
- #ifdef EDMA3_DEBUG
9 {% P1 ]$ K- \/ A0 d+ n1 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% q# L4 j" L* n) Q. M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ ?8 ~: [9 \# \4 l; q# h; T5 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ S- }, p i1 u* x1 A1 R
- #else
" h3 o1 W9 X7 J$ O - #define DMA_PRINTK( x... ). R! O, X' H& i$ _/ p$ V
- #define DMA_FN_IN
! a5 W4 ^. m% t( H& k5 v( y - #define DMA_FN_OUT
' }+ W, \( _1 G( R - #endif# d6 ?: A3 t$ z7 l/ K0 O$ G
- ( j a: p: [: g2 O% B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ c9 V' X7 F( x- i: p/ U
- #define STATIC_SHIFT 3
4 B3 O2 H6 Q1 C- |4 K' I - #define TCINTEN_SHIFT 202 [ H8 _9 q, ]1 c7 L0 O3 x
- #define ITCINTEN_SHIFT 21
6 Z0 y, c$ \, B7 n - #define TCCHEN_SHIFT 224 R8 ~& f, I7 c8 D a2 @
- #define ITCCHEN_SHIFT 23) F% y+ Z$ [1 a% Z" l; _
5 ~+ c5 a7 P/ m3 W( H* D- static volatile int irqraised1 = 0;( ^- w1 t- Y: t5 J/ h
- static volatile int irqraised2 = 0;
: w8 ?* n7 W' y2 ^, g- I- d s
+ f! p! I' k8 r. K5 v c7 t K. M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# |& K8 b* G( A! c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ]# ]. p1 y( F d" \$ S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E! z6 k5 ?2 J, F5 v8 `
- 2 R: d' l) e/ y. B: N2 B; ^
- dma_addr_t dmaphyssrc1 = 0;
$ i/ @# t1 t/ S! r - dma_addr_t dmaphyssrc2 = 0;/ ]' B7 K! }/ ~8 `$ P5 p# c
- dma_addr_t dmaphysdest1 = 0;
# Z' n$ G# K2 ? - dma_addr_t dmaphysdest2 = 0;1 m4 h+ B# ~6 x
; ]' H L/ g( O, b% x+ s- char *dmabufsrc1 = NULL;& D* ]4 r/ H* F( X7 X. a! E
- char *dmabufsrc2 = NULL;- ]- Y0 _7 t L# [ t" V) H
- char *dmabufdest1 = NULL;! w! Z6 f7 R" `, a
- char *dmabufdest2 = NULL;
8 _4 x$ \( G7 E: T- p( V
3 a: J/ @9 P- ]4 a5 i$ ]! I- static int acnt = 512;1 o& J; _& c9 G/ ^
- static int bcnt = 8;3 ]: r9 D5 B" [1 k
- static int ccnt = 8;
' R# d4 X. T' ?' p+ c - * G) _( f4 P# H& z
- module_param(acnt, int, S_IRUGO);
" ~+ s+ b* k' A% J V' ? - module_param(bcnt, int, S_IRUGO);+ a7 h; F( R: f& a: Q2 L: w
- module_param(ccnt, int, S_IRUGO);
复制代码 8 A8 K; D- B1 v* y4 d% k
7 c; g: J) D. J$ s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) ~- B4 R" G7 P0 V- o; @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ T8 }' i8 N# }' [0 V: K* f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; w" G* {5 ?/ M8 y
+ U5 ?. S1 ?- R+ `4 l
" {2 u) c1 x; b) G' [# p1 _ |
|