|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( m: D' m' T2 M; o8 W- b
- [code]EDMA sample test application% w- x! _' A1 O( S2 C5 F$ \: [
- /*7 q% N' R' h% G( d0 R" d3 J- b- b0 Z$ O
- * edma_test.c
- x9 x" c2 a) O( s- L* k" c5 {6 ^ - *
+ _4 E. ~7 ~9 K - * brief EDMA3 Test Application& T( f3 @- P- u+ F
- *2 [' ^3 P) C5 K
- * This file contains EDMA3 Test code.
, x" B+ H* H' Q8 ?; R2 d - *) ?6 L4 H+ M. x2 g$ n- n% Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: F) s h* a8 D- B/ r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& P) j t5 |& ]2 M: N* @
- * TO CHANGE.) v4 B: n9 A* X# z5 E2 M R E
- *
$ H- _/ D8 A9 O8 Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 A5 b6 _& R' u* U
- *1 q2 f% i/ w5 T- z ]6 F
- * This program is free software; you can redistribute it and/or
9 O6 N. K$ t5 i7 }8 j( X/ T' J6 M, J - * modify it under the terms of the GNU General Public License as
) E/ P c' E9 ]7 w! e( s! N - * published by the Free Software Foundation version 2.
$ \' w4 h a2 d$ Z/ x - *3 }/ T, ?* P' m- h0 D$ s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any g+ e0 G8 Y1 P& o
- * kind, whether express or implied; without even the implied warranty& o1 o( w# o1 {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
E, }2 e! U8 g% ? - * GNU General Public License for more details.
- N" A [2 d* T i2 b& z - */
0 O- M9 j' \; h0 I - 8 N% I; q3 f7 [, c5 R- T! y
- #include <linux/module.h>
3 O# k2 E" b; Z; [. a - #include <linux/init.h>; S# H+ S6 b* [0 E4 h" n; Y, y' v
- #include <linux/errno.h>
6 x8 e6 G4 K% c/ p - #include <linux/types.h>
. ^ b8 E4 L0 d, J* r6 e - #include <linux/interrupt.h>
" _4 S% l) s1 Y8 e0 M; O - #include <asm/io.h>. Z& z! p& Q! M* x3 i5 j
- #include <linux/moduleparam.h>
6 H" I* P0 H+ x* F* c$ X2 c - #include <linux/sysctl.h>! |( o* s1 ?4 h& }
- #include <linux/mm.h>
3 _' O) K: @8 }) u - #include <linux/dma-mapping.h>
" {3 Z$ N0 |/ l6 s q3 f+ E+ @ - * @. s3 e1 Z3 n2 A" u+ ]7 V7 {& |' R
- #include <mach/memory.h>( @+ U" J$ D! c
- #include <mach/hardware.h> P( U7 u" r/ D# @. i
- #include <mach/irqs.h>9 ^, Q A2 m7 n6 p
- #include <asm/hardware/edma.h>9 h; ?9 S# a* j$ ^
- : _8 i0 @( @$ Y1 ~. T
- #undef EDMA3_DEBUG: ]4 [$ t' z& L# S
- /*#define EDMA3_DEBUG*/* w- s- L1 X& J1 u$ c
- 1 `6 y$ h! I" w2 ^& K& U) C" }% Z
- #ifdef EDMA3_DEBUG1 d! K, x2 u/ y- p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 D- _& o% [0 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; a2 v' M7 a9 }; l4 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! J1 K' l! _: j: H; r1 f1 q. z - #else0 N7 n5 K2 X9 E# P( `5 e: u
- #define DMA_PRINTK( x... )
5 A' G3 s7 i# Q - #define DMA_FN_IN
/ D, L% p# U% X- Y; m& f- \- k) U% a - #define DMA_FN_OUT
0 V% P+ z4 I1 A g( x+ }# H! f7 j - #endif/ R0 u6 \0 G- \. x4 i j3 g
- 6 `8 C6 Y4 H! A7 F# B& \+ w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, T! [ y! z2 d5 x - #define STATIC_SHIFT 3
( b0 T9 w) p& i0 M; G - #define TCINTEN_SHIFT 20
0 x" b' t8 p! K$ ` - #define ITCINTEN_SHIFT 21
$ d% W1 ]4 l3 k1 o f - #define TCCHEN_SHIFT 22
2 _1 ^8 K; h" l! D. ]: Y - #define ITCCHEN_SHIFT 23
0 \ E4 z0 J+ ^. B8 w4 W$ C
0 i1 T& N2 \& p& j. o! ~- static volatile int irqraised1 = 0;3 u; }3 s% |$ k* H& p4 b6 o0 ?
- static volatile int irqraised2 = 0;' E5 w( m4 m1 }; W) N
3 o% u, u e% B5 H; V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ^; E' s8 T& h$ F' l- Y C% f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 O; q! Q |0 n+ B1 g2 h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 `: ?% z/ W" p3 ]1 D
# p) ~3 h; L1 n- dma_addr_t dmaphyssrc1 = 0;7 L6 ~' [4 F, Q+ ~
- dma_addr_t dmaphyssrc2 = 0;
: i7 g' Q5 N8 L; M3 e* G* ?$ m( V- P - dma_addr_t dmaphysdest1 = 0;
; E$ D0 p c& E8 `& n8 K - dma_addr_t dmaphysdest2 = 0;$ X8 ]. i% C$ v6 y
3 W. \2 N. k- P" Y- char *dmabufsrc1 = NULL;7 V9 F L: a5 z
- char *dmabufsrc2 = NULL;) k" b( `2 H f- E
- char *dmabufdest1 = NULL;
2 _6 H! V: h+ [# O% S - char *dmabufdest2 = NULL;
! u4 C0 D% v) `( R9 P- U! p+ V - ( p4 {4 z! I3 g( X7 W0 c
- static int acnt = 512;) d0 W, f! c0 ^
- static int bcnt = 8;( H' i- O* ~' O9 y3 @% V
- static int ccnt = 8; p+ Z4 e7 T& ^8 z6 F
9 X9 U) @2 L6 ~- module_param(acnt, int, S_IRUGO);5 V/ B8 k, p) z1 Y
- module_param(bcnt, int, S_IRUGO);
G7 u0 H. y% N2 K' N$ s - module_param(ccnt, int, S_IRUGO);
复制代码
" _) G5 _/ i# ]; Y# \
9 f" w; e7 W2 A* F6 Y$ O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 m5 `* ]9 e1 ]: F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. x" l. X$ _' v! G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 b G( ]7 e Y3 H; v/ w
5 T1 o( }+ q$ q; X0 U6 |
8 c6 X- _) A7 }& B |
|