|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! ^1 E6 U s. D4 D* J; I- [code]EDMA sample test application9 ?6 [7 h. J" i0 J* D( ^
- /*
' \, s6 |1 }# \# T0 u- e - * edma_test.c! i: G v/ Y1 y2 o7 A
- *: W1 g* `+ w& b) z3 K
- * brief EDMA3 Test Application
$ f" F! X' F: i: f7 h - *
6 c( H" e% S" |2 X - * This file contains EDMA3 Test code.
2 q9 H5 z* X* L' e& v J9 g - *0 [( m% w0 ]+ Y. K0 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( ~3 U: `) B; Z2 ?) x" q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& o* L) X' @0 U - * TO CHANGE.
+ |" |/ C3 {: H* M$ q# [ - *
/ [5 t, x$ Z# x: [4 o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* M% @' X. k, V i( S: a S+ P2 S% n2 y - * s& k$ y3 h$ Z
- * This program is free software; you can redistribute it and/or& }! \4 t5 w1 L# \
- * modify it under the terms of the GNU General Public License as
% l. a7 W8 ]# V% Q( ?! D) Q: {$ Q - * published by the Free Software Foundation version 2.
- S4 J4 e( e) i0 {# { - *5 N: ^- d+ a B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 U8 C. l8 u! T% @1 _ - * kind, whether express or implied; without even the implied warranty) l3 ^* u0 Z4 y& k! J `4 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ V3 B: l( p% Z6 k" i1 x - * GNU General Public License for more details.
6 e9 P1 c" U0 ~ - */
3 L# ^) t" a) C; g4 h: m2 g" ]
. h& v: I' I7 s- ~- #include <linux/module.h>
; t8 L. r; e3 x$ d2 }; h. m - #include <linux/init.h>9 d, u6 n% G& I4 H
- #include <linux/errno.h>
. A- }; q% U/ G' y" k B - #include <linux/types.h>
, d& _0 R% W, ` - #include <linux/interrupt.h>7 i! q5 A' {! ?0 d9 R8 F
- #include <asm/io.h>$ y- E1 E/ H; _9 g" L5 O
- #include <linux/moduleparam.h>" x6 d) i& a9 }
- #include <linux/sysctl.h>
+ @& q4 h0 {3 n - #include <linux/mm.h>
! D- j2 K! ?: K - #include <linux/dma-mapping.h>
* f- t1 X8 `. r4 A0 }
6 X1 I" b& r; V- #include <mach/memory.h>
3 G. C4 \3 e/ O2 W. Z/ }1 E$ i, Y - #include <mach/hardware.h>
) `3 X& y6 K6 u - #include <mach/irqs.h>
9 d8 {# e. p. C; t- Y, }& Z2 {, \ - #include <asm/hardware/edma.h>
/ j6 _' n! ~4 [" l2 S5 F1 l
$ [' w- |9 }( Y8 q w- #undef EDMA3_DEBUG
* B$ |7 X, Z$ o$ G - /*#define EDMA3_DEBUG*/9 h, _; M9 s6 W9 T2 k* m) ~* }
6 ]6 \; p+ x1 X# }- #ifdef EDMA3_DEBUG( |6 ?' `% K- @! ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 s% ]& n. l# X# ^( u+ Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 a! e( V7 Z/ A$ z% T% }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' \) G4 M7 X: P/ f
- #else! K6 D& M* \4 q$ w2 O& u
- #define DMA_PRINTK( x... )
# k8 z: \3 ?$ j. C& ^ - #define DMA_FN_IN0 j" M3 P9 \/ _ e8 @: L
- #define DMA_FN_OUT; g. c1 y7 y8 ]. [: D) Y/ q Q
- #endif( F6 ~: R2 J% K' E
- 4 k- T( @ S0 X3 r M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 |$ P A' x, \- [ - #define STATIC_SHIFT 3
$ B/ `2 \5 C' b! u) T - #define TCINTEN_SHIFT 20
6 p) }8 H+ E3 [- l! n0 }4 O - #define ITCINTEN_SHIFT 21
t' D9 a' t( S5 T9 X, @# L - #define TCCHEN_SHIFT 22
: e3 k; U5 q' z. V - #define ITCCHEN_SHIFT 23
- _6 s7 B& q+ ] \' |+ H: F# O0 V) S) b - 1 \* K9 k# {; I7 e+ @% L* ^
- static volatile int irqraised1 = 0;0 L. m$ p1 [ c- X& g
- static volatile int irqraised2 = 0;( K, i( Y, Z& j [# z8 D7 I+ q
- 5 }4 p2 D) B1 R' V- V; ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' t( \$ G) u' o4 l8 h! V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 q9 x) Q6 o5 W& o5 p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 x5 ]0 A+ n0 y7 p3 O) c' l
/ M4 E6 O3 |) {9 T& o# f* t- dma_addr_t dmaphyssrc1 = 0;5 _" w8 _% ]" O
- dma_addr_t dmaphyssrc2 = 0;
9 c4 M2 A( F3 B- O" p - dma_addr_t dmaphysdest1 = 0;
0 J. z/ r1 r, E7 C - dma_addr_t dmaphysdest2 = 0;
% _! U7 |) Z( n& J) q7 C) H4 i
9 _: q/ f3 _& v) e- char *dmabufsrc1 = NULL;
( z3 j6 V) b/ G9 E0 P7 r$ [5 \% \ - char *dmabufsrc2 = NULL;0 Q4 y3 x5 q& u6 l+ }: ^
- char *dmabufdest1 = NULL;7 w% B2 O$ q+ e. C. v- c3 {
- char *dmabufdest2 = NULL;! s& E3 p6 n6 \+ P2 F% s
- / h& }$ H& I6 |
- static int acnt = 512;9 Z) }6 F8 h; ?. N
- static int bcnt = 8;
3 q2 y0 F2 `# o! b) P+ z - static int ccnt = 8;
/ F2 f a; C1 d6 l: W, a
* J% ?8 B; [+ J( n- module_param(acnt, int, S_IRUGO);* B- _5 [+ l0 u
- module_param(bcnt, int, S_IRUGO);2 ]( j* }, v% H/ B6 f
- module_param(ccnt, int, S_IRUGO);
复制代码
0 L; O G- ^0 ?2 S U. f, N
, `" ~; |8 H0 h& d# _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 q9 |: Z0 T; \2 t8 D+ p9 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& y$ Q; P" q% }/ ~& ~0 m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, a) J i9 o; c2 ^) b6 t9 w- _( y" I" m2 h: ?
- M+ |$ D: F; D
|
|