|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, W% @$ P, @4 _7 u- [code]EDMA sample test application2 o1 Q l0 _2 j% { \- ~/ V: a
- /*
9 v; x- B& A2 \ - * edma_test.c s# r- w4 Q* m
- *
. @, Y6 H4 \- B1 ` - * brief EDMA3 Test Application
, _' l. `3 \% y6 }8 R- O F; C. v4 I - *
X1 {7 z: e" f- x2 a" k' u1 { - * This file contains EDMA3 Test code.
) G6 |: ?& }4 {1 L) f) d3 J - *- \9 p+ U# A5 a& W# Y% x2 E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( m! I% Q; x, v' a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& M) @1 q1 @* e - * TO CHANGE.
# |3 }$ F0 b0 u0 k" U3 Y9 [# R - *
. {$ U+ i" ]0 B4 r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 I/ Q/ G" F X2 u& v - *% {( j$ H: _/ `- _; a7 \' ]
- * This program is free software; you can redistribute it and/or
| W' M* I" U - * modify it under the terms of the GNU General Public License as+ T& A& }( n7 M' G' U4 W& B
- * published by the Free Software Foundation version 2.
+ a7 P: m( g0 x9 Y- f f - *
7 O5 i/ ]$ L4 D! \& M; N1 ~ Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 s2 M \0 ], U l
- * kind, whether express or implied; without even the implied warranty
3 S4 q |2 B1 N( P. b! @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! n# l& Z; H) b; W* O! G! c' J& y
- * GNU General Public License for more details.
# [8 R; |0 H2 f% a - */
0 g; H. L2 M6 G+ n; e* a, }, t- W - 0 \* F V! J( I# a3 _$ \
- #include <linux/module.h>+ p* T6 u& O- C2 K
- #include <linux/init.h>! L$ \' v! G s6 V6 V" R
- #include <linux/errno.h>
4 c! y, B+ @" {4 ~2 E8 F - #include <linux/types.h>1 e$ b8 O# \: ^3 B; W' W% v
- #include <linux/interrupt.h>& ]6 T; U J) \* K
- #include <asm/io.h> e. \& P( d- c* q" d! U7 \
- #include <linux/moduleparam.h>2 L( [; \/ p( W7 n: `' K8 L. L
- #include <linux/sysctl.h>9 q8 ~7 }/ Z4 }$ E. |* V+ r/ k! x
- #include <linux/mm.h> J5 @( f6 A3 Y0 P+ ?
- #include <linux/dma-mapping.h> S y1 {! ?2 j: Q
+ e2 E* Z$ E4 k6 M& [) ?2 _1 J- #include <mach/memory.h>
/ n$ u9 x( x5 ?+ P4 E - #include <mach/hardware.h>
: F9 v/ }0 H' E0 ^& Z# [6 W/ p - #include <mach/irqs.h>- H* l4 b3 P3 P6 e- ?" P
- #include <asm/hardware/edma.h>4 D% R" h d q. e, ~/ p6 j
- - g8 M& P/ [2 P9 j4 K H% s6 z
- #undef EDMA3_DEBUG
7 }8 Z, M& u6 _3 X; O w( p - /*#define EDMA3_DEBUG*/
) P% p3 m s3 C- a6 _ E$ X( \& W - 8 ^" }" z( I7 _5 S9 k
- #ifdef EDMA3_DEBUG* S1 ^( {% ?0 T1 Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! @* B& Y6 J) I9 v5 g. R g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 W% v( F* n( W$ L5 e2 D* I9 a3 Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
D( t+ t6 X8 C d$ G( Y - #else* z- y( E7 r) }$ v. x4 N
- #define DMA_PRINTK( x... )
& l# O6 s! q0 e [; ]) T - #define DMA_FN_IN
N1 P1 t0 I' [$ J6 g - #define DMA_FN_OUT
/ R# F0 b7 @' { - #endif; o- h4 U7 S2 v" \8 {& s
$ ~9 W' j* b( H& \: ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 K- K( M, Y8 y. x6 F8 y( l+ w - #define STATIC_SHIFT 3
% ]$ x6 k2 W, d+ e - #define TCINTEN_SHIFT 20# e0 W' w8 Q$ s
- #define ITCINTEN_SHIFT 217 U$ |# X' P) C" i. Z: R
- #define TCCHEN_SHIFT 22$ T0 O8 `2 \& Z! o+ x! V
- #define ITCCHEN_SHIFT 23
) M* `& D: {- j. ]# q7 W4 j% K - % k& Q: ^5 D1 Q" R( `/ J! o' g5 H
- static volatile int irqraised1 = 0;
! P* P6 I/ O- a - static volatile int irqraised2 = 0;! c5 c' G8 ^( N0 p- N
- ' _: O6 l4 t! g1 X' ^1 X, x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* G. O: j, s6 r3 k6 }, g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- d% u, d3 U0 t: R# D C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% `& d0 n! G( n) } - 5 p: g% D" B# N$ t2 f5 f
- dma_addr_t dmaphyssrc1 = 0;
0 u5 \8 g1 g" b - dma_addr_t dmaphyssrc2 = 0;3 t! V& X% i9 T- n# V" V5 j
- dma_addr_t dmaphysdest1 = 0;
% h2 @, I* Q7 ] N% x4 j. k$ ` - dma_addr_t dmaphysdest2 = 0;6 L1 W1 p U( m* s6 K1 g9 x! s# h' s
- - \5 s6 R: I6 B6 B/ p9 @
- char *dmabufsrc1 = NULL;
. ~' ]( ?* z" n) \8 H - char *dmabufsrc2 = NULL;
' \: z, _+ i, F - char *dmabufdest1 = NULL;6 ~4 m4 d* J8 y- D4 B
- char *dmabufdest2 = NULL;+ Z( O3 u% `9 D4 k- a$ j
- / |" m) s p2 H4 W7 Q# } @
- static int acnt = 512;
3 t4 o% g- m8 X* _- J/ O% E - static int bcnt = 8;! o* G) V) D, r) g1 |, @: S
- static int ccnt = 8;
3 O5 f3 s1 q, y+ o0 r' J - " H8 c( p$ c' u( s" w
- module_param(acnt, int, S_IRUGO);
) ?% ~3 }1 z4 q% @ - module_param(bcnt, int, S_IRUGO);2 m+ z7 M1 R4 E# d' ` ^; U) |
- module_param(ccnt, int, S_IRUGO);
复制代码 , N4 K& E. b1 v* x" N) g
7 z% i( ?2 }% ]- J4 d k; T: m# q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 E" h' q. }6 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 }0 h! s. p' b6 p; K5 e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 G- e2 k6 l7 Z' j, [8 h
5 X$ c: f; |! u9 ^, o. k, ?# u5 i* F+ Q4 V
|
|