|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 F% \3 ]! [* y# P6 U2 M
- [code]EDMA sample test application
/ z( w( w$ S d1 J( Y3 o - /*
8 d9 _8 |5 |/ K' [% S - * edma_test.c
' }3 Y3 O% D" P - *
- G; u9 Y, r; l/ [! d6 a! O& m - * brief EDMA3 Test Application9 a% U+ a6 T: U! x2 ?: s1 z3 i
- *
9 p( }0 k, p8 Z0 @4 p - * This file contains EDMA3 Test code.) d9 o" b5 D! I$ B
- *
9 k. H- g( y% t1 y5 y0 \' u8 Z% z- I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. V5 e/ d3 X9 w4 g/ {2 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 U6 x l1 J! K( K+ ~3 B. f2 g - * TO CHANGE.$ t2 P- _8 l3 l5 e/ }, b
- *- v% D Z0 w2 ?. |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ Q8 ?7 Q: r2 n/ i4 w- a+ P - ** `3 q* e& R& j- g6 E6 n# w3 ~
- * This program is free software; you can redistribute it and/or
1 y( F- |3 a+ q3 g8 w; w - * modify it under the terms of the GNU General Public License as$ X2 w! H. X9 i* `4 v
- * published by the Free Software Foundation version 2.
+ \2 k1 m# r4 ^2 z! O' S* y! ~; g: @ - *
4 G& P7 U$ a- g& d8 c" m) Q6 l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ z& D1 `7 V$ G( Q% t - * kind, whether express or implied; without even the implied warranty7 Y: `" ]$ j, }4 ~/ k; ]& V! S3 G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 F( {2 Z( f6 |/ m0 W+ J - * GNU General Public License for more details.
# j% X3 P& ]6 [# { - */ }# b0 V1 w" P9 g0 p
3 X9 W. E/ g* Z& Z, ^% s& U- #include <linux/module.h>
8 z$ ]# p( X) e' [7 r - #include <linux/init.h>
3 r4 d, `5 k9 @+ v& ?' ? - #include <linux/errno.h>
5 I* B+ u. y0 g - #include <linux/types.h>
* }0 E3 x4 r/ {, Z" @ - #include <linux/interrupt.h>6 f4 P+ h4 b# F5 t6 g/ _9 J+ \
- #include <asm/io.h>
, b: C7 s! J# l - #include <linux/moduleparam.h>- D& l, q7 w% ~4 U5 x O- e
- #include <linux/sysctl.h>1 S/ q' a& t K5 q6 ~
- #include <linux/mm.h>
W7 P# G* |: {, p. o ^' s& o+ ~ - #include <linux/dma-mapping.h>3 ~) v r7 Q3 s, m$ s c
- # q5 D# p1 T# D8 T5 c4 e: I, z7 l
- #include <mach/memory.h>
" f9 o1 q0 B) r' ]9 a - #include <mach/hardware.h>1 x+ d, @# u% U2 L k
- #include <mach/irqs.h>
4 S1 M( P7 R. d8 F; d - #include <asm/hardware/edma.h>7 n. g3 ?- @% `; ]
- ! V; H1 j3 T7 _8 h% @
- #undef EDMA3_DEBUG
. W. J1 E9 S* @! _2 E: A% c - /*#define EDMA3_DEBUG*/; k9 i; U9 e; Z8 a3 G
3 F. ]1 M+ r+ K3 K* H1 E8 j7 p- l- #ifdef EDMA3_DEBUG/ f i6 S$ q) F E2 b5 U P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 Z4 ]* T9 V' P2 e1 Y7 N) ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- J0 {! G: q8 n9 y$ Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) I* b) y/ M3 @; W3 u$ T
- #else0 K% a- H; y, D& B
- #define DMA_PRINTK( x... )' D& [" V( S9 @9 e' \ S; L
- #define DMA_FN_IN
& I: p# Z9 ~& A3 p - #define DMA_FN_OUT
' D# \% r9 [8 m6 l0 q - #endif
3 E2 s: w7 v E4 V
, |/ N7 s! a+ o' S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 R Y8 a" j4 S8 y- W& |6 q
- #define STATIC_SHIFT 3
. U% ^4 g! d9 K8 `) ?- x - #define TCINTEN_SHIFT 20. v9 `9 B2 n9 i8 t' E- ^! ?- J% \
- #define ITCINTEN_SHIFT 21
4 ~8 @! E% |& U% o5 o: f - #define TCCHEN_SHIFT 22
9 M8 V' }! B5 Q- ^$ }( c4 ^ - #define ITCCHEN_SHIFT 23
k0 ~0 s1 F5 i5 y
s$ x1 `4 Y) \+ P9 o3 {- static volatile int irqraised1 = 0;
% [" S$ N5 N7 R! a! t% ~. H" I0 I9 G - static volatile int irqraised2 = 0;
# \: }: @, ^- {$ k' F" T3 G
* w, o. I7 O4 T' S; m& f1 |1 v# S+ s2 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ^/ I6 {8 d$ t9 ]' @6 V* V1 C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }8 ^; v: ^' ] X9 K/ r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ S8 V$ J4 c/ r9 y
: O W7 b+ g' D* x! l$ \- dma_addr_t dmaphyssrc1 = 0;7 e8 Q# i: S* j" D$ S! v
- dma_addr_t dmaphyssrc2 = 0;
5 ]$ S4 A/ N( p- W1 S8 E% W - dma_addr_t dmaphysdest1 = 0;
! o C- E- H, m8 m - dma_addr_t dmaphysdest2 = 0;
# K. m, Q* M& k. o - ' c! o- N0 }7 B+ ~2 q/ I' \
- char *dmabufsrc1 = NULL;8 a7 |$ S+ A* O5 r" N$ j
- char *dmabufsrc2 = NULL; G5 Y0 d' Y; g4 l+ b7 @8 H' E
- char *dmabufdest1 = NULL;! Y2 z( y& p3 r
- char *dmabufdest2 = NULL;; A. x) O3 r2 a7 i
- : C, |: z4 C7 ~! |
- static int acnt = 512;# G% L9 I( t5 C% F
- static int bcnt = 8;9 V. N! h4 N1 s
- static int ccnt = 8;* ^0 e& Y1 T; m! M) ~9 t# a
- 7 p% c- X( }6 M
- module_param(acnt, int, S_IRUGO);
1 b/ H" O) t! {" J D8 h' E+ n - module_param(bcnt, int, S_IRUGO);+ I' j6 u; R1 [
- module_param(ccnt, int, S_IRUGO);
复制代码
+ k1 v2 I1 W- g" T% v. M' t) W% G* r0 z/ n N g, g- B: _! a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 @- }9 N" `5 A, `( J1 k8 R& ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" U# p3 `! [, x% A7 @6 ^3 E% v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 k+ X% V4 [* O6 Z* R. f+ ^
* J w3 n5 I) C; C9 e2 @
8 c1 @2 M3 j2 ~& V! g |
|