|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ v) c0 ~' T" V- [code]EDMA sample test application5 Q; t8 j P$ m" C
- /*, X$ A: e0 Z1 s% }! N5 x
- * edma_test.c/ E# u9 J! V9 Q( y* o) M; V, D9 I E
- *6 { ~0 }0 c, V! _' X6 }$ {
- * brief EDMA3 Test Application
/ i5 X. _- A! c5 J2 H - *
' H5 p; j. I* o. E7 ^# w - * This file contains EDMA3 Test code.( t' r6 s/ c5 b/ Q# i( r: N% t
- * J$ Q+ x, i4 A+ m g' A! u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: L2 N _& v! v6 k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ }" {% i5 Q4 }5 S - * TO CHANGE.
7 j7 H+ B( d8 R# b/ S3 V/ J - *
; D) U" \& N/ k/ ^4 F. P, B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: r! U: _3 |9 q7 A; p - * s# j$ @5 C* d- l
- * This program is free software; you can redistribute it and/or! `. y' W& Q* v4 l. C. D& A
- * modify it under the terms of the GNU General Public License as6 U3 e6 i5 m C) G
- * published by the Free Software Foundation version 2.
$ ?* F+ U: m7 V1 h/ A - *- F3 q" u+ y& x9 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 E) h9 W, c8 E _# H4 R - * kind, whether express or implied; without even the implied warranty2 \5 w' [6 t" C+ d t+ T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* |3 k7 u! W$ F! H4 Z
- * GNU General Public License for more details.
. t2 {5 d/ F' f% P% y5 R - */
1 m" ~* I( ^0 K, X# K! d/ r( y/ E) Q
% P+ F& h7 m- r( X% \: v- #include <linux/module.h>
; S- k9 ^+ o7 |2 t - #include <linux/init.h>
- n# J/ q2 g2 T% g( P1 F - #include <linux/errno.h>0 T1 }7 J6 l! B. ~5 u' J
- #include <linux/types.h>
8 [+ ]+ ]4 U9 e4 s# `! y - #include <linux/interrupt.h>
- L5 f7 v+ ~( s2 m0 ^ - #include <asm/io.h>+ W9 q/ o) x% U/ a* w1 O, a
- #include <linux/moduleparam.h>
9 h* c( Z0 p7 u - #include <linux/sysctl.h>
" ?& m i' }9 m( b - #include <linux/mm.h>/ M1 }: P9 u* e% D1 U {
- #include <linux/dma-mapping.h>5 H N: \7 W5 _* @7 u; H
- 6 Z! n/ U5 t5 R# h: A
- #include <mach/memory.h>
* g* u% g& _2 X' c( A# o4 | - #include <mach/hardware.h>& j' Q. P) s/ s7 W4 U* \
- #include <mach/irqs.h>, A7 A, T! B: n6 c" S
- #include <asm/hardware/edma.h>
& l& P8 W$ j# P/ K
. Q% L) k8 o8 b! U, U0 P9 u) D- #undef EDMA3_DEBUG
) F# _: s' k* u4 m F - /*#define EDMA3_DEBUG*/' m' e9 i6 G( I, A
- 1 D* ?2 \" i; D w9 Z6 \1 |4 k$ F. {2 u
- #ifdef EDMA3_DEBUG
6 r3 j7 s0 b3 @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" S4 Z1 @5 T/ j+ B0 u8 @) d% g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ f0 C+ ^. Y& Y: e" t% q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 ~9 {' E! f0 Z9 ?6 m/ Z, P4 _ - #else
+ _. \7 H. Y6 q9 |0 O0 g/ L& X - #define DMA_PRINTK( x... )0 Q/ d3 M+ P& |/ `1 n, T8 y' Y
- #define DMA_FN_IN8 |2 E, j( d2 [) ^1 R( v; }
- #define DMA_FN_OUT
2 p2 ?# H# B7 @, H& Z# ` - #endif& p" C% l$ T# [! N" q& a6 X
- : J3 U6 B) ]0 p# P5 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 t! C. V. s. ~6 ]# S0 C( y Z
- #define STATIC_SHIFT 3
8 `( a; z1 V1 j6 W H. q% P - #define TCINTEN_SHIFT 20
- q' B# I0 u2 @5 e - #define ITCINTEN_SHIFT 21
! n5 I7 p; F3 g* y' E2 @6 L/ J - #define TCCHEN_SHIFT 22- ?! A0 N6 Y ?7 Y
- #define ITCCHEN_SHIFT 23
$ L; |, L' C2 }4 v8 t3 o - + D4 d. _% c7 u$ b# ?9 |
- static volatile int irqraised1 = 0;
+ n0 y) y) X* ^8 i' F3 m - static volatile int irqraised2 = 0;1 X5 f/ \ X( x- M( o
- / K, H2 U2 v$ j( h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R9 E# ]3 e+ ?8 ^6 O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; O# N- Q9 P5 a0 _ l4 g0 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& K1 K+ p( y }( x! B' q, D% l - 4 ^1 G& M6 N' b2 |
- dma_addr_t dmaphyssrc1 = 0; Q9 ]( O9 s& } |6 r9 ~& t
- dma_addr_t dmaphyssrc2 = 0;
& G" @2 N" i/ C) V& K, s - dma_addr_t dmaphysdest1 = 0;4 t" f/ Q7 q, L2 I' k% R$ E0 n
- dma_addr_t dmaphysdest2 = 0;+ G' O' A. W3 }1 q
- 9 e: o$ Z/ _- F* d, R+ }* \% z
- char *dmabufsrc1 = NULL;
2 C" Q5 E: m5 H, L7 Z C- G7 W - char *dmabufsrc2 = NULL;
% }0 v. k' w( K) G6 N! z2 y - char *dmabufdest1 = NULL;
; {3 f2 K ?2 X9 A1 f. m% m - char *dmabufdest2 = NULL;" U8 f! Y0 n9 N. b% [$ F
4 u7 ~* {, \4 A9 W1 y* V- static int acnt = 512;
5 r; v, H2 f/ Y6 }$ F* c - static int bcnt = 8;
: D, F' i! U1 [! x- r - static int ccnt = 8;
; V- q% ^/ i7 M: ^0 _/ C) i9 e, }
7 R& r# s4 z& {* C+ Y/ u$ s- module_param(acnt, int, S_IRUGO);6 o( M$ p( f. c
- module_param(bcnt, int, S_IRUGO);
+ o' {4 _* }5 r( X! { - module_param(ccnt, int, S_IRUGO);
复制代码 ' U9 o1 E; Y7 p- d4 g3 ]
6 g3 z/ r, L( N1 N$ K m) _$ c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 f! r/ m, I/ a$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ f7 S9 D& a/ a' u2 M/ ~' K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ P4 R+ x) ?; @- w) y6 L
7 _9 E4 f- G; H0 A( \: G
0 ]$ q3 A# ~# p3 I2 `& l$ M |
|