|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # {' d$ ?+ r* T- E v
- [code]EDMA sample test application- @9 \5 ]' D! r7 K2 y# s. F, C
- /*
5 c' S, n3 y; i @. h - * edma_test.c3 N% F) w% D# ]8 R
- *: m- h) c2 h7 t/ {( C
- * brief EDMA3 Test Application
1 d5 Y3 b& g9 A0 ] - *
/ Y* Q k' l8 h! C! ^+ Y. e5 | - * This file contains EDMA3 Test code.
$ w1 k$ r% R5 U! q& Q: t, X - *& P* n4 u9 b, c) L) D7 U, }1 D1 D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. Z2 K( ?$ v! { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ a7 V' y* M0 O$ k: f8 K
- * TO CHANGE.; N" y5 \7 i; }0 n: F
- *, _9 k) ~6 K2 A; H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// t- i( G1 N. E# u1 O5 M
- *1 L6 a# l6 q9 @2 `& c- D$ v9 r
- * This program is free software; you can redistribute it and/or, T. q7 C( l( `. t
- * modify it under the terms of the GNU General Public License as
1 f7 L' v2 W6 i! S - * published by the Free Software Foundation version 2.
) E: g& y! F; a) E - *
! [- r* j0 k# z3 z7 n' d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- b4 ^, @0 u" ?+ Q+ N( j
- * kind, whether express or implied; without even the implied warranty
. c Y# s0 O' H4 O, i; W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ u- z2 o2 A( V \* M - * GNU General Public License for more details.; N: R6 Y$ J4 o4 M% o# h6 X
- */
7 q, ?8 V: C+ c' Y - 8 I3 K2 d4 J+ f# v7 L
- #include <linux/module.h>
2 A- K% |. ]* {. {+ R. ~, @ - #include <linux/init.h>! ~) O) W" [6 S$ w. `$ L: }
- #include <linux/errno.h>
" A$ H. q1 V0 z - #include <linux/types.h>& j7 y1 t! s+ m$ p
- #include <linux/interrupt.h>/ a) w% E, [# ~. A# J
- #include <asm/io.h>
( T7 F7 ]/ w2 y - #include <linux/moduleparam.h>$ A/ R: w! O) \" Z% K9 V* K0 n
- #include <linux/sysctl.h>
6 O3 o" S' C2 K, a3 R: x* g) b - #include <linux/mm.h>
7 O1 {+ H4 b2 U) V% [ h& Z - #include <linux/dma-mapping.h>8 x. X2 l/ q' |
- 1 G' C: ?9 n l. ^$ e6 y/ X
- #include <mach/memory.h>3 l% @8 l: ~$ s
- #include <mach/hardware.h>
: F! Z" n- q% e$ v' ^ - #include <mach/irqs.h>
, l7 o. v+ v: @( ~ M' g6 Y - #include <asm/hardware/edma.h>* {7 }; ~$ }' [8 J7 O6 L
' y$ L; v8 D! F0 E! Q- #undef EDMA3_DEBUG
# r0 N' W4 P4 o5 s7 i4 _( \' |+ a% l - /*#define EDMA3_DEBUG*/
9 f1 m! G) Y8 i - 1 O% u; Q, @* d+ z( o! |
- #ifdef EDMA3_DEBUG
& e& k1 g6 W. c' x! q* v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* G; ]" e6 v3 z* J$ ?( u0 Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. ?0 b/ T4 Z5 F/ f* J+ M- y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! ]1 D! r: B$ B0 Y4 w/ a
- #else. v0 t2 Y2 D5 M- z- A9 x$ V
- #define DMA_PRINTK( x... )6 a( s) [: U, j' ]) e0 S) X& `
- #define DMA_FN_IN+ V; Q4 `9 \. g ~4 t
- #define DMA_FN_OUT
* P0 Q( `0 l" }5 Z' P - #endif" i6 r: `8 _7 M
3 ~( [, f9 s1 |- h/ w& g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 e$ w& q2 T# n' u$ U - #define STATIC_SHIFT 35 d* a# t7 v/ {5 y# D' b4 v
- #define TCINTEN_SHIFT 20
8 c i) Z% _- Z( ~! B - #define ITCINTEN_SHIFT 21
1 B1 ~: x+ M8 `2 | - #define TCCHEN_SHIFT 22
5 K& v1 \2 o3 c* f - #define ITCCHEN_SHIFT 23
! l6 }6 `# [: _" f
' V& M8 ~/ l/ U5 Q% n/ N7 V+ T- static volatile int irqraised1 = 0;
/ Y' s- F1 ]& A. D1 m$ N% k- D - static volatile int irqraised2 = 0;
+ K6 U! ]# d2 {. @3 o2 F! g
9 [, k+ U( ?+ ~* W, ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ]2 a: N0 Y7 }/ C, d! I# s+ H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 F& G9 k& Z* Q4 E' b0 r. Q3 H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" P% f$ P E5 S1 m - 6 b* Y5 u) g! n1 w4 K
- dma_addr_t dmaphyssrc1 = 0;
/ I6 A" Q, ]$ U- h4 S7 M - dma_addr_t dmaphyssrc2 = 0;% q9 ]; a0 N6 q7 C/ N
- dma_addr_t dmaphysdest1 = 0;
1 \2 M& L s& c. `) U# L - dma_addr_t dmaphysdest2 = 0;; y4 f9 m3 S |* z
- 1 n, ^: j+ n& ~) v: Y7 E
- char *dmabufsrc1 = NULL;/ @, b. R% l) S
- char *dmabufsrc2 = NULL;4 I( A& A% p/ z* I
- char *dmabufdest1 = NULL;9 r; T5 ?+ ~' m) E- A8 V
- char *dmabufdest2 = NULL;
3 h1 d4 z G {' w3 y! }3 ]1 x: A) E
% o# P; C) r( h, Y1 r- static int acnt = 512;
. Z4 S) y X% b1 ~ - static int bcnt = 8;
8 @. a. E8 j1 g: X6 O9 l$ f - static int ccnt = 8;: t2 T! L Q, h) e( y- r
- / x& h b( r( D
- module_param(acnt, int, S_IRUGO);
, i S# v( b4 o e0 y - module_param(bcnt, int, S_IRUGO);
. g Q2 V- @" j: |% [$ z - module_param(ccnt, int, S_IRUGO);
复制代码 d% R# A4 }+ B% n; h# u
/ l" t A/ _8 {6 M l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ^$ Q2 K, J. l5 E6 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( Y- {/ @! I( e7 |2 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- V4 |! ]/ x0 E, B& r) C1 W2 p( k' u* B/ V* D. Y
' h7 c& ]# k9 e# c! N
|
|