|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # ~, O j& x" A7 S
- [code]EDMA sample test application! b$ U4 J8 g2 y" y
- /*
2 F2 V8 F$ v, n( h0 [' S2 e5 g& p+ c - * edma_test.c
# ~7 `/ W' o- q: Y+ s) u - *
/ t! y* w' y$ s+ A, l* f - * brief EDMA3 Test Application
- P+ S! @ F0 @ - *
5 A4 p- h% h4 P - * This file contains EDMA3 Test code.
5 V2 _6 h+ T4 o, V0 e - *3 J6 a4 ]0 i) o" D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ J* Y1 n* Y* v+ ]6 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. j$ M8 O' j8 Z# ?( Z - * TO CHANGE.. V) T5 _& X% R% z* B
- *
2 N6 a# U; }8 p3 w# P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ ?- ^) q5 B% [1 y& C" U, N - *$ Y% n% V* j' I) y. G
- * This program is free software; you can redistribute it and/or
0 b& l" \7 G; r* F - * modify it under the terms of the GNU General Public License as o$ Z3 T2 K9 T
- * published by the Free Software Foundation version 2.7 I1 q. H1 |- J
- *& S8 ]1 s+ `( y" r5 c1 p; o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 \( E$ }6 K4 O" C - * kind, whether express or implied; without even the implied warranty0 z* v" `4 |5 j6 n" \* ^: r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 { a6 a* @* _
- * GNU General Public License for more details.
0 S# N6 M% Q1 f" N5 Y6 S - */
$ M5 [' h" D# y' M" T1 o - ) S5 t# G O% B; S
- #include <linux/module.h>
( R; A+ Z: Y% M" \0 r - #include <linux/init.h>
* z7 i: R* @8 z, a9 n' z+ ` - #include <linux/errno.h>* \# {# l/ u) J5 C7 {
- #include <linux/types.h>, ~" w' e; j1 y/ R, |) i3 C& J2 |
- #include <linux/interrupt.h>
! I* i4 [+ d5 T: n* Y4 A - #include <asm/io.h>0 s) U8 c: L5 [! j. B
- #include <linux/moduleparam.h>
4 m8 {3 l' X9 J! O [) U - #include <linux/sysctl.h>
! j& i, a- r& k8 d( y2 { - #include <linux/mm.h>; W9 x+ P7 t& K
- #include <linux/dma-mapping.h>
- _6 z! Q9 }. p1 b - 9 N3 y) {' N# j) Q- I& D" `9 J
- #include <mach/memory.h>
- T: J: e1 a9 ]4 h - #include <mach/hardware.h>; X+ H) N3 S2 R
- #include <mach/irqs.h>
+ E+ x K& P- i - #include <asm/hardware/edma.h>% J- }6 |" E' B1 G# P% J
- - J) Z9 Z8 F. L! x/ M
- #undef EDMA3_DEBUG
" _- W+ k9 P+ r; @ - /*#define EDMA3_DEBUG*/) D7 y* z5 i1 I6 l) ]3 d. T/ p
- }0 C, O* G: ^ z* o" @2 { Q
- #ifdef EDMA3_DEBUG5 i2 p. c* e) @) [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ X/ J$ P* f3 h. e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) ^; K& }1 [9 \# y$ \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& k7 }+ W0 T' D/ \6 z E - #else2 b. F0 I+ Q4 H* `6 I. @; n
- #define DMA_PRINTK( x... )* m- n- P# W" K
- #define DMA_FN_IN: ?3 U, S! Y1 `' i
- #define DMA_FN_OUT
( x' W* `9 I `4 t; _9 W, s' g - #endif
/ I( ?/ j6 h# L
' V6 Q5 y, [5 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 v% C% @6 |9 O3 n9 g- h/ E
- #define STATIC_SHIFT 3, c; H7 d+ n4 @# {6 r% p
- #define TCINTEN_SHIFT 20
2 o7 N% m4 a( \' K: Q# N- p2 u% N - #define ITCINTEN_SHIFT 21
( Z3 `- Y5 ]& M# R( H! v - #define TCCHEN_SHIFT 223 N! n9 Z' R% e$ s5 ~2 l. @* a
- #define ITCCHEN_SHIFT 23
, ?1 [+ T I- S/ {# y3 } - . u7 b! v# h3 T
- static volatile int irqraised1 = 0;
! _; J7 ~& n; d - static volatile int irqraised2 = 0;
) Q3 g" w; m- K1 M; {
4 U. L$ b4 [1 C" I p' h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 j* ]/ T( [' k1 A: `0 G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T! p: S8 Z- D) m# b$ J5 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- f0 n$ _+ I+ ~ - # R+ N4 K0 h8 a& j5 W( G, q: i
- dma_addr_t dmaphyssrc1 = 0; z' m8 f O1 J# d
- dma_addr_t dmaphyssrc2 = 0;, _! m2 I- c' o8 p
- dma_addr_t dmaphysdest1 = 0;
6 a, Y0 P; M* y% U. ^ - dma_addr_t dmaphysdest2 = 0;
6 o% D" I/ s1 t' d" d$ M
) t# ~5 j% J/ n/ H1 S- char *dmabufsrc1 = NULL;
+ `! b( d+ U E+ g! u# p: ? - char *dmabufsrc2 = NULL;1 R3 V* k0 @/ w, C
- char *dmabufdest1 = NULL;
# \( o6 L$ y2 H4 M' m6 N: [) X4 A - char *dmabufdest2 = NULL;. b/ V/ @- B G8 F
7 F0 a, A* s1 r* |+ l' }- static int acnt = 512;
6 | v! G) o+ I! W0 N: {5 z1 R - static int bcnt = 8;
: U' B" C0 J" {& f - static int ccnt = 8;2 {7 d1 ?2 _ }' ]9 `, Q
+ q6 R- q0 J5 i" W: |! Z* j- module_param(acnt, int, S_IRUGO);6 ?9 x, b4 x% N; V( a( p2 X8 u- w
- module_param(bcnt, int, S_IRUGO);
. h3 q" W- _; d# H - module_param(ccnt, int, S_IRUGO);
复制代码
! H& d& f/ J( L& L
' p) f( ~# K% g( e/ v9 M. W" j; r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 ^6 w; m) @) r: @2 J/ d% aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, ]$ a/ H, c: w% o7 w! c6 f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! A; ?. W! k' k1 Q4 {
( m. D2 u& t" @, V9 l1 f( _" n
* W" e0 K, @) ]' s0 H' J; l _# i |
|