|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 D7 ^, L* Z/ j2 l5 n& y
- [code]EDMA sample test application+ m9 T2 g8 v* t/ C: ] `
- /*
0 t" _- F: d* |" `. {+ C - * edma_test.c
7 i3 Z4 a. S7 c1 Q0 Q4 r$ m/ D - *5 D4 Y) F! B. i6 `
- * brief EDMA3 Test Application
c2 G% f( G' r8 R$ i - *$ x P+ L4 U0 H2 O0 T: s1 E
- * This file contains EDMA3 Test code.
) K/ S2 I3 P: v2 _! Q; c+ a: |4 w - *
& S! V& t9 y* Q4 G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 l3 Y& ?; J0 G! c9 q! C J) j% C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. A) c; p2 Z$ q7 t% X2 m0 `% Y - * TO CHANGE.; T! j# {- S5 E! i4 G" Z
- *
7 C& o% s% Q5 ]) Q3 W/ \, E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 B, b6 O; S& t9 K; H - *
, v- O- B: j: A- y5 _9 ?. u - * This program is free software; you can redistribute it and/or
O0 ]# x& u+ @: h - * modify it under the terms of the GNU General Public License as5 x, L2 L. c: E3 U, N
- * published by the Free Software Foundation version 2.
5 N. o6 x& { S+ X - *
2 I3 w e9 C3 K) |- p( M- k2 o# J9 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% V* q9 {* H4 a/ b1 S5 K6 A - * kind, whether express or implied; without even the implied warranty& N- h* I! }5 m0 ^. S; X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; X/ { `6 q @ - * GNU General Public License for more details.
( Z# {0 Z7 E' V% L - */
3 C8 S" s6 l/ {
; L) a- ~5 `! T: {; w- #include <linux/module.h>
' U& C3 F! q; G+ t - #include <linux/init.h>
3 Z! g* S: K1 I0 j; \' [ - #include <linux/errno.h>7 L/ H" O. @; F
- #include <linux/types.h>& m' R* y% S3 V% h" \ w# l( Z, I
- #include <linux/interrupt.h>
" `4 Z; P5 K7 d - #include <asm/io.h>4 |4 y8 E$ G/ g$ ^ Y8 s1 P
- #include <linux/moduleparam.h>
1 r* O/ w9 y# ^" |9 A9 Q - #include <linux/sysctl.h>
, _9 v% |3 q' l! H - #include <linux/mm.h>' C8 l' ^% P7 ?- p( ]
- #include <linux/dma-mapping.h>
, ] V& n, l3 _ - 6 O( \4 x/ y1 t6 E7 g
- #include <mach/memory.h>
7 h$ V) ]! |9 ]0 r6 L - #include <mach/hardware.h>
5 n: r- i1 K# M' E) M - #include <mach/irqs.h>
: \2 j' G. i, E, m - #include <asm/hardware/edma.h>
r; K9 R0 Q. s8 L0 t( A& J9 ?4 G! m - 9 A5 O) m. b7 l. p# h
- #undef EDMA3_DEBUG
6 C5 W0 u1 c8 a W# C- T - /*#define EDMA3_DEBUG*/
) s+ r& z \$ W4 k R - $ V& l% W, Z2 B5 R) g
- #ifdef EDMA3_DEBUG& @& f8 k% `- X, K9 _/ C) T+ ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 ]7 q, u, s; o" E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): {0 x% a& o8 Y# f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 r7 `8 a0 s# x$ [; C - #else' q( J5 T0 B; T& `" R' g
- #define DMA_PRINTK( x... )
- S2 E$ P5 ]& W - #define DMA_FN_IN. g8 T6 S+ O( I; s" @
- #define DMA_FN_OUT
0 Z- Y8 ]$ b2 C [ - #endif
2 e- H' ]) A4 W6 t8 K
! P" H. S G& z/ k+ r3 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 o# X# l( \3 l' `1 L7 R5 P
- #define STATIC_SHIFT 3' {+ x6 q, y6 p& w+ a% X I! ~
- #define TCINTEN_SHIFT 20* n( g) ?( K, E, ]: y) ?0 @
- #define ITCINTEN_SHIFT 219 U) y4 _% V/ b3 K' V1 ~
- #define TCCHEN_SHIFT 22
' e5 _1 d9 T' w6 b$ K, e: d - #define ITCCHEN_SHIFT 23& X( [# e/ u/ B
2 q0 T' s" e' x' m4 X- static volatile int irqraised1 = 0;& F! y7 C' Y$ T/ A8 a; H. z1 S
- static volatile int irqraised2 = 0;
- i/ s8 Q0 u& T ]3 l) m
3 |) b& q" c% G3 x* O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; h% W9 Y/ p7 v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) i( q( \' p$ Z' ?2 _/ o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ^1 b5 A1 l+ O. l - 1 Y9 T( e" |+ y
- dma_addr_t dmaphyssrc1 = 0;
+ ?4 Y6 M5 b& ?8 F, | - dma_addr_t dmaphyssrc2 = 0;
$ J z2 Z, |5 q: {7 q; ~3 ^ - dma_addr_t dmaphysdest1 = 0;
4 n& D5 ?0 r, _0 L - dma_addr_t dmaphysdest2 = 0;
# t% M! s, {% ]" a5 l+ J* r2 [
& V9 L( ^& K" K: }" S+ Y- char *dmabufsrc1 = NULL;
3 M: b" u1 j: Y+ q - char *dmabufsrc2 = NULL;
" E0 V& P- h: d - char *dmabufdest1 = NULL;
- r H! S% z: u, \ ?7 q% O - char *dmabufdest2 = NULL;
8 I: J% j' Y- ^ b - & T/ s+ J" i, e" F3 q* Y' }
- static int acnt = 512;
# K1 J8 U& I, t$ i; t* t i - static int bcnt = 8;
- ?5 J% k5 E* u) _ - static int ccnt = 8;
i: I* B$ z4 i! V3 { - ( a. u3 n Q2 c+ Q& v9 @' {# i
- module_param(acnt, int, S_IRUGO);( y# u# a4 q$ ~, j' A: J- _9 ^; z
- module_param(bcnt, int, S_IRUGO);! n- l" f& a0 q' w1 V( _, w
- module_param(ccnt, int, S_IRUGO);
复制代码
: b( t! s, ` H, A
' Y- y- y9 q# _5 [, ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 ?- W7 l1 [. E0 \) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* M9 q, ^1 _: X. m. u. C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 ?+ |, e4 h% Z0 t$ S3 H, \% Z
8 A& ?& w' o% c4 o X
$ D# L6 u; h, x/ ~+ Q |
|