|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 J* E2 ~3 _- U% {" J$ F" y2 T
- [code]EDMA sample test application" j* L% m9 U, h4 R! `
- /*1 Y$ K& t. z" @* f* v
- * edma_test.c
3 I" e2 {' f6 [+ z - *2 p5 n% G# L9 f: _" w# _5 J
- * brief EDMA3 Test Application
- U# e& ?! \: U0 ?+ E - *; A' |/ A: y, J: n
- * This file contains EDMA3 Test code.
; K- Q4 l1 _# c6 E J - *
6 q w4 e r: c: q2 |0 A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ n" O; V0 ~" P$ Z' c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT s9 n6 N$ j8 L9 g, }
- * TO CHANGE.1 S6 U: q# h7 w1 d" m. x
- *
: U, x+ |3 o1 A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- R w* j D( R8 X3 b0 i - *
5 p9 r9 L/ F5 y+ l- c4 M! h - * This program is free software; you can redistribute it and/or
- F- E J# s6 W, R; \ - * modify it under the terms of the GNU General Public License as- k3 h: Z7 ^7 V$ `9 ~& K# A
- * published by the Free Software Foundation version 2.
/ S. v& d" t3 [( d: `" G8 X8 v# ? - *! X& ^4 G" j* q+ i) r4 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% a& @, [, ^9 j6 [# K3 O; T2 X' E - * kind, whether express or implied; without even the implied warranty3 M, [; n, W2 p# W; @, V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( H! y. y, e6 b5 r) c- z - * GNU General Public License for more details.
5 K0 K- I* R& H/ z" W - */6 L0 i d- y/ c3 ^+ a4 J
3 A1 R U% `* b% m8 x9 `4 F- #include <linux/module.h>3 u) p, F" \+ \6 E7 E! W
- #include <linux/init.h>
' P5 v2 J; C K! m5 N/ ]( W ? - #include <linux/errno.h># E0 H& ~9 x2 \
- #include <linux/types.h>
9 ?! y; S' @8 m, ^% T - #include <linux/interrupt.h>& t. d2 h, ~# ~6 k' ]7 g2 Z
- #include <asm/io.h>8 ~# m$ C$ h( F* I) M v8 O
- #include <linux/moduleparam.h>! D% u8 H% |5 @$ r
- #include <linux/sysctl.h>- {2 A* L" R- n3 L @$ ]1 h2 C
- #include <linux/mm.h>% M0 T# T0 R$ s- I. @; w: f' ?
- #include <linux/dma-mapping.h>, Z0 y1 g* f; k7 e4 Z% A, L4 p
* ]/ v/ V9 t+ x- Z: V' I' M- #include <mach/memory.h>
1 B! D @0 Q( h5 N$ x: f( `0 i - #include <mach/hardware.h>
4 C7 o1 J9 n8 n/ g" p/ O - #include <mach/irqs.h>4 O% J1 @) F2 O& I1 T
- #include <asm/hardware/edma.h>* g" ?7 h' F6 \, j
( U1 g5 N' B' D# u' t+ p! Q$ Q- #undef EDMA3_DEBUG
5 q/ \6 y1 ~, ^8 S' H) s7 U5 ~ - /*#define EDMA3_DEBUG*/
$ X8 ^, V5 j& @
' v, q5 `) v% a6 U* w- #ifdef EDMA3_DEBUG
6 u1 b% l$ z/ [0 G7 k \: J3 x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( r" s6 [' o1 O8 |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
X9 }, n. D' r* r0 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% V8 H% x' L& [1 A+ n2 B, x X - #else6 j$ I- e; |7 W: ~5 j. E
- #define DMA_PRINTK( x... )( ^. Y1 w- P1 o5 m0 Z9 {
- #define DMA_FN_IN
7 H7 `0 \) Q4 X6 `* r9 @ - #define DMA_FN_OUT' b$ I6 } n& t. g0 D
- #endif. H5 N2 O4 p h ?+ F
- 4 B6 l$ ~- S D% f4 F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 t- J; o9 d1 }' Z - #define STATIC_SHIFT 3
! ]2 q& N: N% Y3 z" o - #define TCINTEN_SHIFT 20
! c+ _6 A3 r2 X! Z" J) f7 H1 g - #define ITCINTEN_SHIFT 21. S2 L0 i2 k' L# w
- #define TCCHEN_SHIFT 22' k/ \1 c2 ]! ?% K( K% j
- #define ITCCHEN_SHIFT 23
- U1 ~% F1 \% y) B! u. Q
# n' ]! b8 G8 U7 l/ w% h4 j! S1 _" E3 c- static volatile int irqraised1 = 0;5 z8 m2 Z. R( M$ w+ ]' E! U) T
- static volatile int irqraised2 = 0;; ?. M5 _: r, U/ I8 f7 p Y. x
- 2 j5 Q. k p5 F! [! o) {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }/ M( {5 `* i0 B M1 D3 c3 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: i! a) O' j5 D1 h, R* M' i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: L1 [0 y8 [; H9 z1 t
- # k# _/ t7 i4 h; u1 I
- dma_addr_t dmaphyssrc1 = 0;+ m2 H# X) F9 S1 M. W+ V
- dma_addr_t dmaphyssrc2 = 0;$ f; Q8 N3 g9 q% _) T% w
- dma_addr_t dmaphysdest1 = 0;9 {9 L6 ^& u8 c; d
- dma_addr_t dmaphysdest2 = 0;
. L1 a5 Y/ K3 }# f! e( u
: P6 u& l. K2 ?0 h- char *dmabufsrc1 = NULL;
' s, `: ^* ? @+ J' S# j- z - char *dmabufsrc2 = NULL;1 ]+ |' A2 k% E4 x }) `
- char *dmabufdest1 = NULL;: [3 f! I! A2 Z/ ?. p
- char *dmabufdest2 = NULL;% ?/ G- h) p% k
- / C5 B+ \: s5 [; f
- static int acnt = 512;6 U( p% j h# r% o* T
- static int bcnt = 8;5 R$ c2 f2 w0 w5 ^9 T- x' e! p
- static int ccnt = 8;! Y) l, c {8 ?. ^; k
- # q1 o. \, L9 d/ I5 F
- module_param(acnt, int, S_IRUGO);( l9 G8 A5 c/ g; i3 H6 B5 X
- module_param(bcnt, int, S_IRUGO);2 L8 ^. z# l. ?# I
- module_param(ccnt, int, S_IRUGO);
复制代码
% Y- Y1 S# ^8 P3 f" @, y- j$ G3 D9 {4 g8 d2 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 b4 f/ ?; A% S' q" I( F1 _) \% aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ V4 I7 r7 G$ T4 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- t0 B0 l4 ^/ j% |' X. H2 G! V8 U3 d) a
3 G3 M' l3 h& m( d |
|