|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % m0 _9 z ^4 O
- [code]EDMA sample test application: N: X: X; U: [1 ?% o; |
- /*
& |1 y& \4 k1 j4 l. I! `5 O - * edma_test.c& e! {- [8 ?" O7 K+ d
- *
$ L: b9 N) g K: ]) ] - * brief EDMA3 Test Application$ ^% o& c( |" N( {* K4 I6 Q
- *
+ h: c* e5 I4 L0 i* Q - * This file contains EDMA3 Test code.
. B4 X$ ]: o& d0 b" V - *6 p) h: [4 U- H/ |6 P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 x+ X' L" z {, l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 [* Q/ D6 V! M5 m - * TO CHANGE.
' i) m9 [7 ` S& [7 n0 f - *
9 C' }2 I7 d% V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) Q8 c% U) a8 ^
- *
9 V) j* ~8 u+ u( Q. T5 w - * This program is free software; you can redistribute it and/or
7 Q" Z- u y; k1 H8 L$ c - * modify it under the terms of the GNU General Public License as
' I: i$ ~( O2 T! | - * published by the Free Software Foundation version 2.
+ B: b- k* }+ {# ?) a$ N, E' n - *
0 ~, A+ Z! O; J s% U1 l6 I- i1 G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( @! C2 j$ K( l+ z& o+ B - * kind, whether express or implied; without even the implied warranty- A: g0 N/ x0 Y1 j) |5 W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# e# c% e. o( C! u v: e0 L
- * GNU General Public License for more details.* ]( k2 K- g" l7 u
- */7 K, y( K' y" Z+ f! b6 t5 f
% p: N- E/ b, [' c- #include <linux/module.h>. i8 s0 h; Z( `' ^
- #include <linux/init.h>
3 F, M4 j, r! c5 C7 m7 J; I - #include <linux/errno.h>
6 a! Y7 E0 T, v& L& b# V! u, y! ] ~ t - #include <linux/types.h>' V2 \& g# ]8 U3 X! C9 f
- #include <linux/interrupt.h>
7 ?' A9 v" \' l0 V2 g - #include <asm/io.h>
5 o) P, F: {$ u& P7 D. ?0 } - #include <linux/moduleparam.h>
, D1 D. S$ T# h5 U1 h - #include <linux/sysctl.h>
, r/ n6 q; }5 e$ A0 { - #include <linux/mm.h>5 i3 s$ f) x( O, p6 \ `* P( m
- #include <linux/dma-mapping.h>
. Y3 k& J, s# O! n& J& O3 j" X0 Z - j; V# J& E; [7 L0 [( g1 E5 V0 j
- #include <mach/memory.h>. }9 l! i9 E+ ?6 D. x! u
- #include <mach/hardware.h>7 H# w! n3 K0 C5 x
- #include <mach/irqs.h>$ i& R% W6 j# p: } ~3 s( D
- #include <asm/hardware/edma.h>
. {; D* ^: K! N3 R0 d/ b9 }, h - - g' V! o: k1 E( K; t. B6 W' h. Z
- #undef EDMA3_DEBUG
1 ?# J- n8 w9 x# G - /*#define EDMA3_DEBUG*/" H9 |7 z) {; {9 \; l4 W
- 8 R' u8 r9 T7 H
- #ifdef EDMA3_DEBUG9 l& i" y4 d2 `- ~( O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 g- p$ Q7 ~" ?0 y7 K) @9 I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 x2 M1 C N( C. B7 [& g' h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. v9 H K; V# J3 a1 K( u - #else
0 H" j+ K; `) A7 I R4 E - #define DMA_PRINTK( x... )
! I3 |9 e2 v+ C# k - #define DMA_FN_IN/ ?7 W, r+ ?* q/ z' g
- #define DMA_FN_OUT! x/ c# [" S, p) e5 ^
- #endif
5 A8 _% i9 |' M% T/ m, W" S - * D, f. k5 v- g0 j& U3 f( w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 I; L: ~, P B6 _ - #define STATIC_SHIFT 3; W0 y- u: H' z) t
- #define TCINTEN_SHIFT 20& t- q) U. f5 s9 g' O
- #define ITCINTEN_SHIFT 21
1 L4 [& ^1 q/ U9 t5 A4 b6 r - #define TCCHEN_SHIFT 22
5 o4 [# w& G7 W. }, @- R% {0 O - #define ITCCHEN_SHIFT 23
& u1 b6 ~9 Q/ m+ {$ |
1 j9 Q J1 [; H2 h! h- static volatile int irqraised1 = 0;
7 z# ?0 p$ g1 X1 _ - static volatile int irqraised2 = 0;
# r; e: J5 `; W7 |
7 n" l* b, |% S; m' [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& F% c7 C9 g! t$ e n9 T+ G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% h( ]) S) @, D3 e. Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 C5 l- y9 [3 Y$ L8 f
+ c, X7 _7 L" r$ d+ B5 C- dma_addr_t dmaphyssrc1 = 0;
9 a2 v0 i2 u$ `, F- h4 v" U - dma_addr_t dmaphyssrc2 = 0;: ^) x \3 H/ |! K1 P
- dma_addr_t dmaphysdest1 = 0;
$ [' z4 k+ H7 ]% b - dma_addr_t dmaphysdest2 = 0;
( J& y/ X( {# B% I' b
$ _2 t) k4 l( F$ p# [- char *dmabufsrc1 = NULL;
6 }" A5 `) X* J2 \ - char *dmabufsrc2 = NULL;
; `+ P9 N# I0 R' d. m$ l - char *dmabufdest1 = NULL; M0 i& z/ ?) d* P& l1 Z q
- char *dmabufdest2 = NULL;
" _. S- z6 _5 e7 ~4 W( u
6 r- Y* B2 ~& }9 F* n1 M- static int acnt = 512;; ], i7 Q# @0 K$ a0 R2 a
- static int bcnt = 8;0 G5 y( F5 _) L" t( t3 `
- static int ccnt = 8;& `9 q: H w ?. I% U5 h
- 6 r9 @$ C) }* |
- module_param(acnt, int, S_IRUGO);
' Y, ^+ e# G; |6 x& E) p5 I - module_param(bcnt, int, S_IRUGO);
2 E0 e* n/ x3 o [8 W - module_param(ccnt, int, S_IRUGO);
复制代码 * Y$ F0 Q4 [0 n
% C; \8 K; N) F U+ ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 V& `: K) P- U. Y" T. T, y2 u. z( a- z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 ?$ v% c( @6 G) b# a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ N7 q, V5 y, E. a6 d
, Q. y- G; I3 t5 w; [) V5 Q
$ ]- m' D" b; j* Z z# r2 N4 ]5 O0 W |
|