|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ~ V- s+ N% @) V8 |1 J7 j0 V
- [code]EDMA sample test application( j) Z& D9 Z2 T8 t$ L4 g! j
- /*
' J3 y; c" E8 w8 m& ~ - * edma_test.c
1 g; t) Z; h: O4 r+ _ - *. [% V0 y( Y/ V& @& K
- * brief EDMA3 Test Application1 E9 L& f. l3 N1 [" b
- *
4 w' m9 L! a4 ~, h/ ` - * This file contains EDMA3 Test code.
# D5 q9 t& u1 l! s- i9 |) M - *
: p \6 z0 H$ E! _# | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( e/ K* C3 X5 _- O+ C7 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ j d! i; y/ I - * TO CHANGE.
# v3 H S. f' ?. Q9 R - *: d& y7 y% W; m- Q' H* u8 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 @7 Q. J# T" r B
- *
& l- }( X6 Z* s" z5 I - * This program is free software; you can redistribute it and/or/ _# T/ e4 \2 J5 i# w6 i
- * modify it under the terms of the GNU General Public License as
3 U7 W5 S& ]& X5 X* |7 S9 o2 u3 _ - * published by the Free Software Foundation version 2.3 y$ n- U. j* z5 I
- *0 m3 ]) z& c; g7 h0 e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Y0 Y+ ?" r# ~% \8 V- d9 p$ z! I
- * kind, whether express or implied; without even the implied warranty) W, d- n( C5 S$ }1 Q* y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ O6 d0 N7 z3 o- F. j0 n% V - * GNU General Public License for more details.
! b x6 @$ i; f" l4 } - */0 I" v% \0 Y& X
+ F R$ W4 @; ~- #include <linux/module.h>
3 B& B D- b* l# ^% \ - #include <linux/init.h>; V6 a! } O4 y8 X9 j
- #include <linux/errno.h>
# n+ G C3 A. @) R7 [. @" G: a - #include <linux/types.h>% [( T! [, C' T2 \
- #include <linux/interrupt.h>
/ T5 z; Z' r& W5 Q - #include <asm/io.h>6 p' k- E7 V, M. ?9 c
- #include <linux/moduleparam.h>
+ t- C: K0 Z( H3 y1 I5 H: e6 @ - #include <linux/sysctl.h># d6 A- @" z' B
- #include <linux/mm.h>
* _8 d' Q& k$ T( H: l9 i - #include <linux/dma-mapping.h>
* J" k0 {' B/ V. [7 Q0 i
( x" \# [' \. |$ U: j! r6 [- #include <mach/memory.h> `" w! n' x4 d& @5 g& c
- #include <mach/hardware.h>
7 ?, F5 i7 `7 A0 c" |) s% E7 d - #include <mach/irqs.h>' U1 e: Z6 S2 x4 j2 P; u+ x/ S
- #include <asm/hardware/edma.h>
7 Q4 f$ Y7 C& G. s1 R
0 ?; K) P6 Y4 K5 j- #undef EDMA3_DEBUG
$ |+ k- l% h+ e) e* `% W' v - /*#define EDMA3_DEBUG*/
& Y+ `- h" l+ `
: ]+ F* S3 S! Q* U- [! g$ {% |$ L$ H- #ifdef EDMA3_DEBUG
( R' H4 i0 y( y' Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 k1 O1 K2 [: ~9 a9 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), F2 [6 d1 t3 @4 M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" g' S% i5 c9 S0 v1 ^/ Q
- #else. V7 z! S; @; a g9 } @
- #define DMA_PRINTK( x... )/ a: D' S# _8 y6 Y6 S
- #define DMA_FN_IN/ |7 u( h9 ]3 J" L( M4 ]4 u
- #define DMA_FN_OUT
* I( i$ p/ B: Q3 ] - #endif
4 S! |* b* X, y3 t& f8 T - 2 a9 r5 h8 q" E2 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' j7 `" W7 o( b - #define STATIC_SHIFT 3
/ F* [! p: F8 z+ `; a% P6 [: D. Z - #define TCINTEN_SHIFT 20
* A% ?+ `6 h$ r' \% m9 X% v - #define ITCINTEN_SHIFT 21: `0 H0 u% A- @( D2 P: y5 L2 K
- #define TCCHEN_SHIFT 22
2 S+ ^9 H; h& M! x - #define ITCCHEN_SHIFT 23; J" J5 c9 y$ v& o, Y! n
- 4 M5 d2 W6 ?2 Y& f, Y/ _
- static volatile int irqraised1 = 0;7 `6 n2 h# o6 M
- static volatile int irqraised2 = 0;
* P( U" q3 Q) W- i6 F' o, i - 5 R8 r) z* G. n' V. I: V t W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# I2 y, v3 i. D+ l, a3 g# I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 {$ b/ a1 W+ o) ~- H: V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# \) V* y4 `/ W& H
: v# ?# R4 `; H; g) Z7 ?. P. a- dma_addr_t dmaphyssrc1 = 0;
- Y1 U* u% f* S0 A - dma_addr_t dmaphyssrc2 = 0;7 E8 d* E" A4 @: N: ]4 t" a
- dma_addr_t dmaphysdest1 = 0;* W& ~8 F2 e& I5 U* e
- dma_addr_t dmaphysdest2 = 0;
( s/ ^; \& A3 N- B
- g" v# E. M d) N1 b2 m# n- char *dmabufsrc1 = NULL;
x, K- y% U2 C+ a$ M( E - char *dmabufsrc2 = NULL;
% y& R3 N& l/ {. T" M, E - char *dmabufdest1 = NULL;
" t1 @' W9 p' g% ~- g: _0 W/ M - char *dmabufdest2 = NULL;. N, @8 u! ]3 {4 K' O; F, |5 ^2 g
% X$ X$ _, f6 O3 N- static int acnt = 512;1 z& n, ` h; U! r0 L& r
- static int bcnt = 8;
! d8 G8 Q) O/ E - static int ccnt = 8;1 p0 X0 ^: b8 ]& }" Z& E
$ t9 K8 f* f6 K/ S- module_param(acnt, int, S_IRUGO);
- O: ~- l: W- a; X* H4 ` - module_param(bcnt, int, S_IRUGO);
7 d' p. v: y+ d - module_param(ccnt, int, S_IRUGO);
复制代码 % M1 C+ J# [1 |5 ?) J
9 n/ e& a5 }8 H) g. l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ Y0 @) f; P* U( {: f: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! u0 u1 E. Z- J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
^! W. l" i' b
( E% N+ {2 Q6 E/ R/ g, V$ J% [# c& X
|
|