|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! T( C. q: z; p- [code]EDMA sample test application5 J+ X, F! ~% F) Z
- /*
p" M! } J7 O0 B - * edma_test.c% m* M" b" c' v2 R0 H9 b6 D9 T; |
- *. ]6 m) O2 X+ g7 L- y5 s/ X; v8 b
- * brief EDMA3 Test Application# v; h' V) r* P5 P* v) F$ D
- *
$ t2 v$ A# y5 v' {0 ` K( W - * This file contains EDMA3 Test code.* P7 N( C1 N9 I
- *
; u- d) r) \* x# A, k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 J6 ]4 P# T2 u! l- G" h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ x( s5 |1 G6 o* {* }( ~/ _
- * TO CHANGE.
) [5 R+ c% h9 i$ Y# L8 I( t6 K$ o - *
# ~% f/ ~+ p; a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! d: W% L0 b5 u - *$ b; K. G, C8 E) p' O$ n
- * This program is free software; you can redistribute it and/or
3 {! p/ N+ v. T/ z, x! ? - * modify it under the terms of the GNU General Public License as% @1 \1 I+ |. }' _
- * published by the Free Software Foundation version 2.$ N6 w( u! @" ]& d3 B
- *
1 I3 [. e+ ]. z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ H. E# C% g4 r/ N" ]& l( H - * kind, whether express or implied; without even the implied warranty! F# n5 D! F. l/ \# K# o. C/ m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ f2 T# y i7 W, O6 J. s) ~! q
- * GNU General Public License for more details.3 Y5 y) [$ _5 z- v
- */
+ f8 m4 T/ @8 H1 L0 s+ c* X8 [7 } - 8 a7 e) F5 m6 l/ C
- #include <linux/module.h>
) g! N& w1 J, U- G' P8 ]7 _ - #include <linux/init.h>
2 L! H) [5 p1 k: K - #include <linux/errno.h>
" i( b( ]+ r( t& C+ D' H - #include <linux/types.h>
i0 D) J; ]% i( N+ E9 n - #include <linux/interrupt.h>
. E8 K" B. U; R) A9 o# Y k9 Y - #include <asm/io.h>+ a2 e" H3 I8 _$ b+ K1 b6 H1 \
- #include <linux/moduleparam.h>, ]& J9 j; n6 W" X$ t4 o
- #include <linux/sysctl.h>3 K& k0 i4 z/ t5 N5 g# g8 v
- #include <linux/mm.h>
4 I( [& _* }& H8 N3 w- F - #include <linux/dma-mapping.h>
9 Z- y$ [ [! o$ ]# D* q
3 I+ I8 f% ?$ @' S. [: k6 C- #include <mach/memory.h># Y( j0 d- X0 s( P8 w; V
- #include <mach/hardware.h>
" G2 ^% {6 a# N' l - #include <mach/irqs.h>! \ U/ ~5 Y( ~) ^; O
- #include <asm/hardware/edma.h>
0 k. w3 i/ E" G: A1 l- a - 2 P6 x, }9 f4 b& Q
- #undef EDMA3_DEBUG
5 ~( J, n9 e3 L! W9 f - /*#define EDMA3_DEBUG*/
6 H4 H2 E5 K, M- v) `6 X/ K0 y - |" N) h" K" \# }2 j: A+ Y
- #ifdef EDMA3_DEBUG
( D. X0 g* U5 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% ^5 g0 j% ?" d7 u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 t# g# x0 r8 S+ Y" t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ L$ U0 |7 Y) M - #else m$ r9 C) l6 Y
- #define DMA_PRINTK( x... )- Z2 O: B) X& j0 b& n7 I
- #define DMA_FN_IN
1 B( ^7 h( i" {+ B" e, K& T$ Z, x: t - #define DMA_FN_OUT
) A7 p7 W) F& ]2 P, J5 _/ D - #endif
& l1 y* ~: l6 n# Z
! H0 e& W, Q& G+ v( m, B' N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 w" v7 s* s5 z) {! K z: J$ G
- #define STATIC_SHIFT 31 T: G& h. Z$ h+ C4 o( c- b
- #define TCINTEN_SHIFT 205 z9 u6 q0 y# e7 h. p
- #define ITCINTEN_SHIFT 21
/ O ?% C8 a+ _9 Z) `& t. w - #define TCCHEN_SHIFT 22, S0 {) X) G- G0 q6 p k7 k
- #define ITCCHEN_SHIFT 23: k( V, P+ V) k/ E
- h: r* v' s; N6 N- static volatile int irqraised1 = 0;9 o4 p' ~1 K) ~
- static volatile int irqraised2 = 0;
0 g5 \5 R5 H/ e( d: j7 p6 B
/ X9 I1 g2 k( n7 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* `/ ?7 [; L q+ {( H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ^. w/ H9 [ D0 y" r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& o/ }! I% h( R. C" [
. B) b4 V! ~2 r+ E$ T; o# i- dma_addr_t dmaphyssrc1 = 0;
0 d; D6 x, E8 m: u - dma_addr_t dmaphyssrc2 = 0;
# h/ c0 [ T: B( `: |5 P, G6 y - dma_addr_t dmaphysdest1 = 0;7 E3 D: K9 m) t7 ]$ ` o
- dma_addr_t dmaphysdest2 = 0;
U W4 D5 E7 F - 1 c' O) ]2 B. U; C: `
- char *dmabufsrc1 = NULL;0 @- ?: z/ _- O: S; x
- char *dmabufsrc2 = NULL;
( [$ j* A$ c2 l/ M: _4 u7 m - char *dmabufdest1 = NULL; E4 C' J) U3 F3 v" w! E+ L
- char *dmabufdest2 = NULL;
! H* c! t7 D8 [! _; ?6 \ - 0 Q8 `9 b! @7 Q- \
- static int acnt = 512;" x8 R \( G. }( U' }, z
- static int bcnt = 8;. p' [/ l w+ r* p+ h$ P# o
- static int ccnt = 8;9 F$ H9 I9 P8 }6 V" S3 @
3 A5 n7 R) S3 t$ A- module_param(acnt, int, S_IRUGO);
. ^# u8 }! H6 G! r3 |$ @ - module_param(bcnt, int, S_IRUGO);
+ a3 P4 d, `4 Y+ a" Y - module_param(ccnt, int, S_IRUGO);
复制代码 - ]9 C, p$ K8 H4 A0 l
; B1 ?* t* g& l0 T% m/ V( T1 ^8 { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 e+ J9 Z# e) ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# u4 c; _7 E5 m. ^6 \7 Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' M+ H8 r6 K4 X# m) T
0 A/ d% m+ K$ P4 }9 D0 w" Z a' K" |0 V" Q I
|
|