|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 C$ M- F5 }2 s9 _- [code]EDMA sample test application" k( c. _( t' s; N' w! Y; Z
- /*& K8 n* D7 U2 E4 I1 X; q3 K
- * edma_test.c1 N7 s. ^: ]% E* A% H
- *9 W9 s6 D, y* E6 f
- * brief EDMA3 Test Application% D4 [% Q0 u# J' i0 e% i T
- *; S2 W4 }4 ~$ l. b8 s. t- i
- * This file contains EDMA3 Test code.
: y( Z$ M; |1 C$ j7 A: r - *) P! O0 f' X) S d# O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! s2 E# o) v/ ]9 I& x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
d, {4 s" U/ Z - * TO CHANGE.
% w7 l4 Z8 H8 M$ e8 r - *
$ M, c) I! U, u' g/ k; W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 j) M: ]7 K% t9 B - *
; s" p S* [3 G - * This program is free software; you can redistribute it and/or1 S" B" @" T* X, {1 w
- * modify it under the terms of the GNU General Public License as4 F; W G6 ]+ ~9 E: k# _* Y' ^
- * published by the Free Software Foundation version 2.4 t4 X# {9 e6 F0 [+ m, O
- *
: \- k E6 m3 Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 }+ l9 i9 Z! ~- m4 C \ - * kind, whether express or implied; without even the implied warranty
( P( }' f& v5 j& E5 r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 W% D+ K7 O/ U& t" y - * GNU General Public License for more details.
! g# T1 r+ Z& n$ o# c# P/ Z$ t - */
' [- R4 {) M- x' j% N" k - 2 E+ N* ^1 ~6 Q O* p
- #include <linux/module.h>2 d2 ]. Z* W( x o3 y; l; I
- #include <linux/init.h>- i+ o( l: p/ A/ p9 d
- #include <linux/errno.h>! J) A$ f' T6 L5 ]( g# h
- #include <linux/types.h>
1 T3 ], B9 Y/ l. ^) ^ - #include <linux/interrupt.h>! M7 k! N1 j% ^- d! Q
- #include <asm/io.h>
7 T' N; t N4 v$ { - #include <linux/moduleparam.h>7 g% P1 y3 S: E* W, B# d$ |
- #include <linux/sysctl.h>' H; b. |8 m- K9 L. }
- #include <linux/mm.h>/ S) }* P5 M- c9 G7 w) H, [4 o
- #include <linux/dma-mapping.h>
4 E. ~9 d; N7 i
9 ^0 Z- [( n3 Q. |* o- #include <mach/memory.h>. x/ s2 [& y6 t" G& X; [
- #include <mach/hardware.h>$ S. @ X5 p8 K5 U
- #include <mach/irqs.h>3 F( A; r# q2 s2 g6 V3 M7 k
- #include <asm/hardware/edma.h>
" S( E+ X3 q# c- d; c# ?
! C" ]* V8 D- H/ ]5 t; I5 m/ |- #undef EDMA3_DEBUG3 C5 B# }4 E; c
- /*#define EDMA3_DEBUG*/- l1 e* ?. f# d) Q" |, a
- * U! _/ Z! h2 a$ V/ T; f) j* T" r0 Y
- #ifdef EDMA3_DEBUG
% z% \$ K( n" j- C) U5 {/ x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* k6 X; o" R2 d# [5 t0 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& e% ~* J) k) a6 @# o1 G# r9 M* w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# X0 X R2 g' q' i - #else4 I) W+ q6 T1 t# u4 |7 n
- #define DMA_PRINTK( x... )
% q) W1 {; P4 ^; I - #define DMA_FN_IN
# l8 T- B, {9 y5 D4 _) M - #define DMA_FN_OUT
% ?% ~/ X; l# S- Z2 g% k! i6 l - #endif
; G* c! [/ z. q7 j - 0 r6 L6 j" ^! n# w! R: z$ `4 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 ^6 q$ J: n4 I# }( ~" `& c - #define STATIC_SHIFT 3
4 w* y& [: C8 w - #define TCINTEN_SHIFT 20& |* h3 p& P- r2 K# O) P+ q+ j
- #define ITCINTEN_SHIFT 21: i! ?, ]% v* P2 i
- #define TCCHEN_SHIFT 22% T- ? {3 O# _. I
- #define ITCCHEN_SHIFT 23
c# [+ R' y8 o$ O9 t# a6 I/ X
/ V& \# G3 n9 p3 m6 I% U' w- static volatile int irqraised1 = 0; K4 Q- {- [# |5 m
- static volatile int irqraised2 = 0;3 A, c" c- @; Y9 t) d
- ( k% h+ ^, ?; F6 r+ j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; T4 l: ?" a3 z. q# w/ S% d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 z! r4 i+ a, _0 s$ u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 @6 d* Y4 A( \$ D- q" ^2 P" F
- _) j- `: z. z- K: J
- dma_addr_t dmaphyssrc1 = 0;
$ t8 L! ^) S9 G1 J/ o - dma_addr_t dmaphyssrc2 = 0;$ T* C, h" b) ~
- dma_addr_t dmaphysdest1 = 0;
/ T9 p: v0 t. d! R A% I6 ` - dma_addr_t dmaphysdest2 = 0;
( K# I7 f/ b$ V$ I1 ?* Y1 l2 W+ q$ A# \
1 u ^1 O6 B3 O; U. i- char *dmabufsrc1 = NULL;) n& e N6 {$ v X: p0 d) G
- char *dmabufsrc2 = NULL;
1 ]1 d0 h2 x! T6 Q/ ~ - char *dmabufdest1 = NULL;4 a: H9 M) i* S, A# G t9 V6 X
- char *dmabufdest2 = NULL;; {4 u1 x+ F% O( V2 g0 _
- 6 v3 e+ ?1 G' g H; a* q' ~
- static int acnt = 512;2 x; y b" I* Y
- static int bcnt = 8;
4 u; u/ |7 C. [5 G8 j5 l - static int ccnt = 8;
+ Q* q# h$ \3 c0 ]* S& n - ( ]* N* w4 b, [ [) W# E
- module_param(acnt, int, S_IRUGO);
: t$ T+ b7 ^4 ^* R" ]" { - module_param(bcnt, int, S_IRUGO);2 x" g; x1 l4 D0 U* _- \8 i Y; _
- module_param(ccnt, int, S_IRUGO);
复制代码
% ?* F g1 l& F" I5 o
$ r# _" C9 H, {' C. l w' n2 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: U" }' ]' J+ B) O+ zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 @8 a# h/ ~7 |- i& d" Q- E4 R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: h4 P$ @- ?% B
+ w2 [8 U4 `- U. G; N _. z, d& E/ i s& c4 P1 z
|
|