|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( b1 a! D1 X z4 B3 U- [code]EDMA sample test application
3 W4 z) }* P1 r2 U- e2 }6 D - /*8 @. U; a' b4 Y% L' r: W s; v
- * edma_test.c: v$ e3 }$ R: p: Y. s- a& L
- *
* @9 C; F0 r; [- o `, \ - * brief EDMA3 Test Application
0 W' J& B+ N! r1 c- s4 L - *
9 w7 c# x$ ?+ K8 D" `$ q - * This file contains EDMA3 Test code.: @8 L) C/ G. n4 r
- *- i2 I$ I' d8 t2 n- B. H" q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ k$ a: H; b! Q- ?2 b8 E/ U: E1 R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT z0 i- E! n8 U: l. \% M9 e, e5 h1 \
- * TO CHANGE.
6 B+ I& U. t: Y" F - *
, l* ?* h8 ]$ t2 X( Z% d. D/ O: ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ x0 q" J/ k( E7 K# b
- *$ ?) B! p# k* Z' l# ?
- * This program is free software; you can redistribute it and/or. R* S4 h5 n/ k. Y6 ^
- * modify it under the terms of the GNU General Public License as0 Z) X6 L# A; Y+ I/ a; L, ^& B
- * published by the Free Software Foundation version 2.$ w( D1 p4 G' n
- *
+ N: z" {8 K/ Z' d* Y# t* @! { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 r! c/ o& o5 m3 U8 Q" o - * kind, whether express or implied; without even the implied warranty1 i& a) V# ^4 A" @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: K: H* P4 }/ E/ T - * GNU General Public License for more details.
0 }) W6 e2 t7 d& x5 @! {3 r; u5 [ - */9 h+ i% i( @+ N/ U2 w* Z
6 Q' U6 Y( ]* B7 ^- L- #include <linux/module.h>( |: I7 |6 o9 N; Y. X" }9 ~* q
- #include <linux/init.h>1 @9 H5 Q& o1 @ x
- #include <linux/errno.h>/ S" f5 C1 s1 M: x4 l3 X
- #include <linux/types.h>
/ {$ ~: G; _2 S3 D - #include <linux/interrupt.h>$ d. H! @- a9 D6 x4 ~0 x; E% z
- #include <asm/io.h>
& I) G8 I( V4 Z4 {3 _7 r - #include <linux/moduleparam.h>
+ c. c* c* A* F; P - #include <linux/sysctl.h>
, J. B* \% A5 }- o - #include <linux/mm.h>
2 d1 ~; Q2 c( ^ w# d2 v - #include <linux/dma-mapping.h>2 [( K1 C" p8 r
- , U# J" `+ o8 q6 \) J* ~0 H
- #include <mach/memory.h>
1 d3 s5 g6 A% w- O$ [5 f - #include <mach/hardware.h>
. n& u. o7 \/ e2 s# { - #include <mach/irqs.h>
+ i2 v* J. d6 V6 A$ l) V - #include <asm/hardware/edma.h>
: o9 Q* ]3 s. s7 @7 `
. i5 I# C1 y; T& H" X- #undef EDMA3_DEBUG2 \% \% r, [# c, a: W9 ?* T# G
- /*#define EDMA3_DEBUG*/# Z7 g* w8 E7 I/ [" l& y
2 ?& L" v6 A8 a/ f0 u( H1 @9 J- #ifdef EDMA3_DEBUG0 \1 Q, P% K+ {2 U! m& Q; E3 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) X7 c( @ K' s, a! l! L$ O% `( I+ ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% E3 J+ V ]2 k& b Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ k7 s% ^8 W6 p" C c0 o
- #else! f% t% ?( p ^! `4 {
- #define DMA_PRINTK( x... )
& o5 q% n0 }) t2 ~" [# e. D/ @ - #define DMA_FN_IN
" i9 }+ H6 t7 T6 K3 _ - #define DMA_FN_OUT
* B; W2 J, [- R* N; M8 }4 M - #endif% s3 @9 R) j, R+ M+ N& f/ H
8 z7 N: O. q/ @( ^- ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ {7 I* i" t; L9 W0 L - #define STATIC_SHIFT 37 i0 ]( y4 Z" O$ ~/ D
- #define TCINTEN_SHIFT 20
' X3 v. N2 a- S6 Y- |5 b - #define ITCINTEN_SHIFT 215 E# ^! o. w" u
- #define TCCHEN_SHIFT 22
% G" A5 r# M8 P! n6 I - #define ITCCHEN_SHIFT 23
0 X. a0 ^% u8 n$ A
# }! U; K$ ^2 E- static volatile int irqraised1 = 0;
9 b! @8 [+ O* i" z - static volatile int irqraised2 = 0;9 O6 \3 @1 }, `9 X: W. S
: \3 J( p$ j, T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; i% @; j2 R$ G; ~' b# I" T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ?( H1 R" V, H! E$ C7 e/ i" |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# y. d/ v7 C {% |% v$ j' i* H
$ e/ [1 |3 C+ q, G+ \. M% ?9 @- dma_addr_t dmaphyssrc1 = 0;6 |( x, v/ [ L: K
- dma_addr_t dmaphyssrc2 = 0;* W# x5 x+ l. I+ _
- dma_addr_t dmaphysdest1 = 0;
; K- y) ]6 m: E) M) N% A - dma_addr_t dmaphysdest2 = 0;7 p' q4 n* ^ T( [
- - |. T; B/ h7 X# }
- char *dmabufsrc1 = NULL;: ]5 S" I, v8 Q/ |, g
- char *dmabufsrc2 = NULL;
) C8 l! X0 W6 \0 T2 |2 ]$ j - char *dmabufdest1 = NULL;
, o$ ]2 H$ g7 W7 v) B& L6 R6 V - char *dmabufdest2 = NULL;* \ v6 ]# W: k: x% f
- ) V9 X, f. `* x: u
- static int acnt = 512;
8 }+ R- [ E0 l. k4 X9 @! z - static int bcnt = 8;
/ [" Y" `7 H& J - static int ccnt = 8;0 L3 O% z1 M2 H6 z9 h2 v
- ( B3 n% L& y. r& W
- module_param(acnt, int, S_IRUGO);
1 v6 P" l1 P, h7 a' y - module_param(bcnt, int, S_IRUGO);1 _; q- D) f- G4 n% D
- module_param(ccnt, int, S_IRUGO);
复制代码 ; O; r1 C# p+ b
. k" j" l. A, V( [% M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% l$ [' @+ {9 i+ I3 I& u8 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 ?7 z. j! j/ c, h* z% D3 W) y' O2 Y2 ?4 e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( c9 Y! _* U6 x S
* P* S+ n1 v0 v6 h; v$ }' b8 W. U% G
9 A0 Q3 c6 {0 U5 q( ^) H# i
|
|