|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) U6 V% V! \* W6 V! ?3 i' R5 |
- [code]EDMA sample test application1 J; }' ~# s4 a) x
- /*
. Z }+ K1 r& _1 c+ e L" j A - * edma_test.c" T# y' ?1 S: P) w3 U- P
- *
3 h i0 k% {" q: Y, L h1 ]) C - * brief EDMA3 Test Application
. p J$ \! w- b! C2 ^+ \ - *
. C1 ~7 [7 {1 T+ c3 p% C+ k - * This file contains EDMA3 Test code.
. A3 V( z7 {7 G - *: q% U( M5 X8 u9 N$ F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ L+ s, \3 S w- P& N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 s# f5 y0 E, [8 x - * TO CHANGE.
1 n0 \2 p, p, n, a7 d6 x5 K1 @& X' ~ - *
- H9 S; r8 P& z, U8 W& a6 z5 K9 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' A1 }5 |0 R! g8 @# v. Z a5 X
- */ Y7 B& t8 w0 T& p5 \
- * This program is free software; you can redistribute it and/or5 | r7 f. q% h5 d- m9 R
- * modify it under the terms of the GNU General Public License as
6 s, |% o' q* a% Z. m2 Z - * published by the Free Software Foundation version 2.8 J* [3 [& ]7 p& k6 J
- *& V r! F8 I/ a. X, m& ^4 H# Z9 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% l3 d8 ~0 l1 L: Z* u - * kind, whether express or implied; without even the implied warranty
, d3 {4 _. [8 z# E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) ], V; l, N$ [2 \9 C
- * GNU General Public License for more details.5 h( U8 E8 Z2 z3 Q- E0 @; f8 @
- */
' S& o5 d, f. j" {; i* f, ~
, `- l) o2 f( {3 C- #include <linux/module.h>: g/ S7 G- K' h; t7 N
- #include <linux/init.h>6 \/ u/ C( h9 C
- #include <linux/errno.h>
6 R1 t6 M7 r- }+ m7 |* N - #include <linux/types.h>
: I9 `& {; E! ~+ G - #include <linux/interrupt.h>3 V: _2 J! J" \- ~
- #include <asm/io.h>
# }4 y* o: F. j, Z1 m - #include <linux/moduleparam.h>% r7 J" F/ P& y6 P2 Z
- #include <linux/sysctl.h>
: |6 a, G/ u8 Q- H - #include <linux/mm.h>; I- d9 t! ]" ?" u' n X( x
- #include <linux/dma-mapping.h>7 B0 M* g e! Q" c) d
8 j5 T: [8 Y7 m& X% m* y: K, y( r8 z. y- #include <mach/memory.h>
" w- [/ j8 B) L' P4 ?' u1 R - #include <mach/hardware.h>
" `# W8 J$ C1 u, T) m - #include <mach/irqs.h>* A% A$ f, M. m$ O7 I( I
- #include <asm/hardware/edma.h>
0 e7 v8 c9 l5 P4 |
4 h* B% t. e8 `- #undef EDMA3_DEBUG
( a& {& ~4 d+ L# T" c - /*#define EDMA3_DEBUG*/
3 f" [& E. M, X* R0 g c
: ~8 n" K: i2 b( M7 i. t- P2 y- #ifdef EDMA3_DEBUG) g# p n/ q+ O& ~6 d: D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% N& Q2 y/ h* P/ ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 O& `, q" _7 C: e+ E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 q( X/ m9 Z/ F; c
- #else
8 m8 O+ B9 G/ X2 n8 J6 {6 S; ^ - #define DMA_PRINTK( x... ): q$ W5 X9 n/ \. o4 N; a; F8 j
- #define DMA_FN_IN8 o/ W9 r4 c5 n; z) K
- #define DMA_FN_OUT
4 [8 J/ u4 {. q! M+ E( f* ^ - #endif' Q( Z& u* e) \# Y3 j9 Q# ?8 n
- , `. e2 ]$ B- ^: c, N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) e7 G1 D% M8 [% U+ p* ` - #define STATIC_SHIFT 36 b% J1 N; y# D0 C
- #define TCINTEN_SHIFT 20
. F8 W$ U. h: V/ }8 i8 z" h- X; ]6 Z - #define ITCINTEN_SHIFT 21! K) o" Y7 s( Z
- #define TCCHEN_SHIFT 22. ]9 _6 c' X: {* l S! p+ w1 k/ h
- #define ITCCHEN_SHIFT 23
3 U% ]0 Y e( N/ o) K, t' q
* s. W! p1 Z/ @% Q" }: }- static volatile int irqraised1 = 0;
( e) b7 V# l6 h! V. H& a! J2 Q: w7 W - static volatile int irqraised2 = 0;& s2 M& q) ]) n U7 j4 j
- ) s% f+ l1 X. }( O0 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. B% @- @8 A7 i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: T8 n9 u& j+ Q% m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) j, k7 W" D0 Q! N
~8 O' ?7 T9 w" E. r* G6 D- dma_addr_t dmaphyssrc1 = 0;3 I/ S$ }+ h* B
- dma_addr_t dmaphyssrc2 = 0;% e2 J- d2 I2 Q( Q1 N
- dma_addr_t dmaphysdest1 = 0;3 ^/ A; f. n2 ^' o2 h1 t
- dma_addr_t dmaphysdest2 = 0;
7 s9 @( n$ ?7 _$ V: w6 [4 k. S
& j, n! `3 M8 F- char *dmabufsrc1 = NULL;2 o* Y6 N' L/ p. K
- char *dmabufsrc2 = NULL;- ?9 e& [3 E/ k8 w+ d2 l7 c
- char *dmabufdest1 = NULL;
# ]9 X I& `7 w q6 q3 ~/ z - char *dmabufdest2 = NULL;
2 n3 {; p/ y) M; J/ I4 l$ m" \: c
8 p5 J1 Y# G! m; d9 @* D7 ^) F2 b- static int acnt = 512;
\! t) t5 G% e% p - static int bcnt = 8;
6 a$ T; [* U _5 R5 G' Q( X - static int ccnt = 8;1 X. e! X5 \) z3 n7 x
4 n# }; d- C% p4 d9 h2 @) D- module_param(acnt, int, S_IRUGO);
8 d( D5 k; H& d4 v1 q - module_param(bcnt, int, S_IRUGO);
) x% s: E1 c. Z: ^9 Z# c - module_param(ccnt, int, S_IRUGO);
复制代码
% {. D2 m$ U8 C6 ^) [+ D1 b' a' ]$ P4 B8 i3 I& h. b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, [4 K2 o+ F( ~1 S: \' e9 K1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 Z& ], Q+ y+ \% u: v: a- o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 {# p/ @6 [& ]/ J1 P# z g
* x# u- h* g! |# y- d8 F# ?9 }0 ~3 H& m, f/ S: f. i6 T
|
|