|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + [1 ~+ s! y& O, r# m% H, d
- [code]EDMA sample test application
: [3 ^4 f: t- ` P; K - /*: l0 }+ _7 G G) T; A
- * edma_test.c4 }) \- u1 c0 f9 ~* O
- *
9 s2 q, p$ q3 N% ?% d1 |' J: s/ F - * brief EDMA3 Test Application; L! h+ K( j* u0 K3 p
- *
' m# O! r8 ?7 r0 G - * This file contains EDMA3 Test code.
1 j& Y! g' |1 J1 i - *1 q# _8 X+ v% M, B3 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. J' A5 \, `4 w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 Q! ~: j. u' t0 k! J - * TO CHANGE.1 Q* n9 X. |. d4 d
- *
/ N0 l: T6 p. q* ]% i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 U u+ z1 S, }" ~7 |) Z3 T - *
# w7 Z/ Z/ C5 Z _+ e - * This program is free software; you can redistribute it and/or
/ n8 J' ]* k+ L ]( W! L' U8 r: I j - * modify it under the terms of the GNU General Public License as. L; a9 L1 D/ {% K* @0 o0 Z
- * published by the Free Software Foundation version 2.
2 L& Y; Z0 o1 X, S$ Q( y9 N) G - *
$ J& G/ k9 A5 i' s7 A' E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) ^7 W9 A6 c1 Y; \- s) O: d - * kind, whether express or implied; without even the implied warranty
4 l( u+ C- q8 l7 e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, R+ V4 z: E$ |4 I# i9 _: s! L - * GNU General Public License for more details.' i/ d, N6 d2 s; k: p% p! K- b
- */
$ Y3 m! G ?9 s8 M8 V) n2 W9 c - 5 h4 Z# p# N8 a
- #include <linux/module.h>, V U5 D$ G5 n4 z9 |& c" }: X1 r! b
- #include <linux/init.h>
' i% l* N$ F" F1 L" f, x - #include <linux/errno.h>
1 P9 q! E% |2 _! {5 L+ G# D - #include <linux/types.h>4 g/ Q/ N0 P1 S/ ?& ^
- #include <linux/interrupt.h>; y% u! e$ U- T! L: y
- #include <asm/io.h>
. B/ w/ b6 z% L9 `* I0 a6 S% k - #include <linux/moduleparam.h>. r5 k% a" o N8 [' q8 L; X
- #include <linux/sysctl.h>
6 c+ l1 w8 v, B) e, C5 A. c - #include <linux/mm.h>
, Y1 } ?0 }; }! ^ - #include <linux/dma-mapping.h>
c+ C+ V- o7 w- h5 a4 F' b: f
+ D, C0 P. `: w8 M9 R; x- #include <mach/memory.h>0 z* |$ x# A6 W# v' |
- #include <mach/hardware.h>* U+ G- `7 b. l- i! A2 n
- #include <mach/irqs.h>
+ u- f9 q# j+ r" n - #include <asm/hardware/edma.h>% D! i0 ~; [ F/ n& V7 Q$ f
- 2 |1 K/ o4 k R9 I' Q( b( m& Q
- #undef EDMA3_DEBUG
! j. v9 Z$ C! r. y7 m - /*#define EDMA3_DEBUG*/
. S3 z* s* ?- Y! J+ p
" ?5 ^, c) J+ E! s; b/ E- #ifdef EDMA3_DEBUG
" z7 [5 ]$ B; m- q5 q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 r! U% K7 ]. q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 n e S6 }. l6 ^/ F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# M$ Z! `4 F+ i8 T. k6 R% G N! T4 c/ | - #else
7 |+ `/ _$ U$ y: Q. z - #define DMA_PRINTK( x... )
" u* `- ` P2 S% E - #define DMA_FN_IN
( p& f# g V/ Z- M& N: h - #define DMA_FN_OUT9 D; y* }) n! ~& @( A
- #endif) w: O; r, t" `1 D2 [% J
- + q% i2 @/ o8 Z5 ~+ T4 O; ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) e1 n) X1 |' r. S# Y. C
- #define STATIC_SHIFT 3
3 |7 p# X9 i4 E3 }3 T: n" D - #define TCINTEN_SHIFT 20
; @& E" O( g* V - #define ITCINTEN_SHIFT 21! z) Q. V$ l$ `9 c! n a: G4 d
- #define TCCHEN_SHIFT 22. S) g9 M/ {; |4 Z- R. V- z
- #define ITCCHEN_SHIFT 23
( }+ O; E0 J8 ]
3 R5 \8 M2 A8 D( ^- static volatile int irqraised1 = 0;
$ t. D5 L4 c: @, i# L% Q ` - static volatile int irqraised2 = 0;+ u; _) x d* Y) W1 o* Q
- 9 @4 M% x/ j* t% ]0 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); _. N6 @4 x& h- d) Q" ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ?: w) K( }4 B7 f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 H3 [: q4 Z% V' i2 i( C - : [' z4 Q( O* W: g$ x3 j# |5 D$ S+ |
- dma_addr_t dmaphyssrc1 = 0;
+ e6 \6 ]4 B+ X - dma_addr_t dmaphyssrc2 = 0; D% |! D G4 P) y) k9 u
- dma_addr_t dmaphysdest1 = 0;
& s8 d T# U7 q3 m# a. B; G9 d0 @ - dma_addr_t dmaphysdest2 = 0;: w# \+ L2 g4 b+ f; ?
- e! r; B% Q1 s$ _7 |- s2 J
- char *dmabufsrc1 = NULL;
1 }' ~0 p* q: I - char *dmabufsrc2 = NULL;
' q8 j4 W; L4 R1 `6 f0 y - char *dmabufdest1 = NULL;
1 s. {: U; F( b. \ - char *dmabufdest2 = NULL;
0 y. U4 F+ L3 ]* \
/ h' p2 X$ Y4 c V. t7 D; s- static int acnt = 512;
+ M2 R* I* [, M8 @# J+ _. o0 y - static int bcnt = 8;- M K, i7 i2 Q1 {9 K; C7 r% Z
- static int ccnt = 8;, O7 a& K: }5 {( c+ k
- : q+ E' w5 N2 P% S/ e
- module_param(acnt, int, S_IRUGO);, ^/ e, s, B1 T& v1 [
- module_param(bcnt, int, S_IRUGO);
, @0 C8 [1 }+ s3 e - module_param(ccnt, int, S_IRUGO);
复制代码 ( f8 N6 q \$ X/ V6 j
, v1 A% R/ d9 J& a; v7 \5 ~) k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 I: w- |' B) S6 g. `7 N) y( j8 _% oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 P( h$ |- J- E0 M& s i. f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( |+ a1 [ P6 E- S+ ]; Y
2 e7 Q% E9 N' R6 i0 e' R. m- B, ]1 n8 t5 y
|
|