|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 A; }# W$ W! x1 a- [code]EDMA sample test application
$ @1 J* M3 Q! l" Z' z - /*
. g8 U9 Z% i6 } - * edma_test.c& g1 Q7 Z4 L/ C0 P' ^# i
- *
% @% L! c( s% j/ l3 F, m. {0 T - * brief EDMA3 Test Application
) M5 H, O' R7 E( z+ n - *- O% `( e! v! U' L8 E
- * This file contains EDMA3 Test code." j& G: X9 a @, x& j& S W
- *
, \: D3 q4 S P/ Y; k+ G* o3 M: j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& k- O; h3 B2 J4 ~; P w& V! [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 Z! ?. D R& u& a
- * TO CHANGE.5 O/ f( Q7 V2 v& i
- *8 n T- E0 a" X" f9 I4 y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: l3 r. P4 ~+ F4 n7 j9 g
- *
6 ]0 M$ e- }) A! H2 G$ t6 _( x - * This program is free software; you can redistribute it and/or
6 P w, ] Q* f: G - * modify it under the terms of the GNU General Public License as. t, |7 e! ~! X6 F; [5 d# W' K
- * published by the Free Software Foundation version 2." |4 L: z3 A7 V7 s5 _: u6 n
- *
) F# R) H g/ T) R3 Q: N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# J/ _/ x$ j8 K" s. ]; H - * kind, whether express or implied; without even the implied warranty
0 [$ @- t! _0 {/ d# O! ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) N8 ]- r6 Q: R" _9 \9 M# P - * GNU General Public License for more details.3 X$ P* C# a" ~+ F) c* _4 h! z
- */
: t3 t) f) d6 d; ]4 y) ?
* H4 D; p" _. p9 Q4 e- #include <linux/module.h>1 v. z8 I, l. `( `2 R0 l
- #include <linux/init.h>; f6 U0 h; w/ [8 D3 a9 U9 j
- #include <linux/errno.h>6 d8 S" l: T P1 i& H
- #include <linux/types.h>
/ C- d2 D5 s# ]8 Q$ H" ?4 m - #include <linux/interrupt.h>
, r% W+ h$ m @1 ?1 c - #include <asm/io.h>
" F3 y% c; B( j1 p# H- e& x - #include <linux/moduleparam.h>
- @: ]' J4 s- q - #include <linux/sysctl.h>
8 ?7 a W$ b7 i q- x - #include <linux/mm.h>
" v' v4 L4 u8 n7 j - #include <linux/dma-mapping.h>
0 }9 e% l3 B2 ]/ j" `8 K - & [+ p' ]: O, F. C. ^
- #include <mach/memory.h>* }, {$ i! T# p5 P$ p- b$ b
- #include <mach/hardware.h>
8 g" f% e6 { | - #include <mach/irqs.h>
% g E/ S, G0 r* ^% T, k% K) N - #include <asm/hardware/edma.h>
% k) G W+ g3 _) q* O - + }* J! y( T# D& D% o
- #undef EDMA3_DEBUG
% }$ S& a1 J4 K/ N, y- w' g - /*#define EDMA3_DEBUG*/$ a9 D" P% {. Y5 o# A- |8 s
6 X$ [- V$ M' s; }2 L( d- #ifdef EDMA3_DEBUG3 w6 p, O! O- t, r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ z' O8 M3 \# y. t$ L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 c( [0 |& o N* p Z) y, W' L3 s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ l# N8 G& C \6 Y
- #else' N) m" n% M Z
- #define DMA_PRINTK( x... )
B$ i; b# ~' t4 C! v2 N1 W+ W4 t - #define DMA_FN_IN( `: O2 S1 y, U4 g( m
- #define DMA_FN_OUT! y5 S% S+ s7 E% B! s
- #endif
, n4 ^3 u C1 s4 B
, Y4 U2 C1 l* ^7 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* Z' h5 R$ g4 s. X% ] - #define STATIC_SHIFT 35 E, V3 \6 T6 d$ z
- #define TCINTEN_SHIFT 20. z7 a! k# i8 H. I! s1 V
- #define ITCINTEN_SHIFT 21. Y8 h4 |7 O& D
- #define TCCHEN_SHIFT 222 |2 D* Y, y; ]7 r) v% x+ @
- #define ITCCHEN_SHIFT 23
; J' q: A7 |- t J( I
2 ?$ C' X# M$ k' |2 }5 G- static volatile int irqraised1 = 0;
$ |; v w0 h* G, r6 i - static volatile int irqraised2 = 0;9 @6 e9 e# P- ?3 z) K! M. o
% x0 }. R7 \/ P. }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! O7 W: _' v4 ^8 A, p- Q U' {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 r# r! g& C# f1 w7 c0 L* K9 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) u& O, w( [" }; b' i9 P- W
# Y& t' k9 i2 r- dma_addr_t dmaphyssrc1 = 0;
+ ~( ~$ b/ i6 U8 q2 j; J* A - dma_addr_t dmaphyssrc2 = 0;
; m" K) y U! c5 V - dma_addr_t dmaphysdest1 = 0;
3 R& f+ p3 C9 S% [* T8 h - dma_addr_t dmaphysdest2 = 0;
* I0 f. l5 a0 z& O" D" q
4 u) t2 J) G1 s. }1 u z u- char *dmabufsrc1 = NULL;% r0 Z* b- a( H! V' K" n7 M. Q
- char *dmabufsrc2 = NULL;; E, \ E8 b) a* G3 Q& J
- char *dmabufdest1 = NULL;/ p6 O3 p0 t8 q& u) e6 L: A
- char *dmabufdest2 = NULL;
9 ?% w8 v9 B. `6 b$ X* V7 g# Q7 I
% q9 B, n e" Z/ z- static int acnt = 512;% ]* M6 d& ~8 G
- static int bcnt = 8;
6 @1 c m& ]! b8 b- I2 x0 @: e - static int ccnt = 8;
& I0 W! P7 y" B* }
+ V; g1 K! o+ @+ i1 X) N8 Q- module_param(acnt, int, S_IRUGO);6 _% t; P- T1 e' j0 D" H# H4 f6 M
- module_param(bcnt, int, S_IRUGO);
" f1 f; n& h, f3 [5 D" { - module_param(ccnt, int, S_IRUGO);
复制代码
7 E! Z; ^0 d8 U; [: ?
& T7 o# k, O8 ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 G3 V: ]5 V* m! oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, k+ t" h' v3 d- V0 u7 n% g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 ]5 ?) E7 Y: K3 k
$ p9 q7 E& L; g$ `/ l' }" D
! }- x! t6 U' q, ^, S |
|