|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# S5 ]! i z+ n- Z0 ]5 e: ]- [code]EDMA sample test application
+ ?" }8 G+ m0 s J9 ? - /*
, A# ]6 Q+ r+ d - * edma_test.c
7 ]' A4 o# W0 v, Y9 e$ h - *
4 U% u& E' R, S! ~ - * brief EDMA3 Test Application
+ `8 h. p, I; \' B! h8 k" Q& I6 {5 x - *1 y% X# o O7 ^2 X$ X$ A
- * This file contains EDMA3 Test code.7 d7 D2 o# K: J2 w8 V
- *
+ Y8 K# R) L& y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' i5 z0 w3 y/ d3 \, a/ ], F7 q3 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* n3 I. Q* D' p8 } - * TO CHANGE.
4 C! S* Y; U2 x1 G - *
0 Z$ P9 Q/ V1 u- D6 r" y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, Y$ N) |! O9 g# T
- *, j0 G3 T' m# o6 T0 \
- * This program is free software; you can redistribute it and/or$ }- a. W$ O% n$ l5 H' I9 F$ a
- * modify it under the terms of the GNU General Public License as% h( i5 O" q1 T$ Z% Y' Q$ L
- * published by the Free Software Foundation version 2.: y4 j' r- |/ b q: P
- *
: V0 o2 T: k3 G; K! C+ B& p7 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 x/ f% W3 T7 s' u8 D& ^ - * kind, whether express or implied; without even the implied warranty
1 P M' l# s( C& f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 l: l, m3 F6 j$ g - * GNU General Public License for more details.
+ ]4 q4 R. a) x, d6 q( m. K - */& O7 S) X1 k" ?8 c* ~# \0 T
- ! S7 c1 v+ P4 e( o, B3 D( F/ d
- #include <linux/module.h>; n: K7 _3 V3 p0 g- i9 F
- #include <linux/init.h>2 N1 ^9 f6 @+ P$ I' X
- #include <linux/errno.h>$ R: H5 ?8 ^( S* B% D) s
- #include <linux/types.h>
, a6 L- f3 `" N! Y4 _ - #include <linux/interrupt.h>( \) s8 r$ [8 K/ Y
- #include <asm/io.h>3 i. g- H6 f! X
- #include <linux/moduleparam.h># X& h* Z2 H( [8 F8 K% q) K, D
- #include <linux/sysctl.h>; k" [6 z8 W0 g
- #include <linux/mm.h>
J9 j; e$ X5 q' P% n# h - #include <linux/dma-mapping.h>* M0 N; A! G2 x1 A
- 4 C9 R: O1 Y7 @ [. Z
- #include <mach/memory.h>
1 s' D, M7 {7 V3 v4 V - #include <mach/hardware.h>
* Z6 @, E8 {5 x' K; ^) K: A - #include <mach/irqs.h># n& o, o6 P+ ^# U
- #include <asm/hardware/edma.h>- Y3 Q' ~8 ]* Y& x' Q0 u8 `3 u
2 a. f) H' l; o7 g( Q- #undef EDMA3_DEBUG3 P: ^/ ?" F5 N+ J
- /*#define EDMA3_DEBUG*/0 @- {, a+ f5 P
7 s1 D% V1 C- q B: c; [& I0 _- #ifdef EDMA3_DEBUG
4 N; Q6 y A/ p2 e/ B7 `' p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- a$ n0 {( r- ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ i$ y; H" f% @7 d8 w1 I6 q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( O+ r% l# g U4 e- V9 u
- #else3 h& A b" r; \" C* Q
- #define DMA_PRINTK( x... )
% |$ D: h7 Q$ E( t2 H4 c. b6 K6 L' ~ - #define DMA_FN_IN0 [2 K. M: d8 M$ F3 c
- #define DMA_FN_OUT
1 G' P4 a5 Y, E - #endif
0 s4 w1 R/ }& K' p& o
1 Q" N' h" d( C, X' H Y; ?# m, o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ R- D7 \. Z0 f' `& o: x
- #define STATIC_SHIFT 39 z% y% Q" z) }4 y
- #define TCINTEN_SHIFT 20
0 s' r4 @% K* J% h- ~6 N/ {! n8 s - #define ITCINTEN_SHIFT 21
2 l' c2 w2 p: S* L0 D - #define TCCHEN_SHIFT 22# Z& D2 t/ Z& m$ n4 K- ]
- #define ITCCHEN_SHIFT 23. \ @4 \& M0 m% e3 ~& R; L
$ a$ G1 t! l0 g+ R- static volatile int irqraised1 = 0;
* x4 H4 }1 g- v' g0 n( j - static volatile int irqraised2 = 0;
, a' M, Q3 P0 P9 [$ O* B0 q k, {
/ K1 L6 S) h9 O1 u4 ]8 X# l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. V$ c0 A, o! g! z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, V# X6 w) E2 R& `) I1 {- I! O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 K2 K! F2 I, H1 a' B* a" N) C1 j* y - 4 [8 G2 l0 W6 _& O* @" O2 F! r
- dma_addr_t dmaphyssrc1 = 0;3 z5 ?8 i0 Q! T2 }4 l- @
- dma_addr_t dmaphyssrc2 = 0;
X1 \2 v* e# w - dma_addr_t dmaphysdest1 = 0;. C# ^2 ^0 W {& u4 k
- dma_addr_t dmaphysdest2 = 0;
, H, Y7 `/ g) b) i1 K7 Y - 7 q' C7 d: E$ X
- char *dmabufsrc1 = NULL;7 d: H1 Y; P0 R3 K0 @& P6 r1 H
- char *dmabufsrc2 = NULL;
2 G( S7 f$ E) P: R - char *dmabufdest1 = NULL;
# D. U: ^" Y8 [- y% Q/ `3 d - char *dmabufdest2 = NULL;7 C! h- X0 t9 L% o$ P
- $ j( l# x# Q1 l2 N. K1 \
- static int acnt = 512;: t2 w& J$ s. a; b; x1 J
- static int bcnt = 8;
% K6 ^( r! ]4 p# f2 M; [0 r; P - static int ccnt = 8;5 u# n$ z2 z7 m0 }( f- z4 Q( M. `
5 d. k8 ~6 Q$ l# E6 [- e) n! L- module_param(acnt, int, S_IRUGO);
2 L$ ~2 h7 K$ |7 z4 @3 k" Z - module_param(bcnt, int, S_IRUGO);
3 r! w2 _. }, b* t2 @4 ~% Q - module_param(ccnt, int, S_IRUGO);
复制代码
# q' F$ F7 t$ G- J) e3 Z3 C0 s2 u% X& P1 A6 _" L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 b, p. L) y9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 C& U" s) V1 v( r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 I4 p: G5 o8 {1 n S' l
& B4 b8 y' z; R, Y
% h+ D$ y! j* U0 v* X; Y
|
|