|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! i. s/ @; \' u) G- [code]EDMA sample test application
0 l6 o. ^0 M5 d6 d! N - /*
8 y1 W7 q, i1 j0 Z, l) q) \ - * edma_test.c3 d0 e- R5 O7 R
- *, a" [* O: x( m) V. L+ V
- * brief EDMA3 Test Application
: u% m5 {3 ~& K- K - *2 r( H, O) H5 Z! d1 e- d+ h
- * This file contains EDMA3 Test code.7 I9 X; R" W1 M6 R: k: }& y
- *; ^; N, e/ y' r9 s, A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- p0 M$ q- T- D z5 W( w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 b6 {, \2 T+ M& Q1 `6 Y
- * TO CHANGE.
* r% ?3 J' p. V8 a g - *6 H- E4 n+ q" ^8 T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ j! Z* t4 i1 n- \; A$ Z6 j
- *
0 ^( [* W$ V# W* m% C5 k5 K' K - * This program is free software; you can redistribute it and/or- j5 i4 h0 @0 h v' ?6 r" s9 e
- * modify it under the terms of the GNU General Public License as, b) i g; B' H" M9 c. ^
- * published by the Free Software Foundation version 2.
$ z3 y' O( t2 q9 |2 y - *
7 s9 \# \3 w4 d' N | M- d8 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" Z5 ^- z7 {9 b" Z( y$ P9 l, P2 n
- * kind, whether express or implied; without even the implied warranty3 ~8 ]+ i6 L( ]3 [7 F( Q/ l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 f) v. P% h! \6 z6 B n
- * GNU General Public License for more details.
$ B, _, O8 L. E) D& _( Y - */
5 }1 m- Q& ]) H8 P% l2 R: U
4 v. J2 d& d! `; n- #include <linux/module.h> G' n- s. U% X% L
- #include <linux/init.h>1 [% R) u% @7 h% Z
- #include <linux/errno.h>( w1 I, X8 o: A/ a% n p% k
- #include <linux/types.h>+ m0 O) ^9 t h
- #include <linux/interrupt.h>2 J6 N1 X) A. W; p/ C
- #include <asm/io.h>! {# m/ Q0 }4 u5 K# s3 L C; f
- #include <linux/moduleparam.h>
2 _1 ?5 `% K1 ?8 @' s - #include <linux/sysctl.h>
! \: ]* b1 x" @* z* f - #include <linux/mm.h>
5 C. n7 ^ H( \" f - #include <linux/dma-mapping.h>
: a/ a9 K# a. `7 J2 {) _2 l - _ d' | N: h, x5 l \
- #include <mach/memory.h>% h# J" l+ M& U
- #include <mach/hardware.h>$ E; w3 |0 Q' z' `# U& ^: f
- #include <mach/irqs.h>
- Q( U* e0 N1 q7 k. u5 @% Q N - #include <asm/hardware/edma.h>
5 V; V5 Q6 [6 c5 S: Y/ h% g3 } ]4 e - 8 T# T9 X# f3 F+ b
- #undef EDMA3_DEBUG
) L" X+ X7 E! ]5 A8 y - /*#define EDMA3_DEBUG*/& d6 K, ] n/ f* \$ H
# i1 e8 j5 R4 U$ ?- #ifdef EDMA3_DEBUG/ D6 L4 g) d% }8 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 x) U5 V4 P/ k2 I, N. b8 n. F$ A6 [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ^+ Z& E i, d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" p/ B+ |# G% D- X' j- ~1 A$ Q - #else3 g8 [: ?% x( F0 R% k
- #define DMA_PRINTK( x... )
1 O; Q0 d: c. O# c1 E - #define DMA_FN_IN
6 v9 u0 L f; ]$ S, `0 |( R4 E - #define DMA_FN_OUT
9 E% Z: I! U- X2 i1 i0 j - #endif
% Y4 e' m8 c# u$ f. |2 S1 q - " t% g5 H7 X+ O6 A% X0 k6 e3 z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 x; s) p) O3 m# v, A, r - #define STATIC_SHIFT 3( c5 h0 B8 U9 l( b; }
- #define TCINTEN_SHIFT 20! \$ Z& L& ^4 C& }/ U( W- C
- #define ITCINTEN_SHIFT 21
/ D/ M' m6 N: w, d! A5 Y9 K1 ?. A - #define TCCHEN_SHIFT 22
/ p5 o- d6 l2 g1 o0 ]- m4 _ - #define ITCCHEN_SHIFT 23( z9 h' N& z8 V! F# ]
8 X i9 |9 p8 b4 T, l' U- static volatile int irqraised1 = 0;
1 [' j% J& @0 t8 V( e' e" R; ` - static volatile int irqraised2 = 0;: M+ {8 }7 z3 a1 R# N- V
- ( x5 f1 g/ N/ t0 A P% Q( t# @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 E+ A) t8 _, ^( b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 f, Y5 R6 G( q6 h; `' N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 B' C* x# F3 {1 J5 n: H/ A - y' Q* Y* e% C4 T4 r
- dma_addr_t dmaphyssrc1 = 0;
9 p0 V3 T$ x6 \* P- q% @: q - dma_addr_t dmaphyssrc2 = 0;
H$ h& F( C/ f, S" E - dma_addr_t dmaphysdest1 = 0;
( s" r B u' ?+ _# _4 Y - dma_addr_t dmaphysdest2 = 0;
- b o' [' \, z* t+ d) }6 O$ { - 7 p4 G+ e& X5 v
- char *dmabufsrc1 = NULL;9 {% t1 G6 B; X1 N
- char *dmabufsrc2 = NULL;
2 L7 J9 f5 ?% A9 m3 v - char *dmabufdest1 = NULL;
" V8 |$ f4 N( V* ~+ m$ w' U - char *dmabufdest2 = NULL;; Q+ I1 W, c4 ~" H; z1 V
- 2 C/ M d* A9 ?/ k+ B! ~0 p7 w
- static int acnt = 512;
( E4 M8 @0 [& I - static int bcnt = 8; X9 I1 h L; R/ V5 P3 G: I: \7 i
- static int ccnt = 8;# C" R0 ]8 {, O, Q6 @, ^0 G2 H8 Y$ r/ G
/ V8 ?% Y9 D2 h3 ^' m" H0 }- module_param(acnt, int, S_IRUGO);
3 @7 C) T9 g: H7 r5 L0 g$ E% U - module_param(bcnt, int, S_IRUGO);( {0 x) C4 t& c# o; E4 k/ Z, w2 B! ^
- module_param(ccnt, int, S_IRUGO);
复制代码
Z Q6 C) ^" C9 L% e8 J/ J& u2 X( z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& f2 j% @) j# N6 r) b4 N/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ S: {6 h8 v9 ^& P6 l Y } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ L7 @: ?* O, t2 j9 x! I6 q% A! f$ y" s* J
2 L7 G! A: D% M/ R# y9 d! x; o& U5 {: v+ k. J5 k
|
|