|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' x g6 a. e1 i. h! `6 F: L- [code]EDMA sample test application
9 v3 U2 B* b) t$ t: l% p% S - /*
; I9 x$ S5 ] N, c2 \ - * edma_test.c) Q( f! ^, X; x/ y+ [/ \) c
- *
, j% M% b% B( g5 [2 n0 X1 b - * brief EDMA3 Test Application
( k0 p D4 i' _( [- w - *
8 ^0 U& |6 k- P! J5 ^9 i - * This file contains EDMA3 Test code.9 e c* K$ c' G+ l1 t+ w5 K. w7 e2 ]! {
- *
& g) h/ I- `# g9 ]) S3 M. F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. }* ~0 B, \6 {# z z& ?( P) k5 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 c/ f6 w& g1 Y W/ r6 M - * TO CHANGE.
2 |& v/ [& i: t: ]7 M3 ]; h4 m5 J4 z - *7 f6 ^+ L) G2 ^/ j! Q# Q0 B8 ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 O! ~8 p( L' v3 }+ ~/ f4 R
- *
6 `& B6 w9 O! l - * This program is free software; you can redistribute it and/or
u. h" v; L; j: M0 w+ B( x" d - * modify it under the terms of the GNU General Public License as
, c2 X& ]$ @" V - * published by the Free Software Foundation version 2.' j1 G3 e' q1 e# {8 e; _$ i2 b# O7 m
- *
! X# B$ n" H* g2 u$ z/ L' I. o& B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 @" Q- f- f! d
- * kind, whether express or implied; without even the implied warranty5 t) r; j# ?0 D# k% i9 u# o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( j! H X4 `/ P - * GNU General Public License for more details.- M) h' r4 j* `
- *// p& T" V7 z5 S% z% a( W$ f- c
: f! u9 F6 z% W- #include <linux/module.h>" m8 z0 k1 _8 y
- #include <linux/init.h>% P6 F% T3 Q$ }( I
- #include <linux/errno.h>+ H7 } T2 l! R
- #include <linux/types.h>
5 V4 B$ u0 W6 q+ [6 ~ - #include <linux/interrupt.h>2 @$ u6 A% W" k( q$ t* l; m3 f
- #include <asm/io.h>* ?' i) K$ ?4 `
- #include <linux/moduleparam.h>
/ k R( L/ K; Z8 y* ~: x - #include <linux/sysctl.h>" T$ p% l4 M+ K$ B- @* U
- #include <linux/mm.h>
4 T4 i( F: Z, K3 ]' S+ O+ _% x - #include <linux/dma-mapping.h>
' d$ O \: t( p; `
8 v( E( K8 Z; u5 U) ^- #include <mach/memory.h>
& a- u' W$ O# C* i( C/ a! t" b - #include <mach/hardware.h>. j' i* A! p; x' b
- #include <mach/irqs.h>7 i) K7 |: l, T5 Z9 G
- #include <asm/hardware/edma.h>' R0 `4 R( n6 G' H& F# W2 |, V
- 8 Y" M7 e6 w; J, X
- #undef EDMA3_DEBUG
$ A1 K% }+ i8 q# P/ ]# J - /*#define EDMA3_DEBUG*/1 |+ W7 U* _' |
2 @3 X3 y. J# R+ q4 Y S/ e- #ifdef EDMA3_DEBUG: S( a# |& i! W% S! S" i) v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 s! Z3 M4 O2 r: h6 Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% w1 N3 d7 R' }" C" K6 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ ?; \% u# e" @) t- ^: M: Q - #else
6 _- q% h7 s( z+ x& X0 i2 Q - #define DMA_PRINTK( x... )
2 \$ v1 K, l9 v9 m% ~ - #define DMA_FN_IN4 v* i1 K8 N. z, q9 h% H. y
- #define DMA_FN_OUT
' ~9 u$ [* s! T$ v - #endif
. v5 A1 d" V( L: }/ h& O* g4 V - ! l* h' L0 ]( F4 |- [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( O1 { M* `% {; k
- #define STATIC_SHIFT 3- i: ?! D8 q: h( s: @
- #define TCINTEN_SHIFT 200 {2 x s' P; H/ L! p
- #define ITCINTEN_SHIFT 21/ F9 Q5 }9 P& l6 W# P
- #define TCCHEN_SHIFT 22$ ^' x9 m7 t4 _7 X. ~
- #define ITCCHEN_SHIFT 23
2 C. t( X# Y- q j& a+ [: @ - 4 Q7 {$ v8 k7 @6 E4 Y8 Y
- static volatile int irqraised1 = 0;
% r6 B& i( X4 N L3 |) r" n$ B5 k6 d - static volatile int irqraised2 = 0;; }0 |$ M( u$ F8 _- x8 R. a$ `
3 y, p8 l4 G2 b' Q% D4 ~& J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# U* {: }/ l9 Y) f" R6 v, w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- X: M; X3 G" @2 T1 A6 W2 L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); _# M9 B/ r2 D# r
- & i$ |5 H8 m) G4 _2 J8 R. x
- dma_addr_t dmaphyssrc1 = 0;! ~, ]0 {7 G, i* q, Y
- dma_addr_t dmaphyssrc2 = 0;5 U. |0 J" e7 Y2 _$ Q" z
- dma_addr_t dmaphysdest1 = 0;
- h+ i* W- R7 c2 \ - dma_addr_t dmaphysdest2 = 0;
# I i5 |) ~$ v/ h- l& ~ - 0 W4 X2 f% F5 p) x
- char *dmabufsrc1 = NULL;
3 L; Q+ _$ Q* [& j. u - char *dmabufsrc2 = NULL;
1 l0 \% [6 ]: F# P, u/ e - char *dmabufdest1 = NULL;" X2 z8 L, O. c% n
- char *dmabufdest2 = NULL;9 Q: ~2 T; B; L3 ]4 J
b* D7 e q \0 v- static int acnt = 512;% X2 Q0 {' \/ b3 \) o$ h5 T' r- y
- static int bcnt = 8;
) z9 U8 T8 v6 W6 _4 E" f - static int ccnt = 8;
' L4 j2 ~- ^$ A$ u, g/ ` - ' Q$ ^7 z9 H; r( I; `
- module_param(acnt, int, S_IRUGO);9 S; T! ]9 o5 q, F; f
- module_param(bcnt, int, S_IRUGO);& D/ h+ S! w9 o# a
- module_param(ccnt, int, S_IRUGO);
复制代码
[5 B1 v# c) L' }+ c5 F, t; S8 G1 Y# g1 K2 G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ ~. Q7 x" ?: @4 Z& narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" ]9 D) q3 A; B4 }5 D) H( u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! ~/ Y6 g0 W+ Z* `
# I9 P% J* a6 Y# y6 t8 t/ |# Q/ N8 c; D0 D' P
|
|