|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 f3 q. }& G( d
- [code]EDMA sample test application
# w6 w) M) e3 @; m- ^9 x" R - /*8 c" J% I @( w
- * edma_test.c9 x) |: N5 K, ]- j8 I
- *; X) X2 B; h1 j$ N* I$ T
- * brief EDMA3 Test Application
* q1 T. U1 _6 k - *
, [8 Y6 I& e' @! W% Y& y - * This file contains EDMA3 Test code.
& L8 z! a6 {) R! K1 U3 a - *8 E% ^# J9 ]$ g0 g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: x6 q( P0 F) `! ]" {) e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 x9 l! I$ y* A# N; {* x$ M - * TO CHANGE., x X) o" L. a/ x5 I. |9 H
- *2 z. O: [2 d! E' i! [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# m$ c* x- o8 |% c+ t4 h - *
9 J. V/ ?' Z4 M1 `% A - * This program is free software; you can redistribute it and/or
- L$ `, ^6 D* s$ `! A+ F5 I - * modify it under the terms of the GNU General Public License as
; I$ S& ^, I/ B, \/ _0 g- v - * published by the Free Software Foundation version 2.
$ h, _, M# R) R. R - *
: c0 K0 @! \- e/ ?$ w0 } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 Y0 i, ^0 d4 w - * kind, whether express or implied; without even the implied warranty6 i) G& N. Y$ x0 r/ f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 k$ c( z- Q1 [+ q, i& z7 w
- * GNU General Public License for more details.
& c- R& c! f$ K% Q3 ? - */
7 s" w$ C" N {3 z8 W' R1 M - 2 P$ N3 k7 N* J" E4 E. G( U
- #include <linux/module.h>
; Z$ _8 N3 A6 p' r5 H8 N - #include <linux/init.h>
g+ ^. Q- S: _4 U$ S6 l+ O( a - #include <linux/errno.h>
5 p: A3 g0 E+ R9 X _5 D3 R - #include <linux/types.h>
6 t" Z/ S" \, p5 @5 S# a9 W - #include <linux/interrupt.h>. q1 y7 |( e2 P6 e7 [! y& G
- #include <asm/io.h>4 c2 u" z6 I( B5 T
- #include <linux/moduleparam.h>
0 t* B1 j. U8 X3 i- J/ T( \ - #include <linux/sysctl.h>' Q4 q( w2 S; Q5 F
- #include <linux/mm.h>
$ x7 @/ ]3 O$ r - #include <linux/dma-mapping.h>
8 h* B1 o& t! [1 M; }3 g1 c2 H - # d; S4 Z& p f. [0 _
- #include <mach/memory.h> h* V- p8 V7 A w2 P; g, U$ r
- #include <mach/hardware.h>. P: p1 {0 c0 r6 t% X3 `5 B
- #include <mach/irqs.h>
- U; \- n Q; R& m$ g9 a' j - #include <asm/hardware/edma.h>
; B3 `1 s0 ]6 p3 ?% l
% L4 \+ j9 L" {9 _. N- #undef EDMA3_DEBUG- h. S+ c5 ~' a ?0 Y# w& {7 a
- /*#define EDMA3_DEBUG*/! z8 _- T7 c# P( V* `
- 3 T0 i! v( M6 g2 ]& U
- #ifdef EDMA3_DEBUG
+ v# J* b# Y4 ], {! y9 |' s5 M# t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) t# _+ ]2 z# W, G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 Z! `; q7 O0 @, i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 y) Z5 x C1 h: r1 M! ? - #else' v9 [0 ~# t S+ d1 V
- #define DMA_PRINTK( x... )
) c7 g2 Q) ?) j8 a* b. j U - #define DMA_FN_IN
% F8 y5 N5 ~. h - #define DMA_FN_OUT* m+ q8 P- U0 h
- #endif
! H" c$ E/ [) ^& g8 N
$ _7 i: [/ ?! ]5 V* W1 W& ?0 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 l! v" g9 E6 v E+ g
- #define STATIC_SHIFT 3
' T' _ D. I1 {0 p% ~7 K: r - #define TCINTEN_SHIFT 20$ w( ~ B5 \/ g- Y- e
- #define ITCINTEN_SHIFT 21
" m) ?# L* |1 [' i I - #define TCCHEN_SHIFT 22
: e0 \4 I; E; a! a, g - #define ITCCHEN_SHIFT 237 R+ K8 v& b1 Q- d
) ]8 h' Z$ H1 P( C+ d1 M$ D P9 ~- static volatile int irqraised1 = 0;
9 }# w# u* f3 z7 ?. j9 s! H | - static volatile int irqraised2 = 0; @7 R( p }4 H; P
- + _+ F. P# I$ o ]8 k! E. j1 Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ L- X; R. |% o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ z" l1 x9 ?- F: r: D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; H4 ?% m. D0 r) D0 [
) h& t ?. R o& r- dma_addr_t dmaphyssrc1 = 0;1 D( P4 ?, }; B1 B. c g( m
- dma_addr_t dmaphyssrc2 = 0;
$ g3 F: n& `! a% j; q6 M! `% X - dma_addr_t dmaphysdest1 = 0;
: d9 ~/ B: r1 g8 p% ?- o - dma_addr_t dmaphysdest2 = 0;( Q: k/ F& }$ r4 y
/ g: f6 M8 L7 r5 s4 {- char *dmabufsrc1 = NULL;+ X+ p4 y9 v" J' ]& d. g
- char *dmabufsrc2 = NULL;" B( C. N- |$ B+ l8 p; a$ v* Z
- char *dmabufdest1 = NULL;
$ c5 |8 y* E) R# \& Q - char *dmabufdest2 = NULL;
* F: V5 E9 w3 g; g - # W, _8 W, f J4 x
- static int acnt = 512;
" B, J6 B. @& y* ` - static int bcnt = 8;4 K! ^1 R, m" B+ c1 E- G; D
- static int ccnt = 8;3 J& o; L- I+ M5 }( J& D+ K; a/ J
3 [; s4 e1 J/ g, w( q% i* r# d% p- module_param(acnt, int, S_IRUGO);* S; h; w# B k1 H& C, q6 Q
- module_param(bcnt, int, S_IRUGO);
, W) n2 R! b: d6 W2 I - module_param(ccnt, int, S_IRUGO);
复制代码 & n6 V; I: x2 Q. h: s w
6 @: j' f8 [3 ~8 j6 ?+ r& b0 h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% N D0 c4 Z( I& k1 H Z
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 T; \/ p+ l2 P( Q: y3 ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% l2 i+ w& V4 d( T% r+ [( b$ |! N$ T9 `7 y
+ O4 H$ p9 x" o0 R" ^& k2 P |
|