|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , n$ ?* h" H9 f5 I1 T' M, H
- [code]EDMA sample test application6 p( {. h) S( p7 H8 ^* r. o% m% ~
- /*, f: O( G8 C% i7 o M
- * edma_test.c
1 H+ p% w* D* {) C+ V. h - *) g( t9 k$ z% K* m
- * brief EDMA3 Test Application) T( O$ i$ j$ ~8 y" H6 b0 H* i
- *: e. Q6 ?# w+ w$ V9 t4 x' A! W( J7 ^
- * This file contains EDMA3 Test code.
5 d; L. w P, m+ J r - *0 T8 B0 A7 R" T8 S: `7 m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! H" Q9 r* `. p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# a$ Y( [# q' k' L/ D' J# n) v - * TO CHANGE. G2 J: D6 P4 y) I3 l& c9 T, J
- *
8 ]% q# ~& o6 c! P) g4 a6 r% }" S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% h; V P+ m; @2 Q5 s! {' `' y
- *! U+ q+ ]& l- B5 N3 L/ [
- * This program is free software; you can redistribute it and/or% L5 o( v: J. z; G: _
- * modify it under the terms of the GNU General Public License as
8 |* u; ~, _8 H; {* V) _/ ~! o - * published by the Free Software Foundation version 2.
6 q. ]) u" G- h& u5 F" I( P1 Z - *
# {6 v( s. Y. r( H4 ]8 G: X- H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( n4 L# F" l: w0 S7 w3 D
- * kind, whether express or implied; without even the implied warranty
! Y( @+ I- n/ j& d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! ~. v( Q7 s7 o! a# V) \1 q
- * GNU General Public License for more details.
5 [' B0 }" L! t# F/ u# |# p9 g - */3 m3 r. E: H/ Z& S7 F$ C
9 B: i4 C8 I0 o; Q$ p) I' F4 {' Y- #include <linux/module.h>
3 Z, }+ R8 a, u0 o - #include <linux/init.h>
6 C: H3 n, g5 f' d% f% I1 I - #include <linux/errno.h>8 U5 G G# x$ v: e( c
- #include <linux/types.h>
% k1 V) |8 D0 [ - #include <linux/interrupt.h>
2 \: S4 G! V% I$ w: ~1 g4 q - #include <asm/io.h>/ i% r$ q8 n9 L% J7 t% Q- k9 u
- #include <linux/moduleparam.h>1 O2 e; E* _8 A4 r
- #include <linux/sysctl.h>5 @' K+ H b9 ], A) ^+ v1 l1 [
- #include <linux/mm.h>' X9 U- ]/ r( f0 V
- #include <linux/dma-mapping.h>1 u5 n/ k3 i% P
- 6 w% N* M7 b7 b
- #include <mach/memory.h>+ z, C! h3 K+ b
- #include <mach/hardware.h>
" C( e: Q" J. t) b- A - #include <mach/irqs.h>
x. F, ^9 X1 j6 \/ B8 ~# r - #include <asm/hardware/edma.h>
7 e1 r0 F. C1 i" L' a# n6 d
. D' n# C' `3 f, u- W! T5 G- #undef EDMA3_DEBUG
# l9 Y# ]% e7 h! s2 n( h7 f; D - /*#define EDMA3_DEBUG*/$ g. `5 D3 ]& K1 F6 H6 I
- ( N: j0 v' f+ k% Z( ^: w
- #ifdef EDMA3_DEBUG& @: }$ n7 F* _, {0 I- V( T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 ]) b }/ N# A/ ~0 i/ p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 Q4 e6 L2 C$ Z$ U) n3 f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 E+ [: @& ^% r- b& z [ - #else
' H- u& y- f# e - #define DMA_PRINTK( x... )( B. \* _7 R8 `, U' K! O7 p
- #define DMA_FN_IN; _& M& B2 m& [* k0 d
- #define DMA_FN_OUT
* Y8 Q! @0 E$ K/ k - #endif6 N. L" n) K0 b7 I1 `! P
- 0 N' p" v7 o" @8 z9 A v5 j0 S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) ?7 a J7 V) c# K1 q
- #define STATIC_SHIFT 3
0 d$ ?4 Z# S' z0 T3 r - #define TCINTEN_SHIFT 20
+ Q; u5 K' p2 w - #define ITCINTEN_SHIFT 21; U2 @- s- {4 }/ e) v# K
- #define TCCHEN_SHIFT 22
9 W/ D- L9 W7 j/ D - #define ITCCHEN_SHIFT 23
3 C' a2 }& r8 p3 U/ I - 3 Z. S6 U# e5 ]3 q& Q
- static volatile int irqraised1 = 0;
8 l& e6 T6 z" X0 _5 A8 J) m - static volatile int irqraised2 = 0;8 C) Q; A" b# i+ D" k
- 8 A+ D# i" A6 V$ U4 J6 H& a% T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, q' w" S! U9 w. p% m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; [$ c# _1 B/ ?& C9 ~$ S6 t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A- Q& s/ _: i/ y
- - [4 a% ` H& L6 S, T
- dma_addr_t dmaphyssrc1 = 0;( M5 C: _1 R, c" M: Q) E& _
- dma_addr_t dmaphyssrc2 = 0;
4 f, o, U3 V' q - dma_addr_t dmaphysdest1 = 0;# Y' q! q% p- X* G( D- y9 L
- dma_addr_t dmaphysdest2 = 0;+ f- u% B) [0 {2 |/ t. S
- " s/ n8 R0 K$ h$ B. @# K% u3 f# w
- char *dmabufsrc1 = NULL;
+ d4 W5 b8 d7 F5 E' u - char *dmabufsrc2 = NULL;
! S& k; L2 R" m$ M* N. {* C$ p - char *dmabufdest1 = NULL;- T( ^0 ^% `4 ^$ C5 E r4 u
- char *dmabufdest2 = NULL;
4 G5 S+ s" W0 R& d
% p. g3 D& r2 l- static int acnt = 512;* }) M, M* j% P, }2 ?. b0 D
- static int bcnt = 8;
, V+ ~5 R) }8 x* B' ^2 f+ o - static int ccnt = 8;' E% W h2 J1 B/ M. |
- ' L, W: r3 [( G6 j. g {
- module_param(acnt, int, S_IRUGO);
; N" \1 H6 `9 n/ S( {% g5 Q N- T. L - module_param(bcnt, int, S_IRUGO);+ |, m! ?7 a- z$ A2 l8 x, O1 I
- module_param(ccnt, int, S_IRUGO);
复制代码 2 r0 g2 u; o7 M% Z( V
) Y+ J- P; c' k- V: t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# Y! J0 Z8 B4 f0 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* D! `$ o; C3 F0 m' G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. [0 g! K2 t8 u( P8 p
% V$ d0 |: O9 H5 P+ i. n* d- ?) t/ B Q* g" z8 @' R" J0 {0 @
|
|