|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* [4 h4 I# @% [ a- [code]EDMA sample test application& G3 Y- n$ R3 v
- /*
7 o$ s6 S+ g/ T7 {( T9 U e ?+ G - * edma_test.c" J/ J7 C4 U) T5 j% f
- *' e( e" Y, V3 w( e' Q8 V
- * brief EDMA3 Test Application
* z; C9 S" ?& B8 o0 u& q - *! ` L( M( {3 Q: r' O) D
- * This file contains EDMA3 Test code.) b% q8 V$ K5 q' U6 [
- *
( M/ Y3 p" c7 `$ [+ X6 Q4 x4 U+ w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE o. e! |) k! U# O9 k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; E4 P1 T+ V ?" I$ P& s
- * TO CHANGE.$ _- y S% T, N2 V- D5 c
- *. c0 h, M# ]. k! g% T4 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
H- e X) ~9 i7 E* M - *
2 y# I5 K+ E1 B+ ]. O0 z - * This program is free software; you can redistribute it and/or
( z1 g* e7 C% J1 V6 F! v# \* h0 D" S - * modify it under the terms of the GNU General Public License as
9 i" H! Z' j" z( m' N+ x1 k, Y7 F - * published by the Free Software Foundation version 2.
) x9 w% t! }8 ^! A1 W1 H4 ?* Y - *
; g8 Y7 K( s& g; K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# G+ U+ n6 L* ~# i# u; \5 Q: Z
- * kind, whether express or implied; without even the implied warranty
& ]# t& C) l6 q* _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. @8 @2 w/ F+ n1 P$ {" Y+ y
- * GNU General Public License for more details.8 ^$ F2 a4 I2 r2 g- n" V& i8 Y& R+ s
- */
9 ~/ Q# `6 O, m& Y$ i( Y" n2 }
# F1 z( a, `. ?- #include <linux/module.h>
! ^! k( ^3 Y- \' N9 n - #include <linux/init.h>( Z; q! I0 F; N* h$ y* ]
- #include <linux/errno.h>
; B& h3 i/ [) `2 w" t) \# t - #include <linux/types.h>
e. n, N' p; b: F2 L; L - #include <linux/interrupt.h>
! @6 D) l2 q d) F - #include <asm/io.h>. K I ~9 v. W! ]: H: e$ x+ U
- #include <linux/moduleparam.h>% B" A- V/ J& h$ U d* f) w. s9 r" g8 W; D
- #include <linux/sysctl.h>; W7 B3 A. q( M5 u$ m' O
- #include <linux/mm.h># p# J8 q8 _) `% a' j
- #include <linux/dma-mapping.h>
( h1 `/ m. Z; `( ^( M) C& \: G* h0 @( ]
2 E( O3 q6 N' }5 M& J: m/ N2 k- #include <mach/memory.h>+ C2 Y1 P W4 i( o6 J
- #include <mach/hardware.h># T, W1 g0 h9 d4 u `# [1 V
- #include <mach/irqs.h>
6 ^7 q; H$ X7 |" E% I7 Q+ j! j - #include <asm/hardware/edma.h>! \; ?6 r) N; _7 i+ Z0 X& i
9 V7 s K( Q' k! g, M' q& o- #undef EDMA3_DEBUG3 K' m1 A) c2 y* t, I$ R- q
- /*#define EDMA3_DEBUG*/
6 @/ U" y' j0 ?$ N; M" J+ _ - * _9 I7 {4 ^! p" ?
- #ifdef EDMA3_DEBUG- o. `/ e2 D5 _, _9 S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
T2 Q8 S0 W4 R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ v% e$ E" L1 Y) l6 `( b; Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( V3 P$ K# j% b% a7 I - #else
0 g, [+ M" B: G b, h5 P, { - #define DMA_PRINTK( x... )
. T3 i. a) }5 }; q - #define DMA_FN_IN( S" s v* v r3 w+ a2 O
- #define DMA_FN_OUT7 J3 c: B! k2 _, `% z
- #endif3 B( E. W' b C
- 2 I+ B8 q# E4 d0 a5 H/ o7 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 l: N% P8 _! k9 Q! G/ M - #define STATIC_SHIFT 3
* m8 ]8 E0 g6 h) s# u6 e7 ~1 g - #define TCINTEN_SHIFT 202 q# a K8 ?' F% E- `5 e
- #define ITCINTEN_SHIFT 21
3 }. [1 ]9 ]. Z" s: ~* W( p, }7 l - #define TCCHEN_SHIFT 22
, W# F- }/ w0 Y2 X2 R+ M - #define ITCCHEN_SHIFT 23
( R2 T( p0 }' `
7 C. l( T! k8 d- L' W4 t- static volatile int irqraised1 = 0;9 J h [8 H5 f& J6 _# Y7 D1 j
- static volatile int irqraised2 = 0;- n/ W1 R( R* \) F" C; b
- 1 a) b( t! y' i$ O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); @7 p/ ~. Q, ]0 g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' h7 `0 s. V: _+ @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" |) r# M4 I: x - 2 Q S9 a6 m( M/ ^6 a. q( @
- dma_addr_t dmaphyssrc1 = 0;0 [1 u; w6 f4 m* J$ R5 H
- dma_addr_t dmaphyssrc2 = 0;1 ~# f. B w2 I+ S6 r& D+ k& L
- dma_addr_t dmaphysdest1 = 0;( b$ J& K; B& y
- dma_addr_t dmaphysdest2 = 0;
( n: { b3 g5 X6 U9 M - . c4 T) a b! G! L2 P: d
- char *dmabufsrc1 = NULL;
{* q/ ~! I7 \4 C/ V4 I - char *dmabufsrc2 = NULL;+ Y7 Q6 u$ s5 ]& ?2 `
- char *dmabufdest1 = NULL;- O( H3 }% K! ]
- char *dmabufdest2 = NULL;
8 G3 J4 W& H& ^9 G% S - 6 ]# d! R/ Z/ y6 e* J
- static int acnt = 512;
) M# D$ ^" f7 H8 d- ~ - static int bcnt = 8;
. F1 C+ P- o: A; z3 _! S: G - static int ccnt = 8;
7 d1 v! b* `+ }
1 R6 m2 y' ~" I- module_param(acnt, int, S_IRUGO);/ I! Z) U& T1 t# q6 V! i
- module_param(bcnt, int, S_IRUGO);( Q0 Q* a2 k7 L$ [+ I) K, m9 I
- module_param(ccnt, int, S_IRUGO);
复制代码 5 O: G# k: j9 N5 y
5 X' X" B; S8 A4 z: J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 r/ N" Z, O9 {/ m8 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; t: W, B; O0 b& c; S; K: Q8 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ _+ z* K D8 P* H8 H, }: t2 B# V+ Z u9 c1 [' ~- f* M
" E5 a) i, T3 @' X! F1 N% h1 w |
|