|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" l$ \5 v* n, U- g7 y- [code]EDMA sample test application6 x) t5 j" s# X& C/ ?8 G
- /*
' I: k" T, Y# o - * edma_test.c4 n' D1 [% V- t
- *
( b3 q- h/ R0 t+ g: g, t3 } - * brief EDMA3 Test Application" J2 ~8 k1 D9 g0 N: |6 \
- *: {2 @7 _$ s' P8 ?$ U0 i3 `$ V
- * This file contains EDMA3 Test code.
, K- e, K- Z a$ ~4 ~ - *
h+ B. n* S( f& |' I9 T% ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( |- D; D0 V: O2 h/ D4 H$ a E2 X9 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( ?6 j! [; d: q) C, X% @( y! T; ^( {) k1 a - * TO CHANGE.+ g2 z' M+ i1 v1 _
- *5 T) k) v; q8 S8 s) n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* X* W# `5 I9 i" ^1 [0 k
- *! C; Z9 J2 C/ {) C) t8 Q& \' Y+ U
- * This program is free software; you can redistribute it and/or
# J7 T& p E. Y) f, }& f - * modify it under the terms of the GNU General Public License as5 u# E4 R9 G/ R8 P& x- W' p
- * published by the Free Software Foundation version 2.8 K. Z" V% u/ r q) t
- *4 z7 V3 }6 ] s) S* A+ ~( @ s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 o, Z. A$ E7 f8 H* Q7 D! a
- * kind, whether express or implied; without even the implied warranty
2 `2 G! I( X& h+ j7 O2 {4 L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; i7 C% n: F, |$ S' e9 G% w4 J1 d& L
- * GNU General Public License for more details.4 @+ z) a! @. p; H9 `3 |
- */* t/ c# @' F! ~" {+ D7 G, W
- ; K, M( d! x* t2 ^' T9 E9 o5 w
- #include <linux/module.h>' o y8 G$ s2 d9 |- g' ]
- #include <linux/init.h>7 N8 m& o n! R) G5 C9 K2 S4 s& i2 T
- #include <linux/errno.h>1 d. E' j, m; c
- #include <linux/types.h>
" i3 W7 }* I4 ?4 R' { - #include <linux/interrupt.h>9 H4 A$ [# I! v: W. W; d
- #include <asm/io.h>
! |% W) ]- x) F4 u - #include <linux/moduleparam.h>
4 X, Q/ a' o# ?! O* a - #include <linux/sysctl.h>- X9 G) C* v M4 ?6 |' V
- #include <linux/mm.h>" G! y& d0 V B+ c. Q' o. b
- #include <linux/dma-mapping.h>7 C& b; X9 @6 W3 j+ r4 C% K
- / ]6 ~. m& L( e6 w$ n+ H0 _ n9 e
- #include <mach/memory.h>/ A4 N5 V, P1 h6 f
- #include <mach/hardware.h>6 D z% x! W; p6 ~! Y% \
- #include <mach/irqs.h>
$ `; g0 j/ N6 T2 F# ] - #include <asm/hardware/edma.h>( e& p/ @6 ]% R( c; Y5 n
- ' ]9 G8 e* F, z, U! h. ?8 _
- #undef EDMA3_DEBUG
' P* x1 |; f: |7 p - /*#define EDMA3_DEBUG*/
) c$ [- L! d- M
0 g. O4 S* W% L& h$ o1 K. G- #ifdef EDMA3_DEBUG; v1 N2 g3 o/ \- F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N% W" d; L5 s$ a5 v0 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 L! z, p9 }9 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ S) O# J' e9 `# |( Q - #else l; v3 r8 i0 ?2 t
- #define DMA_PRINTK( x... )
' _: p# D; i' Q' l6 |" N - #define DMA_FN_IN
4 W! i4 t/ T: X+ G - #define DMA_FN_OUT4 w: ~. z3 k- R/ o1 Q" P( y
- #endif
* |. \3 o0 |6 E4 t& h5 O$ h+ [ - 2 F8 V; o. s/ n. T0 r' v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 K: r: Q/ u, g; _: o* D
- #define STATIC_SHIFT 3
: W0 |, b/ W$ X% O% Y - #define TCINTEN_SHIFT 20# r) c0 `! J6 V; r4 e0 c
- #define ITCINTEN_SHIFT 21
) y; A! q$ U8 Q) h6 r - #define TCCHEN_SHIFT 229 a( s9 I$ N. j* j7 S, K1 V' P! \
- #define ITCCHEN_SHIFT 23. H7 V8 Z. A8 @) u
- - d6 C3 @/ c; o3 Q' B( j6 p
- static volatile int irqraised1 = 0;+ R# M% W5 Y- S) D
- static volatile int irqraised2 = 0;
4 m: @$ r5 \3 ?" Q
9 {. C# V5 D$ o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 A4 c5 I; m+ l& Q3 ?/ J1 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. z/ V8 g5 }) }7 F% r9 T5 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( T1 w9 h( I# h - ' n: [0 k0 c! ~- |$ I
- dma_addr_t dmaphyssrc1 = 0;" P$ K9 j. m) Z* x: B4 A2 k
- dma_addr_t dmaphyssrc2 = 0;# @7 \* C, U7 N0 }+ W* v' A
- dma_addr_t dmaphysdest1 = 0;: D! g1 _2 r; G
- dma_addr_t dmaphysdest2 = 0; R( v7 W. K- q8 J
7 T3 y; y' }5 [3 A+ M' {- char *dmabufsrc1 = NULL;6 M7 Y& `# Q# P8 y' o+ t& k4 n# \
- char *dmabufsrc2 = NULL;6 X/ w' c! |( A+ J/ C
- char *dmabufdest1 = NULL;! B2 u2 Z; k, b# V" L {
- char *dmabufdest2 = NULL; e* E9 `2 y( I, u8 W: `& S" s
4 ~. H' C, f8 V+ t- static int acnt = 512;& ?" i% ?* C3 k! N
- static int bcnt = 8;* T) l" H7 W+ O/ y; \9 l
- static int ccnt = 8;
4 S0 c4 w7 \, M8 h. T7 ~9 Y
# v) k% g7 v' d. C# ~0 E- module_param(acnt, int, S_IRUGO);: c) `: s: d% K
- module_param(bcnt, int, S_IRUGO);3 k; t1 t- B! d$ g
- module_param(ccnt, int, S_IRUGO);
复制代码
0 B4 N8 e0 T7 d3 f* z! `8 V+ b0 d- V: R5 s r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. @6 R- l- x* R- X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: h; k9 n) G% d! x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' [& b+ [( |0 R- j: K9 x
* h2 ~ W% f- j* W6 V: ~$ E
9 ~6 m# y$ L% N* u9 l9 Q( y+ z. E |
|