|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 J* A [! E8 }2 J- |
- [code]EDMA sample test application* Q' T1 J' V( V6 {/ R
- /*
5 t$ Q4 E" F9 b- I: f - * edma_test.c
, q/ z3 X! O+ K0 b, y% | X) q1 p - *, S( f2 Y! i, Z
- * brief EDMA3 Test Application. Q, S$ h4 F2 R* g3 s# A
- *
# \% O7 F$ b! V+ k: C) _# g - * This file contains EDMA3 Test code.* M8 `* i: T; `# A
- *2 m$ A* W9 r3 z) Y6 k0 s. U* ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" f8 n% T1 i' Z4 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 q5 O8 {) I+ |. I/ a - * TO CHANGE.( F5 j( [. \& B1 U- v, Q
- *
, Q/ k) H% s; K h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% P, w& V3 [3 S% i: l& ? - *% r5 m7 e2 U) R3 j1 c
- * This program is free software; you can redistribute it and/or
1 x$ M" k5 f. d% W8 {: t9 l1 i - * modify it under the terms of the GNU General Public License as6 ^$ ?1 X( H" _7 z9 J9 ]
- * published by the Free Software Foundation version 2.* P9 s# ^ `$ N
- *
' m( Z- v/ b+ ^9 u& ^8 q2 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 Q2 ]% A, [, Y1 o5 h9 S' } d
- * kind, whether express or implied; without even the implied warranty4 ?4 N e% s" Y" [6 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. L, B' S, i# V$ R7 X5 O - * GNU General Public License for more details.
. S, w( @, Y$ q% T - */
2 D6 a! ?: U% U5 ~# M - : I" l' Z% d# m" \3 h
- #include <linux/module.h>
8 h9 v! A, J; ], `2 F - #include <linux/init.h>9 L$ o0 G0 L' g* o
- #include <linux/errno.h>
, Q3 B7 L8 A) [) d5 O0 p6 o! c9 B - #include <linux/types.h>8 n+ h8 M0 ?9 H1 G' X
- #include <linux/interrupt.h>
, K# n: }( ~7 h: W1 e5 k - #include <asm/io.h>3 y. x: i# _; m3 L8 z
- #include <linux/moduleparam.h>
' F6 [& A9 F5 y. F8 ]0 x - #include <linux/sysctl.h>1 L! `7 q w2 G. X* Q y
- #include <linux/mm.h>
! {. \; t! d5 w6 @7 D, ?+ a8 M - #include <linux/dma-mapping.h>0 O& Z9 V2 F6 s+ P
- 2 Z" |8 A2 h6 B. b
- #include <mach/memory.h>1 [+ ` {; J* ~1 k) D, }
- #include <mach/hardware.h>) d5 H5 U" _6 k- i4 x6 i
- #include <mach/irqs.h>' @/ [/ m# Y% Y# Y3 t
- #include <asm/hardware/edma.h>- j7 S! z E, K7 C8 M) a5 d1 U
9 N3 B* u" Q( O0 W+ ?; l- #undef EDMA3_DEBUG5 ]" s3 C7 |4 ]0 q9 ^
- /*#define EDMA3_DEBUG*/9 c. {8 b. K" p
- , `! F. a' ~. r! x5 q* ?
- #ifdef EDMA3_DEBUG4 P$ @4 i6 b% q6 p! e5 Y" I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): d7 D2 ?% t1 h) x8 g' J' ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" L: o; Q& c+ R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
G5 i; ^1 L) R - #else4 n% J8 T6 N$ R
- #define DMA_PRINTK( x... )
4 T+ d; |) S) J9 ^. [ - #define DMA_FN_IN
% S3 S: A. c4 \' f( ^ j% F: L - #define DMA_FN_OUT
/ o. q/ Z, |: l* y- B0 `% J+ M - #endif. q7 s9 R$ Z/ C9 t
6 U. \1 x- X: L( w* |- ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' Z. J" g* v: G0 M2 B M1 m
- #define STATIC_SHIFT 3
$ n% C/ _. r( q - #define TCINTEN_SHIFT 20
9 H# x0 u9 m% j1 v; O! C3 r$ B! ? - #define ITCINTEN_SHIFT 21/ t9 Q1 W, U- A
- #define TCCHEN_SHIFT 22
h# k$ G0 P4 n9 n. _ p9 ^ - #define ITCCHEN_SHIFT 238 f ]& }) C5 U+ K) K, S5 }3 U1 L
9 p# u1 i: ^7 ^* B# ?- static volatile int irqraised1 = 0;; |& i/ L: A4 z
- static volatile int irqraised2 = 0;
! c' ~: h6 Q q% i
! R6 x o: e# H* j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- x. Z3 G# b% k% w7 M1 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' u: z+ J4 g6 n1 K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ n. h" C+ @9 O, C: _1 \
2 U3 l( S j7 Y& [- dma_addr_t dmaphyssrc1 = 0;5 | s" I6 B8 k: x) ?
- dma_addr_t dmaphyssrc2 = 0;
; @, |% \" H( X% k, P1 N* H- Y! X - dma_addr_t dmaphysdest1 = 0;
/ }) d7 y! @' P - dma_addr_t dmaphysdest2 = 0;
) ~1 h7 m" r4 n - 6 M; y$ ^0 L# q/ G8 r5 C3 W6 C
- char *dmabufsrc1 = NULL;
7 B0 X! Y' F) e! \+ C - char *dmabufsrc2 = NULL;
( r" V, \4 o5 z' k - char *dmabufdest1 = NULL;; p( b m4 F: o4 m! k
- char *dmabufdest2 = NULL;
! B, S- C' t3 \. g5 A# ^) ]( B% i
( W6 a1 U" v, S% w7 K- static int acnt = 512;
' B$ j4 p2 S* k2 I - static int bcnt = 8;
& D! }, E) F4 X2 }1 q/ ~ - static int ccnt = 8;
5 m7 o( H2 e! n/ W) W+ A. `: T
8 h' F8 ~" D" F/ N: |- module_param(acnt, int, S_IRUGO);
9 C$ j( R) Q1 _8 U1 C' [ - module_param(bcnt, int, S_IRUGO);
# X' h4 N g% D" k4 t6 z: o - module_param(ccnt, int, S_IRUGO);
复制代码 " O4 p1 f# Y3 |0 S: t5 U- @+ j
1 D& B% W2 @6 m8 ~6 Q9 M; I1 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 M" O( n2 G$ u2 ]" v4 D( B8 h# {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- A0 k: Z! G2 {! c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ]9 l4 D5 {# h8 U. \' g
5 O/ T- L: e4 B: Z+ ~ R
8 m& e7 D9 \# @: w/ ], I
|
|