|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % K) ~ j% ]! M7 ^
- [code]EDMA sample test application
$ q. S: b$ }1 ]# L6 W. ~8 F4 C# W - /*' T' @: F7 z( u- Q7 l
- * edma_test.c
6 d& t$ @& P9 h - *
4 I6 X6 T9 r% a1 Q3 {) b5 L - * brief EDMA3 Test Application' x4 C q. X, A; i. S0 e! j% l [' _
- *
, m* f% w: j, k& ^ - * This file contains EDMA3 Test code.
" @6 N9 g% a% _- n* B - *
3 R- i% b3 L: @( {3 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 K3 q. C4 {0 d2 u- y" \. }0 B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 a% M: m3 L* u) Q6 c- j5 Q - * TO CHANGE.
* o5 N/ q/ E7 y - *
$ X t7 _: I/ W8 g3 H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& M+ H% B; R% m" [3 k. m - *
+ y! Z" L" w$ B: B8 y" C - * This program is free software; you can redistribute it and/or
, |: u& R1 E3 w l: Z - * modify it under the terms of the GNU General Public License as
& V( }: H+ V4 ? - * published by the Free Software Foundation version 2.
; U5 \5 o! p* k, } - *4 I+ \: x i- w7 K! q" A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ [3 ]% V9 K6 Y+ Q - * kind, whether express or implied; without even the implied warranty: E* d. j5 w! N8 x; T& F& R9 z1 o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 V( n% \) M/ e - * GNU General Public License for more details.- j7 T# ^' p! D/ K: g/ D$ E
- */
0 B' N5 M+ h- }: Z - & g4 z3 j* q t5 K3 h# G6 z
- #include <linux/module.h>8 [8 v8 K: R+ x: E3 ~5 ~8 G+ J
- #include <linux/init.h>
3 g0 a) J/ \! V& c5 ]! v6 q, j+ U) u# c - #include <linux/errno.h>
' k e- B0 ^+ D4 o - #include <linux/types.h>
5 V/ A T: n- y1 n( M( C! u; b5 b - #include <linux/interrupt.h>
$ }& d5 P q) B+ Y! L( a' b: r - #include <asm/io.h>
7 G% z, o1 M$ C/ T$ u, v - #include <linux/moduleparam.h>
% X4 W; L( N! s8 o- Q% a - #include <linux/sysctl.h>; R# B3 ^0 b t3 d2 ?: m5 _( r: v# O
- #include <linux/mm.h>9 s( a( v$ O1 q R1 n0 ^
- #include <linux/dma-mapping.h>
: ^5 M2 g$ A6 t9 e7 S/ N5 J - ' m, P: f/ P: _
- #include <mach/memory.h>
% f, f) y; l1 ]/ W5 J - #include <mach/hardware.h>! h: g# C/ l! h6 L9 E# N9 S
- #include <mach/irqs.h>
! X+ [$ V( Z& |7 v9 M& \+ }5 y - #include <asm/hardware/edma.h>
$ m4 z5 Y- k( K' c f w - ) }0 t, o, g- a# J% }
- #undef EDMA3_DEBUG
; n% B( z3 Q6 u1 Q/ { G/ X - /*#define EDMA3_DEBUG*/
4 H) J2 z( i, x* D - ; [6 |0 g, _/ W( i( [
- #ifdef EDMA3_DEBUG
. ^9 m I* B4 t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 R$ U# _1 |: {3 W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" y- l' _# ^/ J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 ]6 ^0 t* a+ @* A4 h6 \) h- `
- #else/ v. ?+ w) A1 x
- #define DMA_PRINTK( x... )
4 |% z" f* {1 ^# ]$ X1 } - #define DMA_FN_IN* n1 P8 \7 F+ o* M, ~
- #define DMA_FN_OUT$ Z$ I- q0 d6 P$ C
- #endif7 n* L' M- M0 _ d g5 X
- : M' {3 _1 l4 H; C! `& o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 X1 z+ P" f3 D' |; } - #define STATIC_SHIFT 3. G- c/ P) x* G3 m, _
- #define TCINTEN_SHIFT 20& G9 {2 t& k4 R
- #define ITCINTEN_SHIFT 21
8 F; E! T) B/ U+ B4 K - #define TCCHEN_SHIFT 226 z7 W' B6 z }
- #define ITCCHEN_SHIFT 23
! r8 ~# }+ q; d6 ^, E$ i" v; Y2 {
) e& h* B, ~0 ?9 e1 y0 L- static volatile int irqraised1 = 0; r b# R* k; m: J$ ~0 i
- static volatile int irqraised2 = 0;
+ W, H8 H: h0 [1 N7 Y! d2 x3 f1 v - ; p7 \; @. G6 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 Q9 r. c- @0 A: A# A; \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ C6 D9 I3 T% _( }- \. W T5 F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, t4 I4 H1 S+ b- {% @1 C7 F
9 c6 ?4 U( Z- k- dma_addr_t dmaphyssrc1 = 0;$ e6 N! k# z. l( M* [
- dma_addr_t dmaphyssrc2 = 0;! K K H& f0 L |- [8 U
- dma_addr_t dmaphysdest1 = 0;
2 m$ c- ~4 ]; N+ M, ]5 @8 L0 Q - dma_addr_t dmaphysdest2 = 0;" o1 E9 Z& G0 f% q( j( N2 x
- 8 S: }; O; t* c' ~3 }9 W" g" g8 V
- char *dmabufsrc1 = NULL;$ O" _1 {8 J' n9 z+ h
- char *dmabufsrc2 = NULL;0 R5 \# k3 z$ }8 p7 o' B
- char *dmabufdest1 = NULL;. S, ]" }! f7 a& h" F/ v
- char *dmabufdest2 = NULL;
/ o e: g! n2 k$ c1 B
* U9 O! ^; e* ?9 B5 [+ `! N- static int acnt = 512;
- b* w+ P8 i" K! `5 ` - static int bcnt = 8;2 A- e, p- a# _+ I' `
- static int ccnt = 8;
2 {, D9 C& {+ k' \1 }: T ? - + W" _" u; W: L: W( ^- w, w! s# |
- module_param(acnt, int, S_IRUGO);
$ z1 V3 A- M! ]* ` \; [0 U- x- B - module_param(bcnt, int, S_IRUGO);
- t# r& f \" w+ i1 k8 r - module_param(ccnt, int, S_IRUGO);
复制代码 + T2 e( x1 y T; g0 j
9 J& g) b8 l. N2 w1 W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# J4 r% J, W b% }. E$ H7 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* b# @0 O. h) ]2 N7 o4 M% {1 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 X1 x; [; n) D3 P( [) ?5 Z& [2 ~# y( e7 [7 V
( |6 p2 M; J- H9 p) A6 f* G
|
|