|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 f7 q8 v, a$ X ^
- [code]EDMA sample test application
4 J$ M) D6 C% [4 @ - /*, S8 b. N" k, m/ x: O) D
- * edma_test.c# m! @ N g" }+ x: a+ [* e# e% `# d
- *
: }% I2 E! ]7 E6 P - * brief EDMA3 Test Application
5 s; {5 B! T' P - *
( I, Z/ E1 j$ Z4 l! ~ - * This file contains EDMA3 Test code.* X& ^, P0 n3 X9 G3 ] n' n
- *" p. v2 l! o0 a+ I6 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ F! _& V4 I5 P/ o; T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 N |3 L2 ]3 X - * TO CHANGE.
: U w) a5 ~* o$ O ?5 n) T+ D - *) X8 h; Q r* P7 {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: h R% v9 ~+ R" {% D. l$ A/ q
- *. I, q% }! v" X6 ]
- * This program is free software; you can redistribute it and/or g" J( z# F0 d9 b6 r
- * modify it under the terms of the GNU General Public License as2 B4 |- a2 `6 N
- * published by the Free Software Foundation version 2.
, h) G8 O0 P( m5 O3 l& [" q3 s - *" e; `: |: |6 a2 N; r9 H+ B1 [6 N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ Q) e6 s( x9 U; y" @ - * kind, whether express or implied; without even the implied warranty
+ g* [! `3 T* H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ `( |3 H: ^* N2 Q( d, E - * GNU General Public License for more details.5 O2 _2 ^ G' D
- */3 @9 }) }7 b5 V2 a% g
0 G+ i; _+ G6 e( F9 U5 r$ Q; K& p8 H2 `- #include <linux/module.h>0 Y# K1 x7 `6 w5 ~! f. w* ?! i
- #include <linux/init.h>2 V; ^( m) p( A. A
- #include <linux/errno.h>8 i/ L3 B4 S2 x3 ]& p4 B8 j
- #include <linux/types.h>
- a6 j% J; X; k3 M, X2 Q) H9 i) n - #include <linux/interrupt.h>$ Z2 l1 K) X9 A9 L c k: i
- #include <asm/io.h>( D# }' P ]! i6 ~
- #include <linux/moduleparam.h>: u+ r8 M+ u+ a2 F( |& j# S
- #include <linux/sysctl.h>
4 `$ W( I7 ]! `# c! ^# w! U# n - #include <linux/mm.h>$ A* I" c3 P6 G) q' b# G
- #include <linux/dma-mapping.h>
1 }% D& u2 t# ~' O$ q$ Y7 u - 3 b: Q# t+ `. T0 g& N8 k
- #include <mach/memory.h>9 P3 h5 b: T w. y
- #include <mach/hardware.h>3 U+ r1 |5 w) U0 ?( j2 G1 ]
- #include <mach/irqs.h>
1 f3 S& X( Z' u7 ~0 B0 E - #include <asm/hardware/edma.h>7 M U) T5 W, `1 p) }" @1 y
- ! L2 r6 S$ C' \& C
- #undef EDMA3_DEBUG
9 U7 c, [* d: j4 l - /*#define EDMA3_DEBUG*/
' z: [2 k' {2 K$ T% l - 7 ]& P& b P1 j3 ~" d, u3 v
- #ifdef EDMA3_DEBUG
/ m. h& p/ j8 x% H2 N( x, E4 @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- r4 Q' f( x L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) c1 K: L! ?6 W; {; l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! N; _2 @0 m8 i4 m m
- #else
) h1 M! y4 a D/ q+ B - #define DMA_PRINTK( x... )( ~1 ?! y8 N% V+ s& A
- #define DMA_FN_IN
2 G1 u% W3 Y, u* B6 X' H9 l8 |$ { - #define DMA_FN_OUT1 W& `% M5 ]2 \! ~; J& B
- #endif- @7 u. x& s1 t" Y
9 k. u* c2 i- v- f- L# l- u* g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% o) h& ^' J& m: ?
- #define STATIC_SHIFT 3, a. l* [) l7 r; U% u3 a- r" R
- #define TCINTEN_SHIFT 200 ]! _! Z1 ~6 l; F7 r* C" ]5 `
- #define ITCINTEN_SHIFT 213 N, g z8 B, B+ |
- #define TCCHEN_SHIFT 22
1 H6 {% }, o7 I9 G5 A4 N - #define ITCCHEN_SHIFT 23& d" a1 |+ x2 M" D- S
- 5 O0 q1 l1 N+ j) Z* b) V5 f6 D
- static volatile int irqraised1 = 0;0 J( R; Q, J5 W9 Q9 c5 d
- static volatile int irqraised2 = 0;
# N; X4 W; t; d3 Y - $ S! ?/ p" D9 ^8 f- E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 _; I" p5 Q4 R% M$ D0 o/ @" f0 o4 H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 P; X2 A9 U0 o) G6 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, }9 y2 h: M6 } t3 M' ^
/ t) Y2 q2 S* z7 K' f- dma_addr_t dmaphyssrc1 = 0;: I! A6 U! B8 x( e) s' ?
- dma_addr_t dmaphyssrc2 = 0;- B! W: h! s1 ]4 T6 P8 `
- dma_addr_t dmaphysdest1 = 0;
% S- F) A. ?8 F% p* u - dma_addr_t dmaphysdest2 = 0;2 T3 G+ J; S& s8 K" {- Q( D
- 3 M i9 S) A8 G7 R! o4 r
- char *dmabufsrc1 = NULL;- J! N9 V, y2 j6 V! @
- char *dmabufsrc2 = NULL;" }2 H. q8 ]: R6 i* o( f
- char *dmabufdest1 = NULL;
6 ^* G9 w& @1 r& F) o; L: j, F% g9 C - char *dmabufdest2 = NULL;6 l: Z: V- R$ N. r D
- 7 @- E& I8 e$ o, V" W; A
- static int acnt = 512;
7 n7 }4 ^8 _3 \. N; o - static int bcnt = 8;) B; q; N) k- U3 X% a' W* _4 o
- static int ccnt = 8;
& `2 F, ~7 n& J4 y1 p5 F' Z
, u- K3 P, `' f( J: O+ |5 C- module_param(acnt, int, S_IRUGO);1 U% L/ ]7 x8 `) r" W
- module_param(bcnt, int, S_IRUGO);
/ S$ z. d& G7 v& `) ~ - module_param(ccnt, int, S_IRUGO);
复制代码
, V3 j! t3 m! _0 @& a2 I* F0 ?) m% W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
w& X4 l7 }( g' ?# Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: x" L2 x/ I9 w( g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% [# y; D% ~ }% G5 l
" f! w; H) D A, H$ H, J2 W: p R3 p0 k3 M5 m, ^: U+ Y
|
|