|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' z4 H7 w/ K+ Y1 `
- [code]EDMA sample test application
# }: A) b. S4 p! K5 H" P0 a& j- m - /*
2 o; ` S8 R9 C6 ^, L - * edma_test.c+ d5 q8 h) u* {8 a# J
- *6 R/ P$ A" G7 m- p/ q7 {) I% c
- * brief EDMA3 Test Application( k+ w3 Y' r5 L& W
- *
& `" K0 | h+ E - * This file contains EDMA3 Test code.
$ g$ t ]. ^2 V# a - *7 E; g2 \. m. @% A. f/ s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, M0 b) Z8 `3 M- @/ R W1 F+ C+ [' U9 g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 h' C: ~; J! j9 r$ S
- * TO CHANGE.
4 b1 @( J7 A# l- W& Q+ c - ** Y3 c, p/ u+ f# `( d* f- g* A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- y8 R8 K# O3 F9 Y6 x - *6 W: U/ n: c$ c( u$ |
- * This program is free software; you can redistribute it and/or
3 A9 j& v m9 h4 i: i v - * modify it under the terms of the GNU General Public License as+ {$ q b" g+ ]+ V
- * published by the Free Software Foundation version 2.
5 N ?+ i1 ~$ n) B - *
6 `/ S2 a- W* J8 Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' D& b3 I$ q5 a& [" l4 {) @
- * kind, whether express or implied; without even the implied warranty
3 j8 d M" c B# @7 J6 E* b: D: L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; j9 g7 |. D) q; f& m' [9 j - * GNU General Public License for more details.
; L) h! |4 ]( B; o9 h - */% y9 A# ?5 u$ h: Y
- 4 O' j7 o `; \9 T
- #include <linux/module.h>
0 p( `+ D! i$ y8 t; ]6 d - #include <linux/init.h>
# z; Z; p" G* y7 g - #include <linux/errno.h>
/ P& h; u% V/ C3 T; v7 X2 y - #include <linux/types.h>
" V4 u1 L! X8 C" x$ a( o1 Y0 b4 L5 U# ]+ F - #include <linux/interrupt.h>6 d. u( I$ b/ l' I% \
- #include <asm/io.h>7 q1 u2 J' ], A' n4 d& O
- #include <linux/moduleparam.h>
5 x, f5 N/ m `( h8 A) k! }+ Q% E0 m - #include <linux/sysctl.h>
2 }& w' l) h2 C: j. M, ]. s8 z - #include <linux/mm.h>/ F' y+ a% J2 f* C! `
- #include <linux/dma-mapping.h>
8 g$ }+ A) k% b7 t% ^
, f$ \' ^7 x; w: O- #include <mach/memory.h>
. J+ a$ W+ D- S6 `: q2 x - #include <mach/hardware.h>
6 W0 z# h4 y8 r6 n - #include <mach/irqs.h>
6 G2 s4 g/ Y: ?2 i6 e1 y - #include <asm/hardware/edma.h>
5 ?' o/ c: Z) e7 B6 }5 L4 B - " _& r" p) S: r4 o
- #undef EDMA3_DEBUG
5 Y9 Q$ ]% m1 {3 Q - /*#define EDMA3_DEBUG*/
. c2 |) s& x/ ?6 z" A9 } - : @" [# }7 V. f, G: s1 c/ m Y
- #ifdef EDMA3_DEBUG5 ^9 v% G+ u5 @6 ]' u1 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 b, L& e& {* d' s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 t( V5 G' D6 y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; |7 N2 L9 ?; Y9 ?9 w4 w0 L - #else/ X& j& l3 N% G) Y
- #define DMA_PRINTK( x... )5 Y# j& Z \! b5 r: ]) ]/ s2 y
- #define DMA_FN_IN P& m# k) h+ B; v T# G: I- B
- #define DMA_FN_OUT2 ?8 i5 P( e) h4 P' y, V
- #endif
$ k9 s6 m8 P- _7 k8 d3 v W) T - ( o; x5 k. E, x% h9 U- Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) G$ Z3 `: a0 e7 A+ e; v# W9 t1 d - #define STATIC_SHIFT 3' O# z- z. z! }: Y1 e
- #define TCINTEN_SHIFT 20& q- u) a! ?- K# b2 i3 w. w0 B4 X
- #define ITCINTEN_SHIFT 21/ W% h; Q) y/ ^
- #define TCCHEN_SHIFT 22
" C) @7 @" C: }+ J0 u4 c* B - #define ITCCHEN_SHIFT 23
9 f. \8 T: v( f, Y$ d. G8 O6 R
2 {; ~/ r% H6 U0 y3 P& a- static volatile int irqraised1 = 0;$ p+ y1 c$ t' g5 y6 b
- static volatile int irqraised2 = 0;0 W, u( E! @7 V: X/ }6 J* A! S
; f5 K0 O: C. @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Y" k; s+ Q- v E/ s$ f- S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ~, i% e, `3 }! s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' L; i' V. F! q q
* K" ]! b- e7 H3 f0 @5 h" |& k; G9 E- dma_addr_t dmaphyssrc1 = 0;; I/ L4 P) V9 O! G# r
- dma_addr_t dmaphyssrc2 = 0;
1 J3 d, r* B* ^7 V | - dma_addr_t dmaphysdest1 = 0; a V9 H1 o) h. X+ r
- dma_addr_t dmaphysdest2 = 0;6 }. G- W; `; w% t" _1 b
, a5 U$ {* k; M5 B/ A0 r- char *dmabufsrc1 = NULL;
- T) p# B D' A" m, N - char *dmabufsrc2 = NULL;
" Z. X! \6 g/ k7 D" W& g) d g2 E - char *dmabufdest1 = NULL;6 O% r5 d A8 B; o* J" o$ d
- char *dmabufdest2 = NULL;! e4 [' Z9 O% M" O( R
- t7 }3 `4 B# L4 ~6 g% Z7 n
- static int acnt = 512;
( m) A, ~% r# ^( F/ X, q. T4 d# \. z* r - static int bcnt = 8;
/ k t9 `0 `6 \1 F0 V. J$ H5 T' z - static int ccnt = 8;3 {9 _+ X: U' p1 m/ E
- & d9 }( u: B" R1 b [; O
- module_param(acnt, int, S_IRUGO);
8 E/ j, U! ?; r- b6 \ - module_param(bcnt, int, S_IRUGO);- m- y0 {, y6 f H. J, e' u
- module_param(ccnt, int, S_IRUGO);
复制代码
- X( j# f' P4 Q5 L; n/ d5 r5 ~0 z2 v7 R0 F2 Q0 R8 ~6 X' P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 L9 u( V s4 o* ^! W* g2 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( u* ]' ?5 Z9 z3 ~5 @, l( ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& g# i2 f( G8 z2 K2 G% L$ y& j
7 C D) `7 b: s4 [: h; t( u
# F# W6 z7 h9 Q0 h6 K |
|