|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ @/ M* C- Y# m3 {: r- [code]EDMA sample test application' ^. o- H* H' a8 K) q# s" d
- /*
7 U- k/ n" j' k8 g2 a - * edma_test.c. \! R3 L$ w3 W+ t$ z: J6 L
- *$ U* u0 W9 k# Y9 e' m
- * brief EDMA3 Test Application
$ ~7 Q# Y6 ?: N+ K - *
) ]+ T, b; x9 _& [0 g" e - * This file contains EDMA3 Test code.: n5 @+ L1 J" \' p- Z
- *8 q/ O4 Y, e- \8 h" ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) |* H1 H- b0 [# t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) c) s. g4 q, _$ U+ d$ v - * TO CHANGE.
6 c" E! G- d! p - *0 p Z. D6 G% B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: i/ y/ k1 v; r- \2 {5 V. Y o
- *
# w8 R* l/ F% s0 t* B - * This program is free software; you can redistribute it and/or, j$ [" u7 t& U
- * modify it under the terms of the GNU General Public License as1 Q/ n, ^6 C- F q6 o/ u% Z8 h
- * published by the Free Software Foundation version 2.! A. \5 _2 }, D8 y
- *( W: D1 t. u7 H$ L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 f% Z; f% l$ Y6 E3 g - * kind, whether express or implied; without even the implied warranty( x; [ U2 M; x* P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 x" U8 P! m5 V( S) s
- * GNU General Public License for more details.
p4 e* j5 g' n" F& Y7 U$ b0 W- O& v - */
) b/ z: v- [. b. a6 L - 4 z; ^+ s v; ~ }6 ]
- #include <linux/module.h>
6 S4 Y7 k# f# e! t - #include <linux/init.h>
& t2 y1 |& B7 e$ G. H; z - #include <linux/errno.h>3 g# d7 [- ]1 D
- #include <linux/types.h>2 A: l# B2 M9 `( Z, } j7 ^
- #include <linux/interrupt.h>
9 N q! ?3 I; i5 ` - #include <asm/io.h>
# l7 h' G2 D9 c0 R, }: W - #include <linux/moduleparam.h>8 j: `8 m% N- X+ u2 E) }
- #include <linux/sysctl.h>0 d- R0 k: A% b1 ~' }% E: h9 E
- #include <linux/mm.h>6 }6 `2 q* C0 K; Y0 D% O& q
- #include <linux/dma-mapping.h>
5 c$ [, Q) `$ L* P- n" f3 K* |
! u/ d, z4 M& H- #include <mach/memory.h>/ K! _! O& C ?' n
- #include <mach/hardware.h>) |* v2 ?/ {9 f; p/ `$ A
- #include <mach/irqs.h>. D. _8 R, t6 h7 a
- #include <asm/hardware/edma.h>0 k' b) B% {7 a6 p& l5 s
1 _2 U$ F3 l& J. y/ ^3 r- #undef EDMA3_DEBUG
( W2 j6 U9 `/ z4 Q$ d) s7 _5 }9 a - /*#define EDMA3_DEBUG*/
" m4 f; X; q! T& f9 L - & K% @: ^( W, b, r: X* Z
- #ifdef EDMA3_DEBUG e3 g6 F' S8 }9 P6 l, A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' g& {7 ]5 R# b _$ M2 p* ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# j2 z+ T7 L9 k8 v3 \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 O5 c$ f# @; G; f7 s8 X/ X+ G
- #else1 k8 w. v' C9 n
- #define DMA_PRINTK( x... )0 c" Z Z0 b- H% v9 |" i" h% m' \
- #define DMA_FN_IN, k" j$ g$ w7 [
- #define DMA_FN_OUT6 W8 \& o' N( [' J
- #endif
/ D1 p4 J$ R$ ]" j! _4 I$ z - ! R$ x8 J9 a! n, w3 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- |# r) f0 ~3 Q+ O: @
- #define STATIC_SHIFT 3
3 t/ L3 q: [' S* j2 {; z+ g - #define TCINTEN_SHIFT 20& m/ D2 Y: ~# }7 u* U. S( Y
- #define ITCINTEN_SHIFT 21- ?% v. ]# D3 _. N W5 U
- #define TCCHEN_SHIFT 22
( L( u/ |, {* `) Z - #define ITCCHEN_SHIFT 235 X% r8 v- r3 B$ N$ s( E# _
- 5 b! g( w" k$ k0 X
- static volatile int irqraised1 = 0;
' \1 B5 M% [1 ~3 J( i# X9 Q - static volatile int irqraised2 = 0;. ]# Z# ]$ `. [, u
- 5 z- E1 Q0 Y$ Z9 o" ^ d V( S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! ^% t4 Q: M2 |# e8 G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C9 S& o6 q7 D5 I* c7 p6 T) D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' U" r) _) O: `' a3 N# ~, \
- 5 x7 u4 t8 g8 y9 g6 ]
- dma_addr_t dmaphyssrc1 = 0;
5 l2 t; _, ~$ G) d9 E - dma_addr_t dmaphyssrc2 = 0;/ Z9 E/ W- |4 ?; j
- dma_addr_t dmaphysdest1 = 0;# \, `" j; n8 g& O: `, M
- dma_addr_t dmaphysdest2 = 0;
, `& I' T+ A! D - " R8 J" i& j+ H3 K8 z0 f
- char *dmabufsrc1 = NULL;- `( U0 r1 |" x8 {* G
- char *dmabufsrc2 = NULL;, w9 v% E! K8 K0 p7 t$ F
- char *dmabufdest1 = NULL;' s3 v% f* v* ]1 u" o" H+ I
- char *dmabufdest2 = NULL;
# r1 I# q% @7 ~ z3 A
. f4 H# Z( y9 d& ?, d- static int acnt = 512;) K0 A: {& `. U& J2 }; I B
- static int bcnt = 8;/ N4 I1 w) L1 S( Q. C# T
- static int ccnt = 8;
' x6 y$ B( F& v+ D6 ?6 e! I - 3 ~% q( a+ f) b) [- q8 m
- module_param(acnt, int, S_IRUGO);2 ~6 p/ @/ `4 X2 }/ K T
- module_param(bcnt, int, S_IRUGO); ^5 {: P" ^. q. [8 m
- module_param(ccnt, int, S_IRUGO);
复制代码 2 }6 {4 g3 P. o1 x+ ?. B% ], \! P
% L6 D; v! j/ D% Z. Q3 { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 k5 ^3 C" @$ z# [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% k8 Q& h+ s" Z2 r* X( [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ v" }$ W/ S! N+ U/ F5 b
8 V2 q+ J: z5 S" m
" U$ t2 ?: W: c6 O9 h |
|