|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 s" `( m# q" ], d6 ]8 U3 o, [- [code]EDMA sample test application+ A0 B, m; Z2 i1 C1 H4 I
- /*
5 y6 W' g) F0 {1 [- _ - * edma_test.c
- [* ~& d" a9 m( f/ Z - *5 g$ ]* @3 G2 K% |
- * brief EDMA3 Test Application
4 A: o, O J% y - *
9 @- ~* k2 l3 J: A! I* c. o - * This file contains EDMA3 Test code.0 U" `* ^! G- Y$ l5 l# `+ B
- *& N( i, p; Z- ^8 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; \2 h$ I) S/ ~/ } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ d2 ]9 T8 {$ G! q) P - * TO CHANGE.
5 U6 ^0 `0 R+ R/ `8 \1 L: E; f" ^ - *
3 H+ A6 x# u' r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 A, @# z+ f {' l! D - *
( P- N3 k& J6 o& P! J - * This program is free software; you can redistribute it and/or% z9 Y7 f' E1 i. N5 a
- * modify it under the terms of the GNU General Public License as
; U! I! y: g: v- Y" d - * published by the Free Software Foundation version 2.9 Y( F+ J7 r, \' j9 Q# s
- *
2 M8 h/ |- g) k$ ^1 V: X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* H N; Q" ?, G7 ^2 Z - * kind, whether express or implied; without even the implied warranty4 A* V3 }# E8 A4 z8 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 q' H) e' c- t( [ - * GNU General Public License for more details.
" ]# b* @/ N4 j. _2 \7 L" ~ - */( ]& U2 x+ ]% Z
( m. {- ?9 h' @- F; F5 K- #include <linux/module.h>1 U& M+ h# }% u0 N6 Y
- #include <linux/init.h>
7 E2 N$ j! g) f) d9 d5 K7 @- h - #include <linux/errno.h>+ N, M0 R. r. J/ L6 g
- #include <linux/types.h>9 S) V+ Q$ w: N% |
- #include <linux/interrupt.h>
4 M+ u9 i) e2 h+ H& q; ` - #include <asm/io.h> q& m; i l1 d) ~. _$ \: l
- #include <linux/moduleparam.h>* {( z3 |. d' S* l1 N9 K
- #include <linux/sysctl.h>
$ U( z) x/ u, ]2 Z - #include <linux/mm.h>4 m* G" M9 B* z3 e) L3 n* Z4 {
- #include <linux/dma-mapping.h>6 R. K4 f: x) x) A
- ; h/ Y& @% D; _9 A& m
- #include <mach/memory.h>
! r5 B- O2 J7 r5 b" A - #include <mach/hardware.h>6 h/ U, O A2 b9 s: S7 X$ H
- #include <mach/irqs.h>
4 V" Q- O6 l6 h - #include <asm/hardware/edma.h>
0 H& i6 K6 L( L# U6 U6 H
& @+ E* Z4 s& b# R- #undef EDMA3_DEBUG: v% g$ Q( f; h' s
- /*#define EDMA3_DEBUG*/
% m9 i: N1 j2 a# I$ t* X# o9 N
5 r; V u( t1 v& o4 A7 C+ R$ L- #ifdef EDMA3_DEBUG
! E7 {1 V" E8 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& {; |3 B/ P8 g; c+ P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 D' O5 Y7 N r4 ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' `/ `& a" p& z. G" O. ]7 `
- #else+ h j) O: |1 v8 O& o. H
- #define DMA_PRINTK( x... )/ {. Z% Y* G- T7 w. |' K
- #define DMA_FN_IN
! ?% v: T! [# A3 n; Y3 I# { - #define DMA_FN_OUT
+ a* G( E5 T8 ^1 p& A# j - #endif
4 y" y5 d* ^6 m. p) I3 x
. D( r) a- }% N A5 O/ q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 V/ R# A, _ e6 { I" P; g7 S6 C T - #define STATIC_SHIFT 3' \6 q8 D* a" H) r& a( i
- #define TCINTEN_SHIFT 207 E n0 t8 r% |+ g9 o: y
- #define ITCINTEN_SHIFT 218 J3 Y) X! M# J" {/ _7 F9 n. b
- #define TCCHEN_SHIFT 22
: ^) G; K8 B, T+ H - #define ITCCHEN_SHIFT 23% N/ P- I4 m* o3 G9 D6 b, R0 T. g
- 3 b0 t' Y* M6 s& L$ `' g" Z" S
- static volatile int irqraised1 = 0;
/ U' i, m; r* D) o1 S5 D - static volatile int irqraised2 = 0;
/ z# n6 b$ L6 C* M- ~, n
+ ` k% m5 [! ]; z3 |3 i/ J6 c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; A d* D& k# B5 \* t- @4 Q4 r. r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 D! I6 e7 Z. A4 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ?0 D* ^3 m! m& _/ E6 e - " e$ }# D. f7 Y3 ]( E3 T9 r+ Z1 h! C
- dma_addr_t dmaphyssrc1 = 0;6 m$ V9 i9 |* \; F8 ?! z, d9 s/ ^5 k
- dma_addr_t dmaphyssrc2 = 0;
9 j0 D a8 I; k8 ^+ Q& p) k9 u& Y* ~ - dma_addr_t dmaphysdest1 = 0;
: _+ P: _6 X y) T, d" q - dma_addr_t dmaphysdest2 = 0;
# L: R9 x, B/ F& P8 A+ q$ O - " J- {# C, Y/ }9 d9 V9 ]$ M
- char *dmabufsrc1 = NULL;
: R* [ B; N: x - char *dmabufsrc2 = NULL;
X1 R) x4 T. s0 ? - char *dmabufdest1 = NULL;7 d7 x8 S* ~& l5 L
- char *dmabufdest2 = NULL;
4 }# V: w- V* |/ U$ g - 7 a- j# z8 I( \3 P0 M7 h! t% o9 v0 b
- static int acnt = 512;! r5 r3 `4 b4 G
- static int bcnt = 8;
0 C. ]$ |6 N1 \& x+ e - static int ccnt = 8;
* u! g4 {1 Y* D7 [1 ?9 Y
) e) n# T" a! O% s: U- module_param(acnt, int, S_IRUGO);: U4 t [6 b$ G5 i8 H3 t/ t; u2 |$ A
- module_param(bcnt, int, S_IRUGO);
9 _ @2 f7 v* j3 @ - module_param(ccnt, int, S_IRUGO);
复制代码 : E8 o" _; |# `4 N& j4 V
/ ^6 X' V, n# ?2 Z* O. e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ Z' y6 K3 D, w! r! N3 c* }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" B$ c5 [9 G/ U& z; E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# N3 k3 L) Q% }) C6 K5 M9 W4 e7 Q+ ^# X1 m4 v* ~7 I
' F3 P8 W A- N3 y) ~& n8 u |
|