|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 l+ n& R, }# o( Y- [code]EDMA sample test application6 U( j& ~$ r7 X! M
- /*# A% J+ U* l% \: i. B
- * edma_test.c5 [* |4 g8 H$ X. |2 D1 i! l; o
- *
, M: m) I7 @2 @8 r& X: I1 ~& ` - * brief EDMA3 Test Application
: P% Z+ W7 |4 K6 ~, e0 e J - *
( N) t5 g) v9 |4 J - * This file contains EDMA3 Test code.1 A/ `5 k! i2 Z+ N8 t
- *
8 r t! d: S3 s" a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 M, l$ P* c$ z! `! N! M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 w* a& S$ {, v# \* L+ m
- * TO CHANGE.( k1 M" D2 Y1 \
- *) L$ Y: Y2 h' J# k9 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ l% k1 k& @ J6 b- o4 h$ f; U/ a' G
- *! Z; b$ U8 p# [
- * This program is free software; you can redistribute it and/or
, J4 p3 y+ ^$ @ - * modify it under the terms of the GNU General Public License as
( T7 w; j( t2 D& P' G2 b - * published by the Free Software Foundation version 2.
: n! A# o0 J8 Y# }3 y - *
) _ M; j& @5 D, G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ K7 e* u, H2 H# n! a6 J
- * kind, whether express or implied; without even the implied warranty! t+ r/ v' i; }( e4 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 L& D! l* i, n' @
- * GNU General Public License for more details.- l1 }9 v7 v2 h% Y
- */) f/ U; U( G9 m3 Q; \; j- Z
0 {( A! F* u! d' _& ]* U- #include <linux/module.h>5 q+ m$ h. g2 T- h/ i: ~
- #include <linux/init.h>
: I8 O9 ~9 i2 C1 T7 Y- B - #include <linux/errno.h>( @) {3 y: [! K6 G% d2 {4 l
- #include <linux/types.h>
. N- j+ Z# L6 b4 K" Y% |* ^ - #include <linux/interrupt.h>
3 v7 s# k& F! V$ ?$ I/ `2 ` - #include <asm/io.h>5 b* k0 h2 ^" L3 I
- #include <linux/moduleparam.h>7 b! M1 s- m% ?% N1 r5 X
- #include <linux/sysctl.h>* G5 m" ~5 F- m" m# ]/ q0 z
- #include <linux/mm.h>" u {# i$ i$ b, m
- #include <linux/dma-mapping.h>' a2 U2 C" y4 m6 u, x* t0 Q5 ]! R
3 z8 a+ y; v1 L( k4 _- {# e: n7 q: f- #include <mach/memory.h>
0 N) B4 b5 O- h9 }+ A h- i - #include <mach/hardware.h>
6 L9 j% c! Q9 @# Y - #include <mach/irqs.h>
x# e5 U# A* P+ b$ x - #include <asm/hardware/edma.h>
% E g, ~% h/ M! g4 h9 N! L: _
/ c! b' Y) L Y- #undef EDMA3_DEBUG
9 a5 O1 K8 m- P) {+ t& {& |( C - /*#define EDMA3_DEBUG*/2 T0 z; l" U$ \
- 2 F4 m5 \2 G M2 T
- #ifdef EDMA3_DEBUG4 r0 G0 ?( b! b* D' j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 B: p6 [) R& U) U: S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 g$ x- t. x0 G3 b- { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; |* Q/ G0 `5 N" i b6 I7 ] - #else8 {; Q. I3 N7 M v; B
- #define DMA_PRINTK( x... )
; ?# a5 D' f4 h/ r - #define DMA_FN_IN* ?' T/ T% g0 |8 n# _4 P
- #define DMA_FN_OUT$ z7 a% @$ [: x: A, v4 x
- #endif
5 K1 g1 R7 }7 ~3 I
1 j1 Q, h, O8 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& M+ t K* x3 x9 v! h, [ - #define STATIC_SHIFT 3
" b# y' ?! ~8 e" E3 W# h, z - #define TCINTEN_SHIFT 20
! ^9 g$ ?2 F4 N: I) \2 C4 y1 p - #define ITCINTEN_SHIFT 21
9 [2 \, O! l* @4 F( I2 H2 P* p2 c/ v - #define TCCHEN_SHIFT 224 A4 K+ y* N* F) k: m3 E. j
- #define ITCCHEN_SHIFT 23
' O4 F: G0 Y: R( h- |2 P8 W
. z+ n% K$ r. H- static volatile int irqraised1 = 0;
4 w4 l- v c& }; @ - static volatile int irqraised2 = 0;! Q. I w' ?$ R" Q' R; r, r
, K, o; _. y1 I% `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v, U# p& S/ M( J: k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 z7 Q' @8 U. N4 L0 H% b& Q2 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 E7 M, t. u% b3 L* _& X
D/ q0 W$ p5 T2 H* Y- dma_addr_t dmaphyssrc1 = 0;
3 N3 r0 x8 {8 I) ` - dma_addr_t dmaphyssrc2 = 0;3 ~ M9 T# | `4 o
- dma_addr_t dmaphysdest1 = 0;
: y0 r6 m* x1 D% w* K9 A* P - dma_addr_t dmaphysdest2 = 0;5 Z1 f* U* T8 E! X% m3 l) \0 Q7 G
- # B: |) O4 n2 c2 `0 [; R3 r
- char *dmabufsrc1 = NULL;, n# V9 V1 {* U4 v2 x* P3 z+ y: _. ^# U2 L3 l
- char *dmabufsrc2 = NULL;8 Y4 b/ d% U# f
- char *dmabufdest1 = NULL;8 m t/ N( N: g$ a
- char *dmabufdest2 = NULL;: X; @, B) u0 R4 a
- $ c" R# Z2 K0 W$ Y' ~$ r: d3 e, ~' J
- static int acnt = 512;6 Z2 ]9 B& b) n
- static int bcnt = 8;
! V/ {; {2 H, k" j; w& f - static int ccnt = 8;
) m: f7 _) Q# d - e/ E% D2 X: H. A! z
- module_param(acnt, int, S_IRUGO);
3 L% ~0 x% T8 k5 t- P2 q - module_param(bcnt, int, S_IRUGO);$ b! v& v$ y" L/ R* z ^% C
- module_param(ccnt, int, S_IRUGO);
复制代码 / D' K. |: x3 l7 `8 H" m- z
% a( _, H, y; _8 Y* ~3 n }) W" p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 K! [/ [ Q4 d2 D5 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- m3 } s6 O/ M6 O a' y( {, W# l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' ?6 J2 B7 m) G, o1 V
2 s% t1 q: ^( p/ ~+ f `
, V" e9 a" u5 E3 K) S2 L/ }7 }
|
|