|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % B8 A$ M! Q& j1 [4 I( ?' T
- [code]EDMA sample test application
' [! X1 r& z9 D, ~/ `- J - /*# ^: W5 D6 Q7 \5 e& Q) U
- * edma_test.c
b0 H- ?( Z* @2 a8 T/ T4 s4 o - *
! l w# k5 H1 m* ~ ] - * brief EDMA3 Test Application* i7 Z) O: O0 M0 W# L1 x
- *
3 k2 K% Y4 T* Z; \' [* e! f - * This file contains EDMA3 Test code.
7 Z p5 I d3 O \ - *6 i8 w- k) P( t" h% o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 B6 e* S" u: e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! H' [+ s" ?& Z( O - * TO CHANGE.
2 l4 ?# p3 V7 n( U( I - *
$ |: \/ f' i1 M) q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; j' k. j$ `+ t. H( A2 b. y
- *7 \$ R2 ?5 j1 w, ~1 N
- * This program is free software; you can redistribute it and/or" y1 n) K! Q4 ~3 E
- * modify it under the terms of the GNU General Public License as; R; f1 r2 m" G' x# y) W5 Y) F
- * published by the Free Software Foundation version 2.7 x! T8 b5 |! {+ I- c# f
- *' b1 a8 r, S' T1 f6 V5 n7 Z( p, Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# L$ b. X1 i" g6 [ - * kind, whether express or implied; without even the implied warranty
8 D% @2 j Q1 A- }# ?7 f" g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% C2 X$ W& o. _) } - * GNU General Public License for more details.
8 Z5 B; j, }8 }! `4 ?7 ?' o - */0 L( I0 w& R- @6 x; ^- _% p6 E
- 4 z) f$ c: y$ \9 S" c, s$ t3 \
- #include <linux/module.h>
6 P: P: ^! W6 B: T6 C; j5 ?0 B8 F9 a - #include <linux/init.h>
5 m" P D0 e; {% ` - #include <linux/errno.h>( I" n# p! b$ N. u$ i. V$ C
- #include <linux/types.h>6 `( K6 L: x: n. @7 U
- #include <linux/interrupt.h>
" \+ L+ l7 q) {( K# x - #include <asm/io.h>) k- R7 f& D1 ?: L
- #include <linux/moduleparam.h>
( S) ^: P) E; M; Z( b) x - #include <linux/sysctl.h>- I \1 B# N0 q3 j" R9 Y
- #include <linux/mm.h>) _4 h6 \7 G/ O. [
- #include <linux/dma-mapping.h># h0 j* \1 M: z
3 t# B' M2 q, |; z4 g! `- #include <mach/memory.h>
% o4 r3 s. ~1 V - #include <mach/hardware.h>
7 W: f0 @0 ^4 R3 c ?0 ] - #include <mach/irqs.h>5 b w8 w! m$ V! y5 @/ e) d
- #include <asm/hardware/edma.h>
( A' M) E1 \5 v6 _& L3 @
5 p3 V5 U1 s2 D- #undef EDMA3_DEBUG
$ M+ I5 f+ O# N, B9 G' @/ X - /*#define EDMA3_DEBUG*/
1 S/ U6 Y, B/ j2 R - * C( H4 A! L8 E% M' e* n
- #ifdef EDMA3_DEBUG' Z6 L" h0 E8 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* ~: {, _% y( o( z" J+ Z+ P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 g9 S4 I1 i$ g2 s3 k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ], f7 V* z) z) k7 }1 A' e. f4 A
- #else. | x( K) ^$ l' F" R; [ k& P" y! F
- #define DMA_PRINTK( x... )' z+ Y$ ^+ e8 v D& B; f% y [* k
- #define DMA_FN_IN5 W1 [$ P$ l- D- a& \9 H# Z4 Q
- #define DMA_FN_OUT7 u4 Q( R+ t7 B$ ~$ L5 @
- #endif
3 F8 I0 I) o K, J
. i3 K( l" m2 U h- v3 y7 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768); I, l h8 Q4 b
- #define STATIC_SHIFT 30 {) a# w/ b+ P, Z6 B$ |
- #define TCINTEN_SHIFT 20
. Z7 @9 a3 I$ v9 f# u# | - #define ITCINTEN_SHIFT 21
2 k% ?6 t" ]) R+ G$ k } - #define TCCHEN_SHIFT 22$ N3 u: q( h4 f; z J
- #define ITCCHEN_SHIFT 23
2 i$ G5 w2 Z, Q' E
' w4 q+ l" q/ P3 X- static volatile int irqraised1 = 0;, F5 N, b5 b5 [. h, b& g# y
- static volatile int irqraised2 = 0;
. O6 @. \# C% |: P6 \ - . V" R4 E6 \0 @9 B* f% [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; o Q1 u" r3 _7 p+ c4 ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 A A4 w* C( V% B$ V4 R( y2 T6 O$ f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ i% h, v( M4 k+ M! P/ b5 T
" \- w8 b& I- @4 m2 C7 _* _! Q- dma_addr_t dmaphyssrc1 = 0;1 I& s$ h1 v3 Z, L2 d) ~, u
- dma_addr_t dmaphyssrc2 = 0;
7 F- k- _1 a8 K. j/ G5 J/ d$ d# j! j - dma_addr_t dmaphysdest1 = 0;( S: |5 l" N$ M0 h- w. V8 Y7 R
- dma_addr_t dmaphysdest2 = 0;% U/ d! u1 v' R9 y2 S
- 4 t& B6 D m+ X {( M
- char *dmabufsrc1 = NULL;. @$ M9 j$ y4 K7 v1 N6 F9 s( x( _
- char *dmabufsrc2 = NULL;
5 \: }. z2 n0 ] - char *dmabufdest1 = NULL;# o( ~4 t U# ]
- char *dmabufdest2 = NULL;8 M# [# _; u6 @! ]0 L
( a q4 N/ k) I9 F/ B- static int acnt = 512;# D' }4 u1 e. d: b3 i
- static int bcnt = 8; w# X- J! h/ f; d6 [, L0 F1 y
- static int ccnt = 8;! k- N2 B/ C' w. Q
0 t" d7 [3 ]$ H0 R* l) X- module_param(acnt, int, S_IRUGO);6 X o; e9 Y) l. e( T9 e
- module_param(bcnt, int, S_IRUGO);$ D& x: b/ z/ K" j! h$ Z& u$ D
- module_param(ccnt, int, S_IRUGO);
复制代码 0 R) n b4 r6 K" U6 A! J
/ ] m: D3 x/ ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ A9 n) k6 A: h' q, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( p; n ~1 }" ^- h$ A' G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 ^5 F4 w/ p8 c0 [$ I
+ A8 f6 w& [& l& ]" \
$ P- T+ G* v) i |
|