|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# R& J6 a/ u$ O- D" w- [code]EDMA sample test application
( f4 ` M. C+ Y% L& c6 x$ b* q - /*
4 f$ Z$ x- L* J - * edma_test.c U# {! u/ T$ ?
- *6 N& p4 @" p/ `& b* d
- * brief EDMA3 Test Application
4 V3 V8 x0 i3 X6 q - *" x" _* P* q7 {& k2 V1 p
- * This file contains EDMA3 Test code.
* F2 `3 L" b+ F5 O - *
/ Q$ V" T; m1 v5 D& k5 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE l. Y( H0 @) O0 N( r7 e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' A! O0 V2 n ]/ E9 R5 U% A
- * TO CHANGE.
, k0 _( ~% Q N! k' H# W - *7 B# @% c1 s- K" b1 t9 |* W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 _/ ]3 ?# t6 l! e5 q) |/ P7 q
- *! _. a9 M% y I1 n, o6 V
- * This program is free software; you can redistribute it and/or
' q( P) I: I m - * modify it under the terms of the GNU General Public License as2 R4 |0 y1 r2 |
- * published by the Free Software Foundation version 2.0 x& H. k( k) t
- *
2 V4 k: K! F- ^) y9 U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' r& Y9 V! r2 C. L$ z' A& t- @ - * kind, whether express or implied; without even the implied warranty" Y$ I2 s: `* H f# u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- y" W0 m, W8 F# W% J' p
- * GNU General Public License for more details.
4 O' q/ {" a6 n# c" Z( k - */
" l$ l% A. Y7 C0 l W8 P, m4 t2 I+ H - + E# ?! a, B, ~5 X
- #include <linux/module.h>
; b0 y, k# m/ q9 z" p9 v - #include <linux/init.h>
4 k4 m2 p- \* J. e: y) M8 g - #include <linux/errno.h>+ }7 y# |# {% ?
- #include <linux/types.h>
0 C2 Y9 `$ M- H0 D - #include <linux/interrupt.h>6 H5 c* X7 u* p2 P
- #include <asm/io.h>) F5 T6 b3 t- q( S% S x/ [+ R2 h
- #include <linux/moduleparam.h>
* o' x/ u7 z. O$ ?; o - #include <linux/sysctl.h>
8 p% |8 l2 F, b) | - #include <linux/mm.h>
1 S! f) t$ d% ]. R, G/ R& u - #include <linux/dma-mapping.h>
8 V5 ?& l0 u, v0 } - T4 `% n( v% I) v
- #include <mach/memory.h>" j& j( M+ R$ R8 Q. c+ C
- #include <mach/hardware.h>0 ]) d7 I$ K. k0 Z2 H
- #include <mach/irqs.h> M0 H3 w9 Y3 `* \; T
- #include <asm/hardware/edma.h>
6 {8 ]: N: d2 n( M - ! A% T5 Z1 L( x9 E, o8 ? u
- #undef EDMA3_DEBUG4 w0 x$ P5 v4 x! l* y7 S
- /*#define EDMA3_DEBUG*/: s0 w; A2 W- T% w1 c3 E
( i! c9 F$ |1 Z) a# ?' ^- #ifdef EDMA3_DEBUG ^/ C" G) d4 ?) M* ]$ ?* U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ h' {5 r/ W) f7 w- c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* E0 Z/ ?/ b! k! r9 M/ q% ^1 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- y& C1 h3 _6 N% o' D
- #else2 Q9 M5 }+ _- ?
- #define DMA_PRINTK( x... )- }, V) I# j7 l! I; B
- #define DMA_FN_IN
0 R1 _3 V) r M- n; T0 m4 g - #define DMA_FN_OUT
, d+ j1 e& {8 C( g" ~9 f) ~ - #endif3 J4 t1 Q( b0 Q
- & ^% s1 ^+ s3 {' x8 W0 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- M% w' l* v' ?! I1 l
- #define STATIC_SHIFT 3
6 _- N2 C+ K& ~ - #define TCINTEN_SHIFT 208 P7 F; w: x, _, |+ F! A5 Q
- #define ITCINTEN_SHIFT 21
1 f! P0 j2 G' B) h( g6 D* `1 W/ b - #define TCCHEN_SHIFT 22) y( ?: O1 @9 g0 Y6 ]
- #define ITCCHEN_SHIFT 23# \, B" {3 ? w3 {
, K$ [9 \8 j3 @9 v1 Y( I' m5 r; i- static volatile int irqraised1 = 0;" k% g1 q) _4 E4 k, U6 {
- static volatile int irqraised2 = 0;6 k# a& ?' L5 M- L
8 o2 |# W3 p5 i' {2 v2 {! @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ u1 ^" I; f: G: i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ~- C1 d* R7 u7 F$ Q, p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 i; f& l5 ?! N" K& p - ! V. ^7 u3 A& g5 H# s
- dma_addr_t dmaphyssrc1 = 0;8 ?, ?( K+ K" S) G8 w: m" { G
- dma_addr_t dmaphyssrc2 = 0;
& k( ^3 o/ s9 N$ V7 ^ - dma_addr_t dmaphysdest1 = 0;& A a1 d- u5 N# d: l5 N
- dma_addr_t dmaphysdest2 = 0;
$ V% x) e, ?, S/ D4 ~ - - a; d/ A8 c- O9 E! S
- char *dmabufsrc1 = NULL;) Q& t+ q2 j9 W$ E3 [
- char *dmabufsrc2 = NULL;! s! c+ U: _0 O0 F9 M1 ~
- char *dmabufdest1 = NULL;
: o l$ f+ f+ h/ O, s& i - char *dmabufdest2 = NULL;" i' B' l/ G. B. b* T2 z
- ; D V6 O) K' M% {4 W8 ]% j8 o
- static int acnt = 512;& `2 a3 a* N) k
- static int bcnt = 8;
2 f1 L# f; o7 N% y9 e. c! K3 i4 ? - static int ccnt = 8;) E( [+ s" G, Y3 C( v
- ( t; [2 ^' k. U- E& B* { l
- module_param(acnt, int, S_IRUGO);
% D. p) y" ^. Z5 K5 K, q - module_param(bcnt, int, S_IRUGO);
9 k0 W7 [, C @8 j' y - module_param(ccnt, int, S_IRUGO);
复制代码
/ d4 Z3 t+ k4 V! V7 u" }5 Q
$ G8 P! T7 P J7 B( z0 U5 P! u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 G0 I# _- K/ J- E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 ]5 D: j- ~" I% f! e+ n+ r* v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ^' s5 e" u' F$ B( z" F
8 R; V# N% ^' u2 F8 m ?2 f# U+ \, P5 j" \
|
|