|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ q( k" [- F/ ~0 P/ N v. G. Z+ O- [code]EDMA sample test application
( C2 E; Z8 l. Y/ p) ` - /*0 w6 h6 T" L0 H
- * edma_test.c
0 u) i& }4 z& z- G- v# _) W2 X - *
* @- V9 p! A" D3 T, c! U- } - * brief EDMA3 Test Application" n8 J$ o$ \' i. e# l3 T) r
- *' R% l; x z" h! R
- * This file contains EDMA3 Test code.+ H, u: B3 Y! Z4 ]) v7 z* c
- *6 R9 o% w* z) }- u8 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ n8 U: ?5 A9 |- h! l% T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' D$ L9 I; H5 ^; F! j3 ], ?7 s3 x& q
- * TO CHANGE.
$ r6 i: H7 U0 j2 y - *+ q& N0 z' }$ o7 D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 l6 @; _$ Q/ i X/ b; ]/ b - *
. ?) g% }. e/ r9 x - * This program is free software; you can redistribute it and/or% X: G, p5 H) y
- * modify it under the terms of the GNU General Public License as) b2 Z+ ]' C6 V- s6 [( k/ o2 ?9 p
- * published by the Free Software Foundation version 2.
! ]6 y8 u. d: K, H- q, ~& S - *
1 d& D( M$ E0 p" m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; X8 _! x+ f% j k
- * kind, whether express or implied; without even the implied warranty
& t9 [2 w- |2 J7 }0 E, R" J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 O; T: j7 d& g8 a" s! q - * GNU General Public License for more details.: u* R! q2 L* f
- */
9 r' f, }' b) r0 I; C, S
+ B- Z# I/ H4 E; l: I" r- #include <linux/module.h>5 S1 _) }) o: B
- #include <linux/init.h>$ J- E. _7 A& n$ k4 c; X: r
- #include <linux/errno.h>: g S8 d8 u( T* t4 `# D( }/ H
- #include <linux/types.h>4 t% I f' x1 G
- #include <linux/interrupt.h>; q+ ?; W, E% O, D- \
- #include <asm/io.h>
8 M4 v! t3 o$ q% f' I5 Y3 A0 b - #include <linux/moduleparam.h>
6 _, [/ i. N: K' f, G - #include <linux/sysctl.h>
. ? l' R9 @8 B. F+ K - #include <linux/mm.h>
( i8 o6 L5 j* @1 v* H$ g7 J - #include <linux/dma-mapping.h>
z% T9 r) r8 Q# g0 d - . [* a# B; g/ b: E
- #include <mach/memory.h>
! H5 H! D% g$ K: i - #include <mach/hardware.h>
9 K, G z# N1 H" r - #include <mach/irqs.h>
0 V! f/ k' m5 J0 l" O# Y( L4 @ - #include <asm/hardware/edma.h>
$ r0 C: d9 }, M( z6 w - 7 j* r4 f2 n& Z; h
- #undef EDMA3_DEBUG0 j! o4 J0 o" R/ s2 P! V% O; x2 P3 n
- /*#define EDMA3_DEBUG*/
" k/ ^& h6 E9 } t
+ M# {) y( [$ n2 x/ O- #ifdef EDMA3_DEBUG
8 D* o; K( p1 f9 T- Y7 c+ V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ _4 s: m$ _& E) a/ X8 x. V, q1 x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 E! _/ G/ I, t# f% V k8 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' Y- u+ q; j; c9 M. v- q - #else
, I9 m/ G9 T* y$ \( r' k U - #define DMA_PRINTK( x... )
" J# x7 h; g& Z' F- l - #define DMA_FN_IN" j- t6 X+ |' e) R5 m7 w5 n5 h8 I8 M
- #define DMA_FN_OUT7 x+ D) J& ]) @" m5 {9 e2 d, b0 x3 G
- #endif
" j% h8 Z, C8 p5 } z - 8 A. n) M- l5 z4 q+ F* A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 `8 J2 x) g8 F
- #define STATIC_SHIFT 38 `2 X y/ q5 ^! m( R2 I* N
- #define TCINTEN_SHIFT 204 C$ ^/ A0 n) m9 v5 T8 B
- #define ITCINTEN_SHIFT 21+ u1 A# ]7 Z9 W* Q( _
- #define TCCHEN_SHIFT 224 u$ h# k0 k. u9 n) J/ @% H' M
- #define ITCCHEN_SHIFT 23
0 u) a& b' p! o C& R+ W* O
5 M8 E+ N8 p6 ^ g) D+ F! Z- static volatile int irqraised1 = 0;
1 f8 o5 e+ E; x - static volatile int irqraised2 = 0;( O$ _% r2 s* m' j( k p, T& p
% F& l! K1 K7 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* A* c6 h3 ^# U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' {& G& T. H/ E$ \- l. h) K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- S& E" c& z- E* d - 4 D5 n% P; N. C/ |+ h& @6 t/ P
- dma_addr_t dmaphyssrc1 = 0;( W6 q c% i) X+ i# s
- dma_addr_t dmaphyssrc2 = 0;
7 W7 c( v0 M; x+ |& p: ~0 g; I - dma_addr_t dmaphysdest1 = 0;- G% ~1 Y/ [% ~% r: @/ m
- dma_addr_t dmaphysdest2 = 0;5 O- A# q. J! S. b8 U% R
- T/ C; Y1 e# r% {, f8 W
- char *dmabufsrc1 = NULL;4 L& D! \0 }. w% s- [) b: d
- char *dmabufsrc2 = NULL;
, v4 M' y; t$ i! w; e5 e - char *dmabufdest1 = NULL; P p' F+ f1 Q8 K7 p
- char *dmabufdest2 = NULL;
8 q: e N8 V( B7 [4 E" @8 I% q - 4 `' v3 D+ M" l, P! ^! @7 Q. d
- static int acnt = 512;
H( n2 ^& {- |; { - static int bcnt = 8;; u9 w- _) h& O+ O V: o5 M
- static int ccnt = 8;
8 _* Y2 i: L) B" G1 E - 8 J/ C( X( c _ t& R, |2 G% ?' ?
- module_param(acnt, int, S_IRUGO);
, |/ D/ Z9 |7 ` - module_param(bcnt, int, S_IRUGO);# `7 s3 z6 a. S9 U
- module_param(ccnt, int, S_IRUGO);
复制代码
+ W( O: a' p& E, b4 b& f: f' p& w! o5 @- ~0 m* ]2 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. Z8 y4 [, e" |! m0 `* k5 p# X, u+ w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ @9 U' ]# C& V1 H) O3 y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! M# P3 D8 D7 y4 t
8 w, S! w a: k2 f$ ]6 X) _* W+ H+ [( [5 `4 |
|
|