|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 y% K$ i2 o" w0 K- [code]EDMA sample test application& e' a, u7 Y* G8 y
- /*
( ~# s& Z" E4 t# `( ?- O3 b - * edma_test.c3 ]( w8 y, m, @ q* g. {
- *
1 V3 y Y/ i& w' ] - * brief EDMA3 Test Application
6 d! M2 M5 ?8 b6 k9 A - *; A! q6 e, G' F$ @4 R6 l% C$ D& z* @+ m
- * This file contains EDMA3 Test code.* b8 E; V& v( R
- *
7 `7 ^ j# `$ v0 X+ F4 U9 S; k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* }0 d. w' D$ u+ v9 I6 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 m; q4 g0 B* t3 A3 R - * TO CHANGE.
: _# ^% K. j* M, g* m) l - *+ d1 Z; _% l4 Y$ i' `; }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 A: C2 C4 W! E7 g
- *
! ]6 a: m4 T+ w- k/ O5 | U3 ^ - * This program is free software; you can redistribute it and/or
: s, N9 C2 a4 ^/ u" o - * modify it under the terms of the GNU General Public License as
6 P7 ]( A8 u$ a$ c1 I - * published by the Free Software Foundation version 2.( Q5 K" f0 ?, V" R; G0 ]6 a: f+ f
- *
$ E0 B# u' n+ k- w) L1 c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 s7 Z, W$ ~8 V) `' c
- * kind, whether express or implied; without even the implied warranty
& p5 d; E& w) [/ h! B# C1 h8 a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 I j. v$ O6 Q* n+ f% Y- w
- * GNU General Public License for more details.
- t X' j; O) r! r/ y y& ? - */9 j9 c( ^7 g M) C7 T# H
- `# l$ m- A9 m, Q; f; c2 Z% l- #include <linux/module.h>' X2 s/ f" O" w& K% P6 A
- #include <linux/init.h>
; X5 x0 p7 x; e: I: _ - #include <linux/errno.h>
7 U: L. d, }2 n. R/ G5 K - #include <linux/types.h>- A4 T$ ]9 J- l$ l. j
- #include <linux/interrupt.h>% R5 o: b( E9 m% I. A# _# d; t
- #include <asm/io.h>2 T4 Y1 u) n6 j( K
- #include <linux/moduleparam.h>: a& C5 ?8 v7 I" B" C
- #include <linux/sysctl.h>
0 A! {; C; I$ L8 K$ p$ S/ ~/ X( Y - #include <linux/mm.h>
, @4 ?7 e; n/ L+ E - #include <linux/dma-mapping.h>
: i! }9 L. e7 U+ T6 M; w$ v
* A& @: }$ s7 a7 U, j- ]- W- #include <mach/memory.h>
. W' n' V1 N" o; Z7 p' b - #include <mach/hardware.h>
! f4 ^8 o8 T h+ S7 G - #include <mach/irqs.h>0 @0 z1 i: u+ Q6 v: a3 B3 _
- #include <asm/hardware/edma.h>
4 k1 O" Q. ^3 J/ t$ `* Y
. e5 a. [$ \! W4 V$ W" |- #undef EDMA3_DEBUG
% o1 K5 |+ M5 Y - /*#define EDMA3_DEBUG*/- Y2 @" w) _2 F6 i2 ^
- - V$ w7 O1 N' i
- #ifdef EDMA3_DEBUG$ x8 q3 e- {- K0 f7 I `9 `* Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 S" D1 k# V$ @5 T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- ]# j& `/ p3 p6 G% o9 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 H ]6 Y( z6 L
- #else
. r( _2 G5 B* y5 _ - #define DMA_PRINTK( x... )
* c$ @5 A* Q- g6 } - #define DMA_FN_IN
# s' k/ V! I# Y# g. `$ E/ s, l; b - #define DMA_FN_OUT
* X, N2 a& k& Q5 j9 t! v - #endif: D$ `+ D% l/ `' V$ ]. \+ z4 w, p" y
- 2 K3 ~. ]' L: s0 |1 {4 V! |3 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& C! o3 G6 n' X h' L# n7 v
- #define STATIC_SHIFT 3( @0 g' C; r" v: b
- #define TCINTEN_SHIFT 201 F+ [: F, j+ N4 M
- #define ITCINTEN_SHIFT 21
2 y, B0 j" n4 F; a; T - #define TCCHEN_SHIFT 22
# F4 F% Q1 X# m& }' P" g1 x4 Z7 J3 B - #define ITCCHEN_SHIFT 23
4 _8 M- Q. G% b# |) l - . Q. i" `" a# }- i
- static volatile int irqraised1 = 0;
& y6 ?' U4 M- S9 Z* q - static volatile int irqraised2 = 0;! N6 R3 L& t6 ~9 X4 W5 P/ b& [
- 1 i7 P/ m1 q( ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ y2 D: a/ w$ M! l1 ?# M' q6 A/ t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; S D3 k8 w5 @% r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 S7 b" ]8 [; m+ [ - 8 ?/ _# f: Z7 Y: D/ _( F
- dma_addr_t dmaphyssrc1 = 0;
4 J- c; e+ i; ^ - dma_addr_t dmaphyssrc2 = 0;$ S9 }! D% N2 c: Q" a3 Y6 J
- dma_addr_t dmaphysdest1 = 0; l8 O$ d3 R* L4 X& g# |8 h
- dma_addr_t dmaphysdest2 = 0;# Y( n, ]7 H, H( o5 U
- " W/ x2 P, q: G' ]
- char *dmabufsrc1 = NULL;
: \' c4 g3 }! \# }; l2 G - char *dmabufsrc2 = NULL;) r4 ~' T- N* w5 v0 p- T( c
- char *dmabufdest1 = NULL;$ T4 }% E+ R/ Z! K
- char *dmabufdest2 = NULL;
# n: ]* f- w: P! H* j) P. u
9 T @, G* K6 _- l' b- static int acnt = 512;
# Z! k, W8 _1 z6 G7 L0 `1 G - static int bcnt = 8;8 x, X9 p8 |" t
- static int ccnt = 8;+ c/ |2 d! u5 m& h: H5 O% K
- 3 q$ g$ K5 w% a6 ?# W) R0 w3 `: j
- module_param(acnt, int, S_IRUGO);, Q8 w3 F4 X: f, ^! \" K% y
- module_param(bcnt, int, S_IRUGO);
8 C& H2 ]+ ~1 a8 D - module_param(ccnt, int, S_IRUGO);
复制代码
& c3 S# i/ j: q
& u- \2 {5 i4 ?9 j T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- s, m$ Y# ~; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% d: G1 U# h- a$ A7 Z, o U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ O: y! x% ?6 ~& ~/ e
. M4 N% g+ e* d
W. O4 k( }8 O; y4 A' b) p |
|