|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' G5 i* `3 ?3 F- q- X/ o
- [code]EDMA sample test application
( [% L+ e6 ]6 P7 P - /*
/ m0 F7 Z+ n' e- l8 c* E' N! y - * edma_test.c
+ J9 K4 Y& I6 }7 I - *2 e( @; l, H. d0 q
- * brief EDMA3 Test Application
) C! ^7 p( P6 Q! ` - *
0 {' e1 Q' y, @7 O; H" T8 v - * This file contains EDMA3 Test code.: k' X% F) t" ]+ x9 e& M* [2 x
- *. [4 v) H" u9 k I( k0 e0 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ w' c9 ^6 ]) @& X5 ~- K$ P6 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 v$ C6 u. A# V. H L - * TO CHANGE.
* L+ D# _( K3 Q. D8 O& z9 Q4 m - *
; b7 X0 i( K* X) }6 q& w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
e, ], X B/ c& ^+ d/ I# e, e8 p8 d' C - * o7 ^0 j- j6 F4 o9 O4 Y
- * This program is free software; you can redistribute it and/or9 L' w8 Y- a& g' k6 p$ w
- * modify it under the terms of the GNU General Public License as
1 G0 O* \: J7 c - * published by the Free Software Foundation version 2.
4 I2 v5 v# Y) M8 v% S2 M - *' [+ ?0 B F6 G' G8 J( F. B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' E) J$ }9 Y3 P8 ?
- * kind, whether express or implied; without even the implied warranty
! V0 q& W$ ]9 \0 R! x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# _. W* W) S+ r: j# S2 R z - * GNU General Public License for more details.4 \+ y) w6 ?/ T; ?7 c0 q$ s
- *// m: N* a3 S! O# T
0 M! j. g& ^8 g- #include <linux/module.h>: M/ R. f$ V3 X( t5 |
- #include <linux/init.h>; }3 g4 d* l- _9 [2 A, K8 @5 X+ ^
- #include <linux/errno.h>' a3 z6 o9 G% c& a9 V) H
- #include <linux/types.h>
+ ^: G U& _& o0 u2 n" ?/ x5 o - #include <linux/interrupt.h> p: e7 J& I( t- b+ C( J) K
- #include <asm/io.h>
" R q1 g1 ?! d9 G5 W$ }7 c - #include <linux/moduleparam.h>
8 x& W7 R* G0 }2 K - #include <linux/sysctl.h>
$ Y- m) G# W) c/ j9 F - #include <linux/mm.h>
" [" z% {3 R6 q5 v3 S$ ]+ [; {1 ^, N - #include <linux/dma-mapping.h>
. G; z; O+ M/ M - 8 H; l+ B. F8 X! F! J. U$ ?
- #include <mach/memory.h>/ ?; _' W# |/ k/ U( C8 r; w9 f
- #include <mach/hardware.h>
6 z+ P9 ~# V% s1 X - #include <mach/irqs.h>
# j6 V0 k# m7 O - #include <asm/hardware/edma.h>/ _. w! ~, B; e; S8 V
- 7 n& @6 _3 Y' K6 J
- #undef EDMA3_DEBUG! X7 Q" B% V: ]( O! A
- /*#define EDMA3_DEBUG*/
3 k- h! b& C: M$ u - 4 j. @4 }; Y' O3 J: Z t
- #ifdef EDMA3_DEBUG
; i Z c' T/ ]* G' v9 g6 A5 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 c4 f5 t% l- ^: P, G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 [7 }* ~2 H# l( Z+ M+ b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 S( b# n2 Z' y2 P3 v$ v$ S
- #else
3 H+ m( G8 I. ?. {7 Y: b6 S - #define DMA_PRINTK( x... )
& N4 K% q8 G7 w& H$ a' I0 g3 Y9 b - #define DMA_FN_IN4 D8 @ L5 U4 W
- #define DMA_FN_OUT. P6 o$ w* a, c* _# n" P. Y1 o
- #endif3 H3 z/ r) @. E; c
' j3 H. l! `- W7 @1 T8 K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 n1 V3 |/ p; G7 k' f
- #define STATIC_SHIFT 3
. J8 c0 k% d! Z( M% |' L: n5 [ - #define TCINTEN_SHIFT 20
, ?3 x/ S: w7 U - #define ITCINTEN_SHIFT 21
5 S$ D0 i. f1 a( Q' `3 F - #define TCCHEN_SHIFT 22
; l9 \6 k( e8 k- T$ d" V v - #define ITCCHEN_SHIFT 23- o4 p+ S" `7 P- b
- - u' l' Z' v" ~5 S" F
- static volatile int irqraised1 = 0;
C( N& {' b5 N! s' ^8 N" b - static volatile int irqraised2 = 0;; y; |8 b# C6 [7 f2 ]% ^
% ]6 m9 z1 E! E8 I5 v& v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. H* F2 g% M7 S2 s- w9 L( J1 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 P9 `5 g+ F2 ^5 y, N) a- \: {; g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* v6 S! d- G6 y
g8 Z! }2 h _& v0 V- dma_addr_t dmaphyssrc1 = 0;* ]% ~; j1 Z& }3 L4 u
- dma_addr_t dmaphyssrc2 = 0;
% k& r a2 ^: j; G - dma_addr_t dmaphysdest1 = 0;
; e4 Q8 L% S: |& q7 B J - dma_addr_t dmaphysdest2 = 0;
6 n# B5 t9 B& q4 d& x/ B
" }: N9 H% V" K" @- char *dmabufsrc1 = NULL;
6 [2 A% A. y1 F - char *dmabufsrc2 = NULL;
5 k y; t" ]7 T, m6 @7 o5 l - char *dmabufdest1 = NULL;
, ]9 @% Y0 G4 S% q4 h - char *dmabufdest2 = NULL;% g4 r1 z: {. @0 t" P6 z9 ]
' v' S$ c P) l! S* D8 I; f* x- static int acnt = 512;7 V# R* L( ~+ `( Q
- static int bcnt = 8;
6 W+ |% G" F _8 j: X. R: S - static int ccnt = 8;6 o. x6 [; F, B3 |- c- l; B
- 1 t) G) }' b% |9 h7 } J/ S
- module_param(acnt, int, S_IRUGO);2 K, L; J" E+ ` V9 N7 ^; Z! E
- module_param(bcnt, int, S_IRUGO);
5 @0 M2 j* w+ P - module_param(ccnt, int, S_IRUGO);
复制代码 8 ?; G+ `9 o ~1 I j! r
5 e9 C' j ^# H& s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 l( M2 D% N4 f- n P
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# W/ g$ V% t3 F1 F( T9 C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 B3 V& I) h) Y1 o
, v# N' r7 r" r$ ?( \- F* z0 r
) @- l0 z6 ~ ~& h |
|