|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 G7 A# L; r( W; Q9 d! w- [code]EDMA sample test application5 R/ L) T/ J$ V, k5 @7 m1 ~6 J
- /*7 `$ r* O" V& l: Z% W0 d
- * edma_test.c0 l q* w' s( B$ Q. L5 e
- *
c2 p0 ^* W6 K- ] - * brief EDMA3 Test Application
6 r# T/ Y* {3 p+ g - *+ E4 u# t4 L9 E3 u
- * This file contains EDMA3 Test code.
4 h5 M. F9 H6 C* x7 a4 o3 a* F, `$ p - *0 w) j& Z" a- i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; T, ?: j/ t/ p4 c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
Z5 Q3 @( L6 w/ I - * TO CHANGE.
9 s5 G7 y1 v/ c - *
+ Y9 ~; z: t/ i2 [. x( d$ q6 M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 M* Y1 u9 L3 v/ \& W0 k
- *
7 R9 ~5 k" h/ @ W4 T" { - * This program is free software; you can redistribute it and/or
4 B. u& W5 o2 Y+ Y- Y; ~% m7 u - * modify it under the terms of the GNU General Public License as
. K/ N" J+ F. F - * published by the Free Software Foundation version 2.
0 a. O2 j1 v& Y" Q+ O/ k - *
6 `6 a7 \; b( d+ Z& W0 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( m1 [. g( j" s% C- }( h- X
- * kind, whether express or implied; without even the implied warranty
- C: W& L) D/ T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ y6 R+ Z& J+ b/ ~ g1 H. `
- * GNU General Public License for more details.7 j- H: H( y6 {1 f, [! U3 ?9 S5 e
- */
7 m* Y4 `) a, `7 H
' N5 J+ V" C& u2 [1 }* W- #include <linux/module.h>
' y' O* o" E' e+ k - #include <linux/init.h>5 V3 ~/ `( D, \' Z
- #include <linux/errno.h>
3 o) C) A; @# d( u+ } - #include <linux/types.h>
5 b, [! v/ b, Q# c% z# R- V1 @ - #include <linux/interrupt.h>6 ^7 [. k% @( q6 B9 Z$ x4 B
- #include <asm/io.h>
- y1 D* Z6 [/ {8 c - #include <linux/moduleparam.h>
/ l2 E u. G3 _, K: I* D# x - #include <linux/sysctl.h>" h" R; p3 b) y5 y, g q8 h( Q
- #include <linux/mm.h>
, s$ u2 _" y( d- l- J - #include <linux/dma-mapping.h>, u7 `. l1 w( k
T7 i* A1 G; |! K& X6 ^- #include <mach/memory.h>! r: d, X3 }7 z- S/ b. M
- #include <mach/hardware.h>) I$ ]. ^, f5 Z6 x7 J; Y" t" `
- #include <mach/irqs.h>
7 g5 R8 S. k& e% u# u" n [ - #include <asm/hardware/edma.h>
) f! K3 ]; e* C. M3 Z) V0 \; m - ' L- K( N0 L' @; Q. x; ]$ O6 F
- #undef EDMA3_DEBUG
8 A0 w* K( C# M( h0 j$ h6 ` - /*#define EDMA3_DEBUG*/
2 g$ y; m/ b9 F9 Q) f% v
, j; O8 B1 ~+ [0 u- #ifdef EDMA3_DEBUG
6 M) i' I* M, @0 a+ L" w5 S8 U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
z# G7 C2 D/ R0 Y% J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 z* j% R+ T. W- e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ [- U' K9 _% G; C' t% U; X/ @ - #else& _0 O, n2 V8 d, r
- #define DMA_PRINTK( x... )( M1 {( `# {3 ~+ L
- #define DMA_FN_IN2 n$ i$ s. Z/ Y
- #define DMA_FN_OUT8 d' ?. \/ g' J
- #endif
7 N; U; }. B* y) T6 F% C) K4 X$ x9 s - $ G! @+ H3 ?5 I$ w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- ^, U- K s8 C/ m" ?) s - #define STATIC_SHIFT 3
1 l- {" j7 L! ?/ }# b - #define TCINTEN_SHIFT 20* H7 v" p. u& b6 ?7 n. q$ T
- #define ITCINTEN_SHIFT 21+ }4 n: T( y" c% c
- #define TCCHEN_SHIFT 22' H% I# T# v' f# ], ~: k, F
- #define ITCCHEN_SHIFT 23
' o6 G. _; n- g. f' A
3 V# v1 q7 S8 ~+ r3 O+ {& b8 e/ _- static volatile int irqraised1 = 0;, M, e2 b) g* U3 r- X3 Q0 L; K! Y
- static volatile int irqraised2 = 0;% ^; V8 a. ]& f0 i4 V
, I8 M0 o: B$ c5 m5 K* s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 c& |, ~2 l3 Y7 {) B9 l8 c+ z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 l2 s( p1 U% {3 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- n5 n) c! r% E/ R! J' t
- & @, L; K8 G9 B/ H
- dma_addr_t dmaphyssrc1 = 0;
7 j2 s4 F$ R, W. X, d8 b. |# j - dma_addr_t dmaphyssrc2 = 0;
! \) x- N0 J- } - dma_addr_t dmaphysdest1 = 0;" m4 L0 H! C2 M: ?; G
- dma_addr_t dmaphysdest2 = 0;
$ h! r3 s o5 K. o - 1 `; a' j: e& y. ~) @& c
- char *dmabufsrc1 = NULL;
" u q$ f3 [2 D, i - char *dmabufsrc2 = NULL;/ s% a: b0 u; s! _7 r5 q
- char *dmabufdest1 = NULL;
, \5 b1 U5 G8 [! s$ |3 B4 D" r# Q - char *dmabufdest2 = NULL;
. c% [3 ?+ Y+ | U - 4 H. u2 H- M- Y6 w3 Z) |7 J
- static int acnt = 512;% c H+ d6 A# ~' d% `
- static int bcnt = 8;
4 k- D- m) p( t3 l - static int ccnt = 8; E* F w4 r# e) ]! k
- + x2 a \, q& k
- module_param(acnt, int, S_IRUGO);
5 |) T6 {$ i% g/ k6 P$ D2 F' Z - module_param(bcnt, int, S_IRUGO);! R" f8 X! Z9 H S
- module_param(ccnt, int, S_IRUGO);
复制代码 ( P: X- `0 \( o9 \% W; P
6 ~0 t% \! h1 x* V. _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 r) w/ o$ ]. ~4 A8 Z3 l) [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. \6 h. N4 L3 _/ C/ O/ J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 m# e7 ?& e. d6 @+ }* C- Q+ M* S) p: ?1 u6 a( ]5 R
. M0 M, c( `* g0 y% C- I f
|
|