|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& C) F9 h, d8 Y9 o' M' R, G+ N- [code]EDMA sample test application
% N0 x2 z4 l" ^8 K/ w - /*! P- ~5 R* u ^2 u# J9 Y+ D7 ^ ?( u
- * edma_test.c" R0 l% ] o7 ^1 B
- *' k$ T: P4 p, [
- * brief EDMA3 Test Application
* X8 |4 w" l6 I# ?# j - *5 w* E1 ~% A+ E5 M( h
- * This file contains EDMA3 Test code.
. B, S, r$ {5 Q* n: Q - *$ \2 l7 P. h+ Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% _" P' W7 X$ H" R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& @0 B% `7 z9 v% ^* B- c, `& W - * TO CHANGE.* F( i2 Y+ I: J5 j- [' K9 }
- *' G. a* _5 F3 y, Q! R' r3 @$ j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 L8 [( ~3 X9 w& j: C5 I/ h - *3 w# _( e/ I! n9 w H, J2 z) k
- * This program is free software; you can redistribute it and/or
9 P1 c; ]1 q* o - * modify it under the terms of the GNU General Public License as
2 [' c% P1 G4 U# q( D - * published by the Free Software Foundation version 2.
1 u$ g6 o X' h9 b - *
" \: A3 D% I1 d& h% M t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 F7 D0 B3 y |
- * kind, whether express or implied; without even the implied warranty
; y. M) P' K8 Q" p" O0 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" G; m5 [% K) S5 h! e
- * GNU General Public License for more details.
( L: K' y q- ?. n - */% d' f# C) w) h2 A0 W' U
- " ]4 H8 f( J: s, ?$ y8 S
- #include <linux/module.h>
; Q3 y; ?9 y$ `3 p! d - #include <linux/init.h>9 Z$ a9 N1 v* \& h& X0 d
- #include <linux/errno.h>
, }% y5 y4 X# F" i. B9 q4 o - #include <linux/types.h>5 U; N9 I5 R/ Y
- #include <linux/interrupt.h>
( m; `$ J+ v, k# {7 s4 G9 S- X - #include <asm/io.h>
" ~' b9 c% I7 y3 Z - #include <linux/moduleparam.h>6 I, O% }: r0 S! A/ U+ v( ~
- #include <linux/sysctl.h>6 I7 g7 f2 h2 O7 f! e" j. L
- #include <linux/mm.h>
: B7 \8 O/ E7 R- a, z- y - #include <linux/dma-mapping.h>1 ~. b" `+ m$ A" ^
+ `' E; W' y$ P2 q- #include <mach/memory.h>- u/ Y) y; i g
- #include <mach/hardware.h>
9 j. p: V8 d/ |8 ~. R - #include <mach/irqs.h>+ c6 d1 W3 t3 ^7 p
- #include <asm/hardware/edma.h>* t2 t! c6 {- ~; {1 S6 I
- / H D2 Y, W q$ C
- #undef EDMA3_DEBUG/ `7 @8 S* p) _6 T) K8 U9 t- c
- /*#define EDMA3_DEBUG*/, S4 }, ^/ y- t2 f+ ]) @' P. M
9 E0 O# C- x1 R2 V4 P! x- #ifdef EDMA3_DEBUG
R8 M$ M) A5 c0 Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 W0 @! r: [5 K; u8 X0 m% V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 T) `, n2 N+ o3 _6 i- B! X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* c$ a2 w( A8 ]( Z) l1 \ - #else
2 f/ T2 H7 f, E - #define DMA_PRINTK( x... )
+ V# q0 R0 J- V - #define DMA_FN_IN
& @" W$ z% _2 m/ t, B! a0 } - #define DMA_FN_OUT4 }, i! C8 l6 Y6 j6 n' j
- #endif
& u. }) |* a/ j4 E - % ^: |% v" a6 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# u. d q6 a* B2 w% O6 t - #define STATIC_SHIFT 3
$ B9 t5 h4 u7 a2 c6 o5 I - #define TCINTEN_SHIFT 20$ l& O- o, \! ?
- #define ITCINTEN_SHIFT 21
1 v/ P5 i" k) H4 L$ |% X8 a4 b - #define TCCHEN_SHIFT 22
3 B6 r+ i( ^8 g. ], W - #define ITCCHEN_SHIFT 23( A2 N0 }; F! X/ C: @
- $ j+ j4 m2 V7 L/ V: }) c2 w$ g
- static volatile int irqraised1 = 0;: k7 s# G: ?3 g2 s' B( k6 j
- static volatile int irqraised2 = 0;
! A9 ` l+ I- D
+ j% A6 `. \( A1 `9 h4 |4 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 i% c" L7 Z9 y% j0 @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ q3 b4 m) u( n) H+ `$ P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* T/ `( o* G6 r+ H
6 E$ I* k* _( R. @, ]4 O- dma_addr_t dmaphyssrc1 = 0;
' C! P5 `- |) W - dma_addr_t dmaphyssrc2 = 0;( h6 H J, U# ?( \
- dma_addr_t dmaphysdest1 = 0;
( M' T( l) v" U: ^, j. S - dma_addr_t dmaphysdest2 = 0;
3 X' N- O' s6 c/ L) R- l' X* t& q
& P1 e# ~" P& d$ O. \8 `0 y- char *dmabufsrc1 = NULL;
; l& D* z- d' e: c' L. [2 Y - char *dmabufsrc2 = NULL;
4 b+ f" p5 a# u5 N - char *dmabufdest1 = NULL;1 g7 e- b+ G* L$ v/ D% S4 g! }
- char *dmabufdest2 = NULL;
* ]! }9 Y" _5 Y. u F1 m' |% d
9 Q3 V$ v7 k2 L- x' X* |- static int acnt = 512;
& e/ r7 O2 T- t3 Z: @3 f# y - static int bcnt = 8;
: p/ @$ e9 }8 W6 u' D - static int ccnt = 8;* f5 I" H, M3 {6 p! G
7 p7 R+ t4 s/ {5 h6 m$ a2 Q- module_param(acnt, int, S_IRUGO);% N, g9 i( V( l5 P) `; v0 o
- module_param(bcnt, int, S_IRUGO);
0 L0 I! J1 A d - module_param(ccnt, int, S_IRUGO);
复制代码 9 F. |" h3 c9 A
9 C% C! x* O6 q* _" h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 t+ j( Z6 i& _& I& j6 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ G8 X7 Z9 ?& _9 h ^8 ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% x% X! p+ Y+ m* B4 _3 B2 [
7 |# t8 V* i5 u0 |% ]6 N/ O( a
& {. @2 L* v% Z. C. A1 o
|
|