|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- f* o8 Q( Y7 W7 u2 |! G- [code]EDMA sample test application
- L% h* E% w9 K1 z$ W - /*( a; s s! L. N" G+ J- f0 V
- * edma_test.c
/ `5 r$ i0 u; M# j: I) A! z) J& g - *
. N, g2 c! P0 i+ Q - * brief EDMA3 Test Application
" f8 p! I( E7 p1 `; X - *3 x0 h# H# X. V, ?% F
- * This file contains EDMA3 Test code.
( n2 V" \7 w8 p$ l- z - *+ d% N( j* E v# i9 e" R4 a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! s. W2 b# k! |4 c) U& d `4 W5 j9 P* C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 X$ c/ U# \* ^7 e6 E8 d4 P
- * TO CHANGE.: j. v3 M" J! l x6 U7 w6 I
- *" ?! v: x% S: F- Q3 m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# ]' T- w# R' w9 t" E - *
6 V- n. w( C' h# c - * This program is free software; you can redistribute it and/or
0 O, N) P# u* h7 I - * modify it under the terms of the GNU General Public License as
4 U8 J. ?. D A) f - * published by the Free Software Foundation version 2.
* L# s+ n" v; G - *
' v5 D% e' l9 u& d4 u9 j6 _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* t- w7 Z( P8 t$ Q; b - * kind, whether express or implied; without even the implied warranty; z, a- k. \( W: D+ P' s5 x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 `. C$ h; o9 A( h - * GNU General Public License for more details.) ]! A. I6 u: B# @( w% p% n
- */
/ y% ~" p$ [) _0 S, t. f
: Y4 G8 j, z( `4 w) \. @- #include <linux/module.h>
: T+ B, l8 E5 g; |' U, N: Z& \ - #include <linux/init.h>
% v, G$ }% I/ h! b& @ - #include <linux/errno.h>
% j' _$ x( }* s - #include <linux/types.h>
6 _0 O. ?, F6 u+ C3 Q6 t - #include <linux/interrupt.h>
: I5 h! ^ W5 ^* ]5 ] - #include <asm/io.h>
, k# J' g; d: \9 Z - #include <linux/moduleparam.h>
4 E( b4 |" b- M2 M - #include <linux/sysctl.h>
+ { e# Y6 N2 s9 Z2 U4 F" s* E - #include <linux/mm.h>
& m# O7 h/ \, s& R: b/ o - #include <linux/dma-mapping.h>
) a5 |6 L+ T" z1 |7 ]2 @9 l8 ?
# ^* _5 k& n9 ?4 x5 P* Z, K- #include <mach/memory.h>
8 a7 M D" x/ r2 B" G1 } - #include <mach/hardware.h>
f7 o! G9 G( E3 _ - #include <mach/irqs.h>5 w B9 I! V0 Q @
- #include <asm/hardware/edma.h>
$ M- Z/ p! d0 w2 i( p2 G - - j. G; K$ m- i3 n
- #undef EDMA3_DEBUG# h$ v* e! W3 [, T% E+ N: L
- /*#define EDMA3_DEBUG*/
/ ^6 f1 t2 e: b* U7 J) y2 \1 v - 3 D6 {' W. x4 }; N' ]
- #ifdef EDMA3_DEBUG# q- G7 y4 ]0 f: I; T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 g. w" E8 x V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# y% q" R+ z: U$ d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, z* j$ g E5 i$ U - #else
7 d6 T1 r' t" I8 z - #define DMA_PRINTK( x... )
. C' W5 o5 W3 ]/ b+ X% Q' X( n8 ~ - #define DMA_FN_IN
) t- x+ a& x2 l - #define DMA_FN_OUT
! X2 Q4 N4 K2 ` l9 p% L( X" m6 [6 h - #endif
0 N4 O; \4 O2 L) a3 Y1 h
# ^2 q+ c" z/ [3 K: T/ Z4 K L$ S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 T3 u0 a5 J5 G, c2 f - #define STATIC_SHIFT 3! N9 Q. P, z& h2 a" @
- #define TCINTEN_SHIFT 20* d; o8 A+ j* H+ @
- #define ITCINTEN_SHIFT 21
# B/ m) o6 @) `& | - #define TCCHEN_SHIFT 22/ S! P' X' Y r, p' V N
- #define ITCCHEN_SHIFT 230 S. f+ k1 w7 Q Q+ A
8 g v+ T3 H+ M' n2 u- static volatile int irqraised1 = 0;* c$ Y, U! K9 T; l* j$ s" t
- static volatile int irqraised2 = 0;: A, l7 B7 a5 F1 v4 ]
9 m0 }0 }9 {1 O8 f. j! U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# t* ]" `$ o6 ]" \# q+ J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ {4 M& A; ?: O* T8 M/ U+ H5 r( F/ G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) n& w' l+ q+ r: [, o
+ T9 l/ |$ V5 A0 {7 X, A: S8 p- dma_addr_t dmaphyssrc1 = 0;. `" T5 R3 \& X" B" x, S) d
- dma_addr_t dmaphyssrc2 = 0;8 `2 q0 h8 D( H5 s
- dma_addr_t dmaphysdest1 = 0;
" G6 K. W* i+ ~$ ]$ Y& b - dma_addr_t dmaphysdest2 = 0;$ ]( |: `" |4 _& x- W- |
- 7 ]9 d, c' u% W. z; C1 x
- char *dmabufsrc1 = NULL;" M8 G3 [5 j1 N
- char *dmabufsrc2 = NULL;
7 e4 M* k0 }$ E* n- p3 o1 v/ }& o - char *dmabufdest1 = NULL;
0 Q8 p/ e; \# Y6 \' y' Q - char *dmabufdest2 = NULL;" k5 n# }1 T5 r: e I: C6 @8 C) A
- 2 q" i8 h/ `3 i4 o$ m# M. F
- static int acnt = 512;
& c7 c( Z6 O4 ?/ A2 [ - static int bcnt = 8;
% ]* T) {8 ~! d+ E - static int ccnt = 8;
, v; I3 d0 B" }2 g7 }& Q. w: A
; @+ k- E% o9 o- module_param(acnt, int, S_IRUGO);
4 R1 J" {, B$ w( Y - module_param(bcnt, int, S_IRUGO);( ?9 t/ r5 `* o+ S" c8 P
- module_param(ccnt, int, S_IRUGO);
复制代码 ! z/ L2 A2 M' I. I
' }# |$ z$ w0 k6 ~9 o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' A! r9 d5 H6 q( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! x8 s' n+ G5 O2 x7 }6 x5 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 L1 L. ?( S! k, K' U8 U1 ^+ f
% Y% x* l# V, W6 S
% v0 b+ ~. w( `8 B9 @% W& Q) @- I' Q |
|