|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . W& k4 e- ]7 G
- [code]EDMA sample test application; h2 k( L3 S% V9 p
- /*; M' K; @; t4 W- ?/ p+ N
- * edma_test.c2 B7 H9 [" a) Y; q) u, r# f
- *
0 R1 h& f, m% b0 \. c; J. \; y. p - * brief EDMA3 Test Application7 @& W* h) s# y' N& n
- *0 x- ^" Y9 O4 C5 ]
- * This file contains EDMA3 Test code.) J( t, G* i6 ~; H) o
- *; j, p; E; s d: X: A2 M9 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE _- G) a+ x& d! W2 T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' [0 S- ^4 z0 \% l1 ^ _' `, f - * TO CHANGE., a9 a/ g7 d! ?2 g- r0 P- S
- *" x, I& R# m/ x6 p* [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 f% l, }% A) q* C( o
- *
9 f% ]$ E1 o9 z+ i. G: T0 [& j - * This program is free software; you can redistribute it and/or
& n1 I/ e$ @6 T: \( A* I - * modify it under the terms of the GNU General Public License as
$ z. N) j j9 R; y8 B - * published by the Free Software Foundation version 2.
' P6 n( m$ {4 ?+ w7 N - *
; l; T! X( w3 y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: S) X4 X' K ? F9 e- F
- * kind, whether express or implied; without even the implied warranty1 e7 Q; a# q; G9 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; {3 X$ W- V6 b - * GNU General Public License for more details.4 D( r5 ]0 o L' Z
- */
}+ q0 K( ] n& e
" x* k# p* ~, X/ W9 D D$ m' I) p- #include <linux/module.h>; `& i8 q* @7 Z. L/ ?+ R
- #include <linux/init.h>5 b9 k2 {5 x* `! [
- #include <linux/errno.h>
C7 a) V* m u- `) M1 i# E - #include <linux/types.h>
5 e: a1 N+ u3 i. a0 y( a7 u! ~ - #include <linux/interrupt.h>
: X7 N) i' W, H" L: R6 z6 b' N - #include <asm/io.h>
9 E) m$ A' q( V$ p; i$ F - #include <linux/moduleparam.h>
. G5 q, K- W$ a" b - #include <linux/sysctl.h>: W) i+ J/ h9 J" @( b
- #include <linux/mm.h>
4 A* ?( Q1 m$ o% ?2 r+ ]9 Z6 ^' |4 U - #include <linux/dma-mapping.h>- b1 h: ?; U) [3 K
. p# e% G# m7 q; i$ Y- #include <mach/memory.h>
6 N$ D* U; e; ?+ b+ R2 D$ | - #include <mach/hardware.h>7 a9 E& b3 \" d# ?* ]
- #include <mach/irqs.h>
! K. A j3 o+ Z/ c. O; k - #include <asm/hardware/edma.h>
) U" [ j' u9 j2 t. F. z' q5 h/ G5 s
" s3 t$ f" {# y S/ _4 h2 `7 Q P- #undef EDMA3_DEBUG
8 _0 e# P! P7 l! R( L- a; p, S - /*#define EDMA3_DEBUG*/
1 |% f% Q0 }2 {$ X4 w - - d; g' [5 U0 E& K- z- m
- #ifdef EDMA3_DEBUG
: H. z+ E! E, `; D. h- B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, n1 C9 F6 c; t' ^/ x' [& M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) a- ~/ \* @% B a/ ^3 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), M* N8 j: _: E
- #else
3 K: Y" p4 l. y k" [, C9 | - #define DMA_PRINTK( x... )
' I D* q" K' K L' o - #define DMA_FN_IN
& _3 j0 a6 L% A - #define DMA_FN_OUT
1 Z; \1 j) f0 A/ p+ j) E3 f+ G - #endif( O. W* _% f* j6 ?4 ^7 s
! ^: L# m' O, U/ m7 K* b" X! m! S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ A* j% ~0 l* o0 \6 |
- #define STATIC_SHIFT 3
. N+ v1 J0 i, V) e! K% G - #define TCINTEN_SHIFT 206 m! p- V' K9 k, ?2 }) X
- #define ITCINTEN_SHIFT 21
7 w6 B) W) h2 ^: N( @' d$ A% y5 X - #define TCCHEN_SHIFT 22
* L" Q l: e- U; z3 i+ H E1 g0 g - #define ITCCHEN_SHIFT 23
5 B3 }! | A4 g; j) }
/ P; F, T7 e$ O: g/ N; L- static volatile int irqraised1 = 0;3 t- O' \$ t0 F" j0 j. z
- static volatile int irqraised2 = 0;* \# Q; d% J B- k o
' @% y9 @! `- w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ B' o! l5 M$ S. ~! S, K: {6 c6 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 K" G9 \6 Q1 S! Z2 M9 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C. G( k: |+ g, N5 f4 S' R
& u4 V! h0 u% O5 Z( O- dma_addr_t dmaphyssrc1 = 0;
4 ?; @0 I0 w$ L7 ]6 v' K( j - dma_addr_t dmaphyssrc2 = 0;
* I8 u# c; R% R$ u - dma_addr_t dmaphysdest1 = 0;9 o2 A' e% F% M3 p6 @ n# S
- dma_addr_t dmaphysdest2 = 0;
) q) }2 O3 u2 B - # @- |# l! E$ o9 t# D
- char *dmabufsrc1 = NULL;# v6 p0 W5 w7 Z4 i6 g- x6 b
- char *dmabufsrc2 = NULL;
; \% `, j. }. K$ B& { - char *dmabufdest1 = NULL;
) e0 Y) m9 V7 {8 l - char *dmabufdest2 = NULL;
, W( }+ t7 ?- o. R( f$ l
$ U7 y8 P: k5 A' d1 H; c- static int acnt = 512;# ` ]8 C2 T7 @
- static int bcnt = 8;- {8 |" \. K) R. l9 U
- static int ccnt = 8;
% ^, s1 u0 r; `! a: C - & x' x% [; ~. T- M. P6 w0 Z& @9 U( N# g
- module_param(acnt, int, S_IRUGO);( |. [ R* a2 l3 x+ e) ~* \2 H
- module_param(bcnt, int, S_IRUGO);: o: D7 [ X% ~
- module_param(ccnt, int, S_IRUGO);
复制代码
& Y4 A$ ~2 [5 ~4 E k' F
8 i8 N2 k' w5 {4 ~( e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. g- h% z+ l& g( g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 @: b! Z, d4 H- w9 [! T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 D- \$ Y6 g/ q8 t5 Q, K h+ K' S' ~& k/ j; D' i7 q
8 g, W. d6 B( H& I5 \6 b, P
|
|