|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, W, ~1 X1 |( Q+ u& C+ o$ F- [code]EDMA sample test application X3 S& o/ r% c
- /*
5 J i8 h' Y F6 ~ - * edma_test.c
+ \4 `7 b( c1 o" D, r* w - *+ b- \ p* Y& U6 {1 v% p# t/ m
- * brief EDMA3 Test Application
' d0 @ w) J1 Q& v6 D6 o - *7 _! i5 ?$ Z! }& a1 J# V
- * This file contains EDMA3 Test code.: X* r' a) v; E: y9 n0 _5 g$ n
- *! d+ t" d6 i+ S6 l5 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# h5 d: K2 F' W- o( H- G8 B2 |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( H, }9 \9 E& x$ K* C - * TO CHANGE.
M: \2 _, c& d/ L. L' w! o - */ p* s5 I& ~# C/ P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 G- h0 b4 E6 m8 l+ q
- *
6 E# x! h6 H$ j3 H, ]$ O, p; L9 i - * This program is free software; you can redistribute it and/or
' K. V( E, x# Z& d) U6 {2 r - * modify it under the terms of the GNU General Public License as
/ I) K7 [1 u% ~ - * published by the Free Software Foundation version 2.
+ l ~! `5 k' _ - *
) P; h+ G$ v9 Z" y% ~9 A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 x+ n* j2 V" f. `9 | - * kind, whether express or implied; without even the implied warranty' [* i! h1 ]4 V* ~- K& n2 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# a( R/ W! S7 E
- * GNU General Public License for more details.0 V, r$ `8 q6 W4 V' @
- */' b2 Q- _3 v0 P, A# K& C
- x- l1 u/ H* P9 D) d
- #include <linux/module.h>+ X# f) l7 k) ^! r3 m
- #include <linux/init.h>
. w: r d+ i/ \ - #include <linux/errno.h>
/ m" z; w. p( Y8 t& G: o - #include <linux/types.h>
y6 u! Y+ Q' I7 g4 I2 a" s - #include <linux/interrupt.h>/ I& Z5 { R8 x1 _5 d h) T
- #include <asm/io.h>8 ~) V7 w$ V7 T# F* q
- #include <linux/moduleparam.h>
9 x3 H/ o- K! ]0 U - #include <linux/sysctl.h>; j* C8 j' U' c, M7 e( y q' Y9 [
- #include <linux/mm.h>
& J: z" N$ @% l& A& w - #include <linux/dma-mapping.h>" u" S1 F+ q" s
- 5 Z4 R* k+ e1 R
- #include <mach/memory.h>) J, {' W, `! L6 {. Z8 Q
- #include <mach/hardware.h>
/ w/ o8 ]- Q2 _1 Y4 _& R& z2 z - #include <mach/irqs.h>
, k" t8 G2 ~7 H - #include <asm/hardware/edma.h>
* f3 l# z3 j. d) L! _: s# M; l+ x - + X1 ]7 C5 G3 H* S
- #undef EDMA3_DEBUG s) z. D$ g5 e' y5 x/ D8 Q7 A- s
- /*#define EDMA3_DEBUG*/8 a3 M4 @, p, l) Q
- 5 w6 Q0 h) t7 q$ t0 }& M
- #ifdef EDMA3_DEBUG
5 ?1 m) h& |' F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), R3 s2 t2 |* s% w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). [" o# a, a. d0 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' j+ i/ e9 x1 e9 O8 M6 x) Q4 j1 N - #else R( k2 ?9 Y; Y) L4 Y* Z; \: s7 A
- #define DMA_PRINTK( x... )& m1 Z) v/ e2 i. B
- #define DMA_FN_IN
2 ~4 a3 E' q& O( D - #define DMA_FN_OUT. { ~& Q2 O7 N: v1 o; g
- #endif5 a8 B; X. c; q. ]4 k" ^0 I. v
- % Y. c# a! D0 [8 x; q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 T9 K/ c/ h( {+ O
- #define STATIC_SHIFT 3, x) e9 {6 M5 T0 P$ n
- #define TCINTEN_SHIFT 20. k5 a# f# P, K. C4 N
- #define ITCINTEN_SHIFT 21/ d& k; Q) G" y1 M" h! H
- #define TCCHEN_SHIFT 22& G% ?8 i" _5 D, q7 v
- #define ITCCHEN_SHIFT 23# W3 }# a3 t- x" D
- $ o D8 E7 b6 ~/ b/ l9 d2 r
- static volatile int irqraised1 = 0;
4 y+ M* B2 ]: E0 F5 S- C9 @ - static volatile int irqraised2 = 0;
) U* L6 T1 d& k) z! P' J, ^ - - ]: s; Z/ V- k% T9 R2 x* q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 x3 R( A2 v# M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( f8 U- k, k: ?. E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 W5 u9 U8 T% q9 f w0 P - + [+ I6 r6 X/ f$ K0 D" R
- dma_addr_t dmaphyssrc1 = 0;
' U. @ q: D( Q - dma_addr_t dmaphyssrc2 = 0;
5 l. w* Z* a& \! z9 ] - dma_addr_t dmaphysdest1 = 0;
4 e5 u" [. X) r& k! K2 i5 k - dma_addr_t dmaphysdest2 = 0;' v" w9 ]6 `; Q ^+ a
7 [& G, K4 b/ O0 N" J- char *dmabufsrc1 = NULL;- X1 H) r$ |1 V7 t
- char *dmabufsrc2 = NULL;
. G# Z4 u8 U0 w7 G8 a- e - char *dmabufdest1 = NULL;
; L J ^" k! @ - char *dmabufdest2 = NULL;
; r& A( p4 W5 y
6 |- L' p) B. `* r" d- static int acnt = 512;- P# [9 U$ e1 u8 Y
- static int bcnt = 8;
: |5 j' ]( ~4 B# m9 d8 n - static int ccnt = 8;
# m2 M+ S7 d v% N3 z! B! O - ; i( {, \7 w& s0 Z
- module_param(acnt, int, S_IRUGO);+ A( X# M% h# Z) ?; u) j7 T
- module_param(bcnt, int, S_IRUGO);" \ h' g- g9 V
- module_param(ccnt, int, S_IRUGO);
复制代码
6 |; l m8 t6 `$ K' N" ]2 E0 B0 u, W7 h Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# N! N5 x* Q8 r. X4 Q5 ]& {! S5 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- H6 P) i% ?& Q. \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# @2 g$ T' g- n! m: K! p
2 X$ e! ]0 m* v& [' E, B; [. m
8 C( ~5 X7 W8 G n/ z6 y+ } |
|