|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( U: \$ I9 d6 _2 W, D
- [code]EDMA sample test application( U) z( n `- I2 f. R" ]2 T* W! W8 p
- /* @/ Q& }: P, R: u2 p6 ]
- * edma_test.c% v o( s$ d& m+ }: x3 T$ M
- *
$ j& R; @% v& p" v2 I7 j - * brief EDMA3 Test Application
2 P6 d5 S6 b3 W- p8 l- N2 [0 ~6 @ - *! D( e# }* s0 a7 M
- * This file contains EDMA3 Test code.
. t( P$ a' y6 y1 i/ z1 c+ ^ - *0 ]; n' p( ?9 Y9 k$ ~& B3 n. C, u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ I) \* B- y8 P, V$ P6 U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
\! p+ \* I' |6 A - * TO CHANGE.
( p3 |, e: j6 B* E0 e' U' t- {* l - *
% o2 A* F. F& D0 ^3 {/ M% j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& q. S" o5 q7 c, x2 _6 @ - *
- H8 w0 k6 Z" J" L- ^: ? - * This program is free software; you can redistribute it and/or( F" T4 R. m$ F% k+ r
- * modify it under the terms of the GNU General Public License as6 t& k; ]8 I8 C6 A& x
- * published by the Free Software Foundation version 2.$ w6 I2 T. ]! u
- *0 {) C. U7 i3 C9 D' W$ o1 \( }# c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ L+ H; ?) {2 I& n - * kind, whether express or implied; without even the implied warranty
$ F4 w# _* k7 r9 G; U7 B$ \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 B, [; X( z9 c+ ~ - * GNU General Public License for more details.) ^( [/ y& ^) S: w4 I
- */" A/ l& a8 m6 `' T b9 G& x% X$ g
! s" O* m% ^' i, y# X- #include <linux/module.h>
. a' K3 g" Z0 k- B" }6 v - #include <linux/init.h>: _+ |' w5 \' H9 _% b# i2 e
- #include <linux/errno.h>
/ O0 T( y2 X: g0 N" s. p3 P - #include <linux/types.h># u% t+ u/ G6 k& D. d: }( D( v
- #include <linux/interrupt.h>* ~8 e8 k7 m( Y7 M0 H# }! }. t
- #include <asm/io.h>
1 @* d- f( g+ M6 y. y+ { - #include <linux/moduleparam.h>
" c: R: r7 n7 R) Q7 d; u - #include <linux/sysctl.h>
: {6 i! N1 j) m8 J - #include <linux/mm.h>, y4 c4 D- ?# O: D: w3 r9 B5 d( Y
- #include <linux/dma-mapping.h>3 X$ m8 W' V5 h" p2 b
1 _1 ] c0 P1 ^0 \9 }: F- #include <mach/memory.h># m# r( x# r7 P) {: H( T! O9 R
- #include <mach/hardware.h>+ z0 C6 F8 s* B# D
- #include <mach/irqs.h>
& ^& A; ~/ Y, r6 u - #include <asm/hardware/edma.h>
' T' P* @& M G" n+ z! R
) i" M5 K7 h; ~/ r" N- #undef EDMA3_DEBUG3 s' V7 j! |# Q# P8 T$ u
- /*#define EDMA3_DEBUG*/* k. q& L/ q$ a* M) I
' x4 L+ B& q3 F3 H2 b( a4 d- #ifdef EDMA3_DEBUG* b. H, @$ p+ s. y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' h( c6 r# p% r0 @1 C9 m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( {1 v c- V i1 d4 _/ e/ y5 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( f) l2 m' ~( g0 c$ K! j. g A
- #else
6 ?0 M6 C. B# r - #define DMA_PRINTK( x... )
4 g. H. f: Q \- M - #define DMA_FN_IN; S% x+ m* x+ ~# o
- #define DMA_FN_OUT% `8 b* R+ p4 X
- #endif
* C3 S. @) D. T- o3 ^7 J3 h! x" S
% p8 Z# H+ w3 M0 ~9 U' _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% d% y- @! I: y$ B - #define STATIC_SHIFT 3
. w0 C1 s' i+ S( ?3 Y - #define TCINTEN_SHIFT 205 f( B# i2 d* d9 V# G% v
- #define ITCINTEN_SHIFT 21
' q: o+ C& H, L5 Z/ a& \9 F( d - #define TCCHEN_SHIFT 22
6 N: R: b7 c; K - #define ITCCHEN_SHIFT 23
9 Z) c: Y6 K: i& r0 n% J
3 g" K( B/ h/ A5 i6 I/ A- static volatile int irqraised1 = 0;
. }% x4 w7 q' e - static volatile int irqraised2 = 0;
2 B3 U8 P& y7 m1 ^" _
& l$ Y: r+ D6 D* e# r4 f4 ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D: K6 c" V, ^) Q- ~2 _' L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 h* q5 @% p+ y" t' A3 C9 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: v1 p0 }! ^2 H3 ?3 L4 P6 I
- % l J: ]2 }) L8 g% U7 n
- dma_addr_t dmaphyssrc1 = 0;, P: q; K7 v, p- V
- dma_addr_t dmaphyssrc2 = 0;
" e; _4 x# G/ m+ ^; F8 v2 B" {) K - dma_addr_t dmaphysdest1 = 0; L2 ]" @$ i$ r
- dma_addr_t dmaphysdest2 = 0;8 @7 U+ a7 F6 _7 G
- & m* \% s p; E( {2 B
- char *dmabufsrc1 = NULL;
6 |+ I4 u B' L' d: l2 _7 j+ Z - char *dmabufsrc2 = NULL;) M! {" Y0 A7 k7 L
- char *dmabufdest1 = NULL;" E& P$ v4 S+ t. H. d
- char *dmabufdest2 = NULL;
+ W) n" C: h5 d8 d! } - # Z# S7 S) |0 W. {3 B& r" L9 s
- static int acnt = 512;1 f0 H" X0 x& V- M! ]! n$ W9 [8 y8 w
- static int bcnt = 8;
9 i! I0 h' S9 P) t1 b - static int ccnt = 8;9 ]; S2 ]. i( b. W3 m
; [; B( c1 J5 M2 r- module_param(acnt, int, S_IRUGO);/ y- @) r) F( e4 A
- module_param(bcnt, int, S_IRUGO);
2 o7 e* e7 A5 r5 V - module_param(ccnt, int, S_IRUGO);
复制代码 1 p8 l4 z- I4 w
6 r, X* n& [3 Y# K& _' a; c8 i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ a1 y; J0 ?* b, R8 D7 T! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 L% w+ x+ ?4 F) i8 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, A9 f4 S6 ]% L5 _" |" e$ F' C9 s9 q9 M6 C
$ W7 [' F* U1 x' F |
|