|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( F* F; @4 p! D1 Q$ k* Q4 D, l- [code]EDMA sample test application
+ [/ L) i/ X. ?# r - /*
! p# Q) C/ }+ {' u% Z! [/ r" P - * edma_test.c: @6 A) o! K2 A# t
- *3 A/ e3 L$ j7 U+ c( }; R" H
- * brief EDMA3 Test Application
$ F% q- y* I( V - *7 V9 D8 O" W" w* ?1 x# B3 Y
- * This file contains EDMA3 Test code.) _3 T" Y! S% k4 x
- *. o1 [8 x+ T) a6 n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
n: A" y& o$ S; `& B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: }2 j2 R* c+ [' K6 h - * TO CHANGE.
" _7 y: p# z& |/ [$ q/ \: X - *- }$ C# f/ [" A+ s5 e( m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ A) j# Q; D* l1 M/ R- X - *1 p* v0 {/ n0 i5 L
- * This program is free software; you can redistribute it and/or# s) }2 [! h4 u0 ^: P. O- S* d
- * modify it under the terms of the GNU General Public License as
* \" S8 d* w% N; I+ G - * published by the Free Software Foundation version 2.
9 v7 l4 H9 i3 s' n% Q5 ~) q - *2 g0 J( F. y* d/ |6 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 D% R$ I( L3 j5 \# c0 x( i. I6 f( i+ D - * kind, whether express or implied; without even the implied warranty' H) o; _' f8 ^; \) R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 R8 i) J* Q# {2 p/ M: b6 s9 }
- * GNU General Public License for more details.
r# \4 ^1 o7 O$ [" b6 B# b+ a - */" [' t+ c$ M* V: @! `
- - `" f& p# h: r& _
- #include <linux/module.h>- d/ @ u- Z3 f4 `! P1 E
- #include <linux/init.h>
3 n! P5 @$ ?( I+ @ - #include <linux/errno.h>
( J5 w) @. @5 A - #include <linux/types.h>
% {* v/ [. M$ t' \" _ - #include <linux/interrupt.h>7 A. U" o. t6 j* @ l
- #include <asm/io.h>( B' R' ]* [6 P4 v3 o# X
- #include <linux/moduleparam.h> E! P0 t0 k* _) i8 S
- #include <linux/sysctl.h>
2 B# ~) J5 U. g, P# f, v9 W - #include <linux/mm.h>
- x0 ]- U+ `: J9 k1 J& E+ E6 I - #include <linux/dma-mapping.h>7 B& T f* J2 J" a2 I. U
5 W/ p1 R0 w$ H, k5 |. l8 L/ u! R- #include <mach/memory.h>+ f) u2 |% W+ Q! H+ }; d* Z) \1 _/ U
- #include <mach/hardware.h>: t+ B4 j' [9 y; g9 t
- #include <mach/irqs.h>
9 K2 Y& ^) ]! S/ @; w! T) K - #include <asm/hardware/edma.h>0 j1 W z* y8 y$ c. v! Q! x
- ; w5 K+ d! j0 o. d& H5 z
- #undef EDMA3_DEBUG' n: K/ v+ L2 k; i# |: b! @
- /*#define EDMA3_DEBUG*/
7 q2 t4 M# M! W
* V1 A* X: _9 i- #ifdef EDMA3_DEBUG3 [' d1 q. m, s+ Q! Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: M3 z( f0 T. u/ i) C' W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# R2 D5 r3 b* t, [/ k$ N* ]1 ~/ d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 O; {% s- a6 h* D; \: k. O - #else% I d) H' {1 y8 R' s
- #define DMA_PRINTK( x... )& D/ s V, [- q& a; m
- #define DMA_FN_IN
j/ v3 i; l% B. t- V1 \: ~ - #define DMA_FN_OUT4 u8 m X( h' I- j
- #endif4 F3 s4 b! c. `. j% t) E. y0 T
- 6 L3 o3 U5 H0 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 }6 m6 w7 z1 n& `2 l. F8 ]( E. y3 @
- #define STATIC_SHIFT 34 u5 N5 C& z! F& j5 k" Q: @
- #define TCINTEN_SHIFT 203 h8 f1 l e; n* o& J% N" s: a
- #define ITCINTEN_SHIFT 217 z4 a' y6 |- U! Y" `+ p
- #define TCCHEN_SHIFT 22
3 u$ s3 |- V- u# w. U* s: o - #define ITCCHEN_SHIFT 23
+ [) G: X6 m; G) u2 F; ]9 _7 R
* O7 e8 H1 C% z/ ?9 W- static volatile int irqraised1 = 0;
- i$ Y5 Y1 D- n. G& a3 V0 e: Z$ U - static volatile int irqraised2 = 0;: G/ C) X8 q) o, D5 c* o$ B
- + T, c( {" h2 U3 |. q8 F* C4 ?. o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- q. ^8 q& h; }/ p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, f" A+ {; z# Q+ @$ N3 Z2 _5 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ @- q+ _, I, a+ `
$ }- k! O8 B# f: f; ]- dma_addr_t dmaphyssrc1 = 0;% [& ^. m$ p5 k- K" w W
- dma_addr_t dmaphyssrc2 = 0;
! ~7 c9 M; i7 T+ B% s' \6 j - dma_addr_t dmaphysdest1 = 0;' D3 o: A( X0 ~
- dma_addr_t dmaphysdest2 = 0;: Z* I* m- K4 a* H0 u9 z/ t
9 S( s2 J" R; `/ G6 @- char *dmabufsrc1 = NULL;
# h" P6 Z2 j" f# l - char *dmabufsrc2 = NULL;& q3 L% V, O0 }7 u! N0 S
- char *dmabufdest1 = NULL;
6 }6 h+ p% u5 [ a ^* R; i, ~ - char *dmabufdest2 = NULL;5 |. h* o/ R2 X
! }5 e8 ]2 r) `, l! l/ B6 A; s- static int acnt = 512;
9 K y' D& ^4 d2 G+ q6 T - static int bcnt = 8;5 i* ^- S( ^* V/ i; B
- static int ccnt = 8;; b$ e5 z4 z0 f; w: s
7 ]; W/ m1 [+ m0 W9 |/ B) b) u- module_param(acnt, int, S_IRUGO);
# P3 _# a* p! X _1 j1 O0 b - module_param(bcnt, int, S_IRUGO);5 g3 P$ J: W4 u* Q3 m
- module_param(ccnt, int, S_IRUGO);
复制代码
0 M- ]# v9 B) m
$ c. }- [% ?9 A. T) h8 J, e3 H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: k4 ^/ n8 b) I% \+ t- Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# ?1 q+ H+ P. ]7 k8 v1 d: |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# s: N6 G& S4 r& t8 V1 g1 m
& ]/ v' H7 w+ U% @! P) O+ V
5 \9 l9 t. G9 h: Q2 r6 O# k# g |
|