|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! |8 a- p: @# h8 x/ F: o- [code]EDMA sample test application
0 B; w1 K! N+ E7 K1 ^/ x6 Z2 G - /*' E1 f. K" m7 `8 e2 Z. C
- * edma_test.c3 k6 L9 j5 h5 J8 f' ?
- *7 ^) x5 G' q+ u5 B& f* ^2 M: D
- * brief EDMA3 Test Application0 `0 j9 G5 k& P/ m
- *
( c c/ f* k4 {3 Y; @ - * This file contains EDMA3 Test code.
0 _. E6 @- k% c a' d! K$ n( J4 y | - *
* i5 `, |. j7 k( n* l9 A, E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" S# _! J9 y' j! w! d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' n) P V4 x ?* L3 w: Z; W" n - * TO CHANGE.
! W- R- c j+ L" n - *: C v. w4 i) P3 [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// w) D- h" b/ E* g& b) v) O
- *8 r/ H( Y, N. j- M* Z/ s
- * This program is free software; you can redistribute it and/or" g ] t) X5 E1 ?' ]. O: X
- * modify it under the terms of the GNU General Public License as
: a5 K; z' I# h9 x3 |6 V - * published by the Free Software Foundation version 2.
( I5 N3 L+ ~3 g - *
" V5 y) t( s9 w; ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 m8 u. H3 |: N/ T - * kind, whether express or implied; without even the implied warranty
: o- ]% g9 T* M! E M# ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% q: w" t: v. Z
- * GNU General Public License for more details.7 a- `) T; {! x# l) F* T
- */- P$ q: s: _$ t* j2 L0 Y
S9 |* c6 `* M- #include <linux/module.h>
! S5 A, [. d$ ]4 q% w - #include <linux/init.h>$ C" E2 X# \! u) D8 B7 a
- #include <linux/errno.h>
+ ^7 a, I, F. h - #include <linux/types.h>
; m& g) K9 x( M* d - #include <linux/interrupt.h>
6 Y% w4 n/ b5 E" u6 s+ ~: a - #include <asm/io.h>" m G7 d& V& P% Y+ q
- #include <linux/moduleparam.h>0 _6 [2 W4 w+ V
- #include <linux/sysctl.h> z8 [6 _0 F% z8 |; V
- #include <linux/mm.h>! x) B$ _. J @! z
- #include <linux/dma-mapping.h>$ R, t+ n: I$ }, r$ A
. K" K+ w: U) {2 I5 |' c* q" S* ?- #include <mach/memory.h>
* f- l8 a/ \3 e8 a6 t5 d7 N - #include <mach/hardware.h>
9 N) S9 s. Z' N5 T/ e - #include <mach/irqs.h>
$ x. R" d9 q) g! Y) ~+ q" v - #include <asm/hardware/edma.h>
: l2 b% }3 B) q T+ C% B - : r/ W0 q4 ]* U/ L
- #undef EDMA3_DEBUG
) P- G7 |5 T! O3 C" ~( Z% D) I6 s" D - /*#define EDMA3_DEBUG*/ X J3 |' \0 y( C; }6 g0 p9 i g
2 a7 w2 O& N# n' j& U* F- #ifdef EDMA3_DEBUG
0 d0 N. ]! G i8 b7 y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 t; c4 F" W: N( _- l) H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 B5 k" y9 v, F& P% O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 i5 f! s5 z* v* X- d$ Y, h' Y
- #else- c# B5 c/ p6 P9 Y0 F$ m/ D( r
- #define DMA_PRINTK( x... )
% q; r C$ W* B2 Q - #define DMA_FN_IN, v6 J% H/ f. E; P( f1 M5 l
- #define DMA_FN_OUT
4 V( ?& r4 F) h- |6 b - #endif5 s; f1 j! H" l' ~% ?5 F3 U
8 h1 i7 `: S# m: M7 O/ \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" |# }7 p, i2 ?) Q& P+ M - #define STATIC_SHIFT 3
1 J: v) \$ [8 O, L# Y - #define TCINTEN_SHIFT 20" o6 a% d( x: s. ?3 ~( H% M
- #define ITCINTEN_SHIFT 219 Y# a" f4 U3 @8 b
- #define TCCHEN_SHIFT 224 b& y) w; q( n. s& D! b. ^
- #define ITCCHEN_SHIFT 23
$ C! n9 I3 ^' K - 9 j$ \" H& O+ R8 p% A
- static volatile int irqraised1 = 0;* h; M, j% x9 B0 S
- static volatile int irqraised2 = 0;
2 W* U2 f6 S" a8 a - . F" R. G$ u/ j d: |( v3 Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- |9 p, x4 P+ G3 M0 l( A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 v* N4 N: o% S# R2 P- `' x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& j) l7 [4 a: b - ' v0 {. w: x* `" \* g5 o
- dma_addr_t dmaphyssrc1 = 0;$ N( l: `0 l6 [. x$ o) M0 W4 c
- dma_addr_t dmaphyssrc2 = 0;3 N. l' c9 v# l
- dma_addr_t dmaphysdest1 = 0;; t( |' I$ m8 S6 v& {' o
- dma_addr_t dmaphysdest2 = 0;- |) i4 w* ~" u2 w; `% c+ H; T3 K1 {
; z3 R' \2 c p/ m# o- char *dmabufsrc1 = NULL;" x7 `0 B% U3 T% G& c; p* C# y
- char *dmabufsrc2 = NULL;; m3 N8 @) g6 M
- char *dmabufdest1 = NULL;* L' C. N" m" ~, f; W8 [8 S
- char *dmabufdest2 = NULL;2 @# w, m. ]( i- ~% E
- 2 J$ @: }( m# H m0 X. W2 L+ i
- static int acnt = 512;
' v G1 S: m" Y# A6 Q9 p- X6 E, W* P - static int bcnt = 8;6 B' k! L5 H) U3 I: D2 ]
- static int ccnt = 8;
( U2 B |+ |5 Q8 {5 j - 9 Z8 M2 {0 \* ?2 ~8 \% h
- module_param(acnt, int, S_IRUGO);
* x/ E( I; @! A$ { - module_param(bcnt, int, S_IRUGO);
' P! R5 D) L* _3 g7 W5 n: C% @ - module_param(ccnt, int, S_IRUGO);
复制代码
9 D4 @$ ?' o N: p
9 E7 d8 q+ g; D W( f5 U4 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) v: S% [, Q3 W% J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 z+ x/ B' C$ s. N0 e( @8 r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" e3 ~$ J% b7 W r; _+ \
+ v' I9 B8 M/ q j1 i; L- r
* P; O5 o% I! g4 j |
|