|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ~4 O$ O' g+ n( S7 U2 S
- [code]EDMA sample test application5 U8 ?$ b/ z# S( a
- /*: Z }, j! n9 Y' X
- * edma_test.c
1 n1 ], m# l0 n" \8 t - *
8 U4 {4 M* f2 z8 s7 U- S - * brief EDMA3 Test Application9 [8 m. ^1 V) a7 v7 Z6 l
- *7 G$ q; [1 k p0 [. P
- * This file contains EDMA3 Test code.
% O7 s/ M7 E3 M1 u/ a* V - *
8 W+ c9 `/ t# n8 l- V8 ^2 V& ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" l$ y, g7 P: j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 F# i$ a m+ k - * TO CHANGE.; }% V: {2 M/ }) H/ n+ |
- *
) R, X% E9 x3 [/ `0 R; j( ^) ] y3 Z# p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 i7 n) v* r z! | u% X1 D9 U
- *
+ f6 a* c( q. D Q - * This program is free software; you can redistribute it and/or
& u9 h8 h' z( z) p9 i! K: M* u% H - * modify it under the terms of the GNU General Public License as
! H9 j" v, I9 \" T - * published by the Free Software Foundation version 2.! h: D4 p f/ D/ f6 o
- *8 X5 \( j+ }. L; V2 ]( G# @% r9 p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 F# \" \( @1 q0 y( o
- * kind, whether express or implied; without even the implied warranty9 H9 c3 K1 O: _+ A6 |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 {, F# _5 R8 y5 }2 M
- * GNU General Public License for more details.4 } N$ I2 u9 h
- */$ [, ?( p# O \* l( ~
( P$ k4 |# d, C% i2 }- #include <linux/module.h>7 [5 x/ s' r: ]" n- v9 H+ ]9 G+ y
- #include <linux/init.h>5 Q7 G" n( ^% c6 X
- #include <linux/errno.h>
0 Y1 R5 R7 \0 } - #include <linux/types.h>
5 M/ S9 i, n9 W/ U, b# v7 o - #include <linux/interrupt.h>
6 r1 _9 i" O: |! o. H) I - #include <asm/io.h>
7 q' D" H' \. v& C8 L - #include <linux/moduleparam.h>5 T4 A+ B. H3 Q
- #include <linux/sysctl.h>
! }, ?. a2 n& e - #include <linux/mm.h>
% |1 J8 Q2 B# b3 l. M6 X( `6 }4 y. _3 d - #include <linux/dma-mapping.h>
# w* t, f; @- V f7 Y: } y
$ W$ ~# J- p2 }* ^9 d7 l- #include <mach/memory.h>% j! h" z' P, a4 [
- #include <mach/hardware.h>
* y% r8 T4 u+ g: p - #include <mach/irqs.h>
2 L. N5 I. J3 a/ g, t9 A1 N _ - #include <asm/hardware/edma.h>
+ u A9 v* Y" e' O+ `4 Y8 w& [ - ! N/ u2 H# |* W1 h
- #undef EDMA3_DEBUG9 x5 m- f. w2 g A/ C% c/ g
- /*#define EDMA3_DEBUG*/
8 T! X1 V z( m, G5 O
0 a8 x# D' M( x, H- #ifdef EDMA3_DEBUG
8 m9 [" i$ G: p. G8 Q: Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ N# y! {3 ^. V8 R2 ^9 ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) Q/ r ^. A/ t6 l- W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 ]% ^, t$ N8 \- \
- #else; ?# l }: I1 C
- #define DMA_PRINTK( x... )
3 @) v* |0 V7 ]/ I - #define DMA_FN_IN6 `9 Y8 M. B! s! Q% P, L
- #define DMA_FN_OUT9 U- r4 |1 q) u0 I
- #endif
# `. U) @7 Y; U# o. U, S- Z; Y+ F
* X- h% I; n8 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768) W9 d: [7 U2 L* X0 t9 n% B k
- #define STATIC_SHIFT 3
+ Y; V, Z! ]1 M% ^) R- A% a - #define TCINTEN_SHIFT 20
2 ]1 V' V5 D9 K' N, Y - #define ITCINTEN_SHIFT 21( ?! e5 P" A) ^& h$ B
- #define TCCHEN_SHIFT 22: \3 J8 q* N% _4 h' {' H
- #define ITCCHEN_SHIFT 236 ~/ E0 A) V; P0 Z. R- W
- 9 \; w! t% ~% h9 Q
- static volatile int irqraised1 = 0;
! U% |7 _4 i/ w4 `% T- z6 R# A - static volatile int irqraised2 = 0;
& M; m6 C$ U9 Y
. E6 ~$ x9 ]0 k& S) ?3 x" |( J) M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: m5 M6 h; `3 h- Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! O# C" ?4 _7 }- p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! u5 J$ J, T7 e% T
9 b; q0 ?0 ~7 O# Y+ k: y- dma_addr_t dmaphyssrc1 = 0;
' j% f! f. J$ F1 o - dma_addr_t dmaphyssrc2 = 0;
; Q! \% w/ e, j. O8 l. n. D9 W - dma_addr_t dmaphysdest1 = 0;
) }' H% d U5 C - dma_addr_t dmaphysdest2 = 0;; B& u9 |- `. o) V
9 N3 ?0 ~8 x) j3 U- char *dmabufsrc1 = NULL;
5 |9 J- p Q- ~; l0 N+ u% M5 N+ { - char *dmabufsrc2 = NULL;
8 u) o+ m/ Z2 s3 U' u - char *dmabufdest1 = NULL;9 z! `7 H) T/ y3 ]7 x
- char *dmabufdest2 = NULL;1 ?( U' t: a5 p3 ^" {
, x! F# w$ X: j ^* z1 i2 r- static int acnt = 512;
# ^+ U! c+ N4 R! F - static int bcnt = 8;! @* D0 M( I. b5 A
- static int ccnt = 8;
- v; M3 u2 c/ a8 j
6 `. d" }4 F+ s- s% e- module_param(acnt, int, S_IRUGO);! }( t& [0 q' i& U4 m# I! i! H1 L
- module_param(bcnt, int, S_IRUGO);
/ O7 H) L8 E3 M3 A. M% h- |# e9 l - module_param(ccnt, int, S_IRUGO);
复制代码 ; Q: r. h. z" ^6 f
/ B$ V( Z( Z2 i' H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% I! A% o! A8 ]' ?) {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& a: `$ X, v: b! w( H! S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; m1 S# f! q) c, l
) O. G2 f) ~; C, w& G: ~; `
6 r: ~) H) ~# x! A; O |
|