|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / g8 h7 ~- |) b0 }
- [code]EDMA sample test application
; V: U0 Y% ` b8 n4 O( Z - /*: U6 }- e% z# B. v( A, h1 b2 }
- * edma_test.c
% M) h# i+ U; N) O. F6 R; l1 ]/ \5 A - *
9 I3 w6 t$ S6 }* p - * brief EDMA3 Test Application# o0 Z1 t' Q( r O
- *
2 o6 s* e5 a$ Y" y: B - * This file contains EDMA3 Test code.
1 a1 w' J p% b! Q3 B, K6 M4 D - *6 |+ o* f- d! d0 P; f" p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. S) l6 z6 ^: w! x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 o: \* ^- W6 w4 P - * TO CHANGE.2 W2 c. h5 @( i2 z0 K
- *+ `7 P$ d2 ?& E& I& B! ]3 S9 M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; \$ ^* q" Z2 r/ [; ^* e1 |9 f
- *
; M q' t Z% I' u - * This program is free software; you can redistribute it and/or# Y; Z8 }% }4 N* m7 w4 u# V
- * modify it under the terms of the GNU General Public License as
: |( B, h) R* [# e( c - * published by the Free Software Foundation version 2.
' W% }' H) f0 y0 Q0 F O1 V - *
; d& Q N- s3 n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 G# O, @- P- p. @
- * kind, whether express or implied; without even the implied warranty4 y' D- m+ N+ {/ R. A( }8 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 t/ z% n0 K5 i - * GNU General Public License for more details.: N8 K; E& V$ t/ a6 o/ [
- */
0 d: t7 h5 H. ^& r1 n( |# r - ( G! p3 k- `+ }' N# ]
- #include <linux/module.h>
! }* _/ B! I; G$ ^* O, O - #include <linux/init.h>
9 R5 @6 T/ t9 V% }9 @6 N - #include <linux/errno.h>6 T7 h5 o1 V8 [. v9 M
- #include <linux/types.h>4 d! X) P C% R4 H: P/ h2 G( j
- #include <linux/interrupt.h>& G6 j( p0 X! z3 a
- #include <asm/io.h> u: U; e, S# T }0 P
- #include <linux/moduleparam.h>% a) o$ }) k- }, q
- #include <linux/sysctl.h>
- d/ {6 p. O2 l( k - #include <linux/mm.h>( K, G" [$ ]5 n% Z9 P* C
- #include <linux/dma-mapping.h>! I* Y8 l7 I9 U5 G
. l- C1 Q7 x- ]- #include <mach/memory.h>6 P. m+ \ R' ^
- #include <mach/hardware.h># \2 }+ _+ \+ v, N# u5 b8 q
- #include <mach/irqs.h>
; m. s5 h( M s; R1 Y8 G - #include <asm/hardware/edma.h>- h: K: C7 C0 j0 X" I' M; N4 @! P& Q9 g
! v5 j2 K2 Z- ^7 Z% H0 {- #undef EDMA3_DEBUG
& Z1 o# e; i$ R: _" E9 n - /*#define EDMA3_DEBUG*/
9 Y9 H5 r! H9 m. L. D
0 m ]/ r# \' n k% x% t3 v9 `- #ifdef EDMA3_DEBUG8 Z- d/ G. O U7 P2 V9 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 \2 S; |# H" Y, |% s" Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 h* S7 K/ L3 F+ h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( _5 f- w5 Z: f; ~
- #else
: M% t- }6 U1 O7 u# i - #define DMA_PRINTK( x... )1 U3 I0 \5 Z: {* E* c! j
- #define DMA_FN_IN
p ^, ^. y8 K - #define DMA_FN_OUT
' ~' ]+ O% Q' \8 m% d7 ^- o e - #endif
( Z% l t0 k a6 @ u0 w
6 c$ Z( V5 R" C, J! l. ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 u5 Q4 Z* B! c* [2 j/ ~/ _% Y5 Z; R
- #define STATIC_SHIFT 35 X9 C- {6 s( c& r% ?
- #define TCINTEN_SHIFT 20% d) f8 Q" B. c9 f1 c r, |0 y
- #define ITCINTEN_SHIFT 217 K/ i8 Y$ Z i- y. b
- #define TCCHEN_SHIFT 22
$ S# [3 l6 K F" b9 S - #define ITCCHEN_SHIFT 23
/ f3 f6 a9 ?3 t* c* y) F - # Z: h( [4 D" b. }* l
- static volatile int irqraised1 = 0;
7 b. s. F$ c8 |0 O: L - static volatile int irqraised2 = 0;
2 G6 M6 F& P4 V: ^9 c
- R2 t* \9 | Y) x, \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; C0 [) `/ f. W- _. ^- H, l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 @2 N u- |7 l! W- V' i2 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& G1 Q+ @' D, O. h
2 w1 K0 e/ A5 [0 |$ \' N" w- dma_addr_t dmaphyssrc1 = 0;5 z2 t, I; k0 S# T
- dma_addr_t dmaphyssrc2 = 0;
, |. t2 E. W6 B" { _. y/ k - dma_addr_t dmaphysdest1 = 0;
6 b8 j8 E& C- E4 h; j' N - dma_addr_t dmaphysdest2 = 0;% c9 w9 u2 ~( S3 K" }7 G
+ b# O9 l) B0 B. J2 O- char *dmabufsrc1 = NULL;! d; b* ?/ F$ X
- char *dmabufsrc2 = NULL;
/ a! v' b. T! m1 L* |, s - char *dmabufdest1 = NULL;
2 \1 S+ S T# G1 Y W! d - char *dmabufdest2 = NULL;
4 A7 k/ }" d6 G2 b, `" L
. V2 x, H# O$ P/ o- static int acnt = 512;
( g7 l) f, t; Q' k* a - static int bcnt = 8;
) ?) f7 k" L+ w1 K9 p - static int ccnt = 8;
2 B. J+ j& D9 v" i - 3 I. x' T4 z7 t, `: m/ P4 I
- module_param(acnt, int, S_IRUGO);; S# t m/ s( m) Z& S1 L% p
- module_param(bcnt, int, S_IRUGO);
0 L Z5 f9 y4 _/ x4 t$ D - module_param(ccnt, int, S_IRUGO);
复制代码
- Q; h [' g. i$ p! k3 W
! M. y( e3 u2 o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 a9 J( g, x% c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! b, J3 o' Q, f+ m7 k* ?- u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 e2 O4 z" p9 `# R. I4 v! d
. y8 h! x0 Z( i
4 j! n T% o6 P8 X" U" c |
|