|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! W5 e5 a' m, S* [2 ^- [code]EDMA sample test application
7 s' s: y' x9 s# p* L, | - /*
* j/ v; Q/ `* d' s% z) { - * edma_test.c
& `0 Y; {% y4 W9 I1 s6 X- A - *+ ?. H, @9 q8 C+ U+ y5 a
- * brief EDMA3 Test Application
. E0 D2 O! D1 S( k' A - *1 o, A& G; ?( h: u& X3 e; n
- * This file contains EDMA3 Test code.( m& L7 U. L: m
- *+ |. b. y9 z/ q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# ?7 j0 X1 @3 q F) O$ c3 M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! U& F8 X* E4 O+ S
- * TO CHANGE.
+ J- ?# D7 H2 N - *
; O9 e3 _; n3 V: S) a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ u( P/ F3 I o7 B
- *
* O) P4 j w" V: z+ e& F' R# D' { - * This program is free software; you can redistribute it and/or8 Q+ ?( Y. \1 [+ U& y
- * modify it under the terms of the GNU General Public License as
9 u( \% |! d t - * published by the Free Software Foundation version 2.
2 n; I" V; M7 W3 w+ K5 f# f, @6 F - *
s8 I5 `' |/ B& { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 f' P2 ]5 k+ r9 |. s5 \ - * kind, whether express or implied; without even the implied warranty
; ]; s: ]6 ~0 ?+ G( L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 F2 \' I. S6 E6 c/ m$ }! N
- * GNU General Public License for more details.- S8 D1 A4 I, ~5 l
- */$ j: y9 ?- n6 h) O- u8 Y
1 |/ M7 h: l3 p, \, `: i; T1 V- B- #include <linux/module.h>
" N5 ~; _$ F6 U1 a. J! m - #include <linux/init.h>3 x- n8 c" E" b }# p4 f$ f
- #include <linux/errno.h>7 A( ]# L/ ^' B) V+ i8 K6 l
- #include <linux/types.h>
' N7 a/ O6 Y: u1 L# [ - #include <linux/interrupt.h>
. t X/ M) K) a6 w o5 D w* H - #include <asm/io.h>
% B7 S* h6 t0 {1 X+ n& f - #include <linux/moduleparam.h>) ?& [3 \; n( E1 t$ G
- #include <linux/sysctl.h>
3 O5 ^. c4 [- O& k0 v - #include <linux/mm.h>- S4 \1 @) X R: y; h
- #include <linux/dma-mapping.h>( j7 S: W1 u& [+ W% J
- . d( o; O* w4 f. E7 }+ S/ c
- #include <mach/memory.h>' G' d8 W( w3 u. w7 J0 k
- #include <mach/hardware.h>
4 B" p8 V( K, w5 n* z& D" P2 \ - #include <mach/irqs.h>' q/ N% N1 d6 D
- #include <asm/hardware/edma.h>
4 Q0 i4 C! J2 d: K \
( e( U4 b+ A( j( p T" {3 i* a- #undef EDMA3_DEBUG( [+ w3 [- K$ y: y( ?
- /*#define EDMA3_DEBUG*/
" T( Z0 X! X8 \4 M4 \ o - " F, P7 O' W3 B' F+ o: |* r9 m
- #ifdef EDMA3_DEBUG
6 O' m' @( f, }/ Z u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# U7 X9 Z" a" j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% z) k& U Z! l" n' [3 ?$ f3 E- A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* h6 Q# Y+ @( Z2 ]
- #else
6 m8 s/ O4 U( e6 l% s: d( U( G+ h0 B - #define DMA_PRINTK( x... )
! D7 ?" c$ A( x1 F- H: i( W - #define DMA_FN_IN
/ R* ^ Q! p" `7 {4 r7 ?7 w - #define DMA_FN_OUT* Y- \$ ~, d) N' L# t- y
- #endif2 S* i+ u) [8 g( H) g5 H! \
- 7 I" ?) D1 d1 i/ l3 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* d2 o K3 m7 Z - #define STATIC_SHIFT 3' t9 K% F: X$ y
- #define TCINTEN_SHIFT 20
8 n6 P4 L2 k) Q; W1 t S, X - #define ITCINTEN_SHIFT 21
+ o7 a% A0 H8 v0 Q- n* M7 t. U5 u - #define TCCHEN_SHIFT 22
0 B$ t8 p* R* q6 B$ A - #define ITCCHEN_SHIFT 23& {3 B) }% _# i1 C% M
/ k9 n+ }1 Q0 R X7 F- static volatile int irqraised1 = 0;
) ~5 j* V+ z# |. A; g7 k* j2 m - static volatile int irqraised2 = 0;
% \9 N$ o4 r% t1 l
" f; p: @+ ^. U A( W+ x9 n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& C! @) M0 m% r! }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. v8 B7 S% b- ]# \1 |6 n; t1 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ i, A0 g( H$ V( m - # [9 y1 @4 W6 W. F, _
- dma_addr_t dmaphyssrc1 = 0;) w4 m* i& m! N; Y) \
- dma_addr_t dmaphyssrc2 = 0;
. ?5 X! g# n: N! x: F - dma_addr_t dmaphysdest1 = 0;
% d0 o9 b* Y9 v Q: J% G! W3 ] - dma_addr_t dmaphysdest2 = 0;
5 g: A' s( [) p - % ]8 T3 h K/ o2 |4 ]: s5 Z
- char *dmabufsrc1 = NULL;) y: C# j' e# y
- char *dmabufsrc2 = NULL;
8 z2 U) X2 \# P( y# {; {$ s9 U - char *dmabufdest1 = NULL;# I( a, N. h. ]
- char *dmabufdest2 = NULL;
L+ W& A+ P1 g! [- x$ W - , }6 m8 s$ _% s# M. ?, z2 g
- static int acnt = 512;
; d- Y$ q& ^/ s - static int bcnt = 8;
k0 y' ^- Z, m7 J \ - static int ccnt = 8;
9 j2 V1 D5 s/ K5 X% D
8 Y6 M6 C/ s j- module_param(acnt, int, S_IRUGO);
5 p5 d4 s& f( g# e U A - module_param(bcnt, int, S_IRUGO);6 ~5 b4 ~* E! v$ b, K0 F
- module_param(ccnt, int, S_IRUGO);
复制代码 * L( k+ ^$ U$ Q
+ S S7 U6 T/ ]% c! V9 A" a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
S; f) {: Q$ Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. t- I1 y* Q3 b9 \4 M: E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ ^& }' j2 T7 j( E8 e" {
& s" \6 f* N0 i3 H P3 E
2 A+ A; o' s, ~6 A ~, O" D |
|