|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 U6 x5 r. f+ S0 R" ]- [code]EDMA sample test application/ C! B% P# \1 f* Z T
- /*
3 K8 W7 N! T0 x7 J' g, b! | - * edma_test.c
) @4 o) D0 [) o8 |% a - *: b9 ^4 g9 z {, y# a0 n
- * brief EDMA3 Test Application
5 D/ d( q( ~& {2 O+ q% d - *5 I$ M0 b$ C) i* a" u
- * This file contains EDMA3 Test code.; F* n/ q2 G. Z4 u0 U6 g
- *
; S- T8 ]& R5 l2 V8 ~3 i+ l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- ~, I% b" n) \8 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, V# J0 ^. u, `3 v* A2 D - * TO CHANGE.. W8 I1 L9 j5 e
- *
1 P# Z5 T) r, k: M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; [: \+ c; d5 N/ X2 v
- *5 c' v9 p s0 `8 K; m) U; s
- * This program is free software; you can redistribute it and/or; H/ w x8 a' F
- * modify it under the terms of the GNU General Public License as
6 }) _' W. }" Q+ g R - * published by the Free Software Foundation version 2.
8 b0 }/ j9 I/ _+ w$ S - *( `5 B) A2 Q8 T* k- R$ I2 Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. K, o) H6 U- T5 d& z3 I' F& \
- * kind, whether express or implied; without even the implied warranty; G& }4 {8 D# D. N9 r' C# ~0 G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 f" q0 x" K6 s' U. Y1 [
- * GNU General Public License for more details.1 b ?# @3 Y; R3 m; N
- */
+ P }# f; d6 B4 T - 7 O: ]& b- U4 o7 t* i! m
- #include <linux/module.h>/ |& _& {& Z! b; p) Q$ C
- #include <linux/init.h>
: B! r; e1 @# U6 K+ E7 }/ m - #include <linux/errno.h>
2 _$ Q) d+ o W& H7 ]; Q - #include <linux/types.h>
9 X/ C! \2 V8 s1 `- u7 { W/ Z9 Z - #include <linux/interrupt.h>
9 b9 ~8 {( ~! S9 {8 _% E2 v - #include <asm/io.h>0 ~# G! t, g5 K2 E5 B3 ~6 D9 V: w
- #include <linux/moduleparam.h>
4 x3 L' T% z$ B - #include <linux/sysctl.h>
9 g. {% d5 p$ D - #include <linux/mm.h>9 ^# e3 j9 X/ D1 A& U9 h
- #include <linux/dma-mapping.h>
, y% I+ I* U+ _5 J8 [ - - l p2 D# b+ c, z4 M* Q$ @5 M
- #include <mach/memory.h>
5 q6 r# [0 b0 G9 P - #include <mach/hardware.h>
) V( _; Y5 ~/ M4 m. c! N! H1 d* ?( L - #include <mach/irqs.h>
/ w" y4 u7 i$ j$ e - #include <asm/hardware/edma.h>
9 k6 ], H# K8 O4 \+ B# c - 8 v' S2 ~# X0 @% ?& Q
- #undef EDMA3_DEBUG9 b+ F2 A5 u* q* j
- /*#define EDMA3_DEBUG*/1 j, I" v7 ^. b9 s/ }+ ^
- . e. v7 {! R5 j. \0 t$ f
- #ifdef EDMA3_DEBUG3 H2 k+ C* Q; V& i" c& X% \6 Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 }6 u1 n3 z* `5 u7 }4 @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 a0 z" c, P! J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- \9 h8 y* g b( I* V( M
- #else
; m2 P2 ?- f2 @ - #define DMA_PRINTK( x... )/ X! p7 S: z, u
- #define DMA_FN_IN1 D- c5 B9 ]9 J: ]7 A$ G2 Z( K# C
- #define DMA_FN_OUT
9 s- x6 {* ?$ } - #endif, T# T5 n, F) ?1 b2 m# F
" \2 W) p i- `6 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 D, j2 f2 u9 C% f* j+ A - #define STATIC_SHIFT 3' a$ }( _: v. {- u7 }
- #define TCINTEN_SHIFT 20. q* `6 T1 Q' F2 n# N9 b
- #define ITCINTEN_SHIFT 21
* e1 K& i) F, ?8 E. b7 L# g* z - #define TCCHEN_SHIFT 223 P& P0 q" ^; j' g3 V2 }, O
- #define ITCCHEN_SHIFT 231 r: [' S$ D" b$ {" O ], X( n6 O# L
- ) c3 d6 W+ l+ c0 ?; A
- static volatile int irqraised1 = 0;
6 s0 [' }+ P6 O. T - static volatile int irqraised2 = 0;7 h/ A& X2 C t3 }
6 u5 A/ c( w( U+ m4 M4 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. p' j9 |! ]; U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' _' Q2 x* H9 o" z3 f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" d1 H, ]5 |% u- \: ]- x" y" T
- 0 Y- q% N. _$ n) y( C* [- j
- dma_addr_t dmaphyssrc1 = 0;
$ t- N) H9 g1 N6 M1 I - dma_addr_t dmaphyssrc2 = 0; F+ p* t+ d( A7 s
- dma_addr_t dmaphysdest1 = 0;
2 f2 v& c9 h# v - dma_addr_t dmaphysdest2 = 0;
+ m5 K0 |" \# ~+ A1 W - ; b. O9 O/ t% m* M2 J: U) n! Y
- char *dmabufsrc1 = NULL;
L, [: M4 e7 b3 C3 l5 S5 f3 ` - char *dmabufsrc2 = NULL;
! I9 t% e/ k3 v, r" X - char *dmabufdest1 = NULL;8 p7 G& J( x4 x4 A5 ?% ^& T
- char *dmabufdest2 = NULL;' P( ]0 Q1 g. o; ^3 [1 ?) J
- M* w0 B2 o+ S0 N% y+ S/ n j- static int acnt = 512;
$ ^' K+ \/ R9 Z# e* E - static int bcnt = 8;- O' C* o' v A" y1 {( ~
- static int ccnt = 8;9 e0 A: o$ [1 m3 k) x$ M
9 c3 f5 T Y% i$ t: w- module_param(acnt, int, S_IRUGO); K5 w+ R. d0 o9 P
- module_param(bcnt, int, S_IRUGO);9 F1 h5 Y$ o7 \0 g
- module_param(ccnt, int, S_IRUGO);
复制代码
4 V( C P" g. |
! J5 @: p' V9 P X) n" [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 G1 w0 `) p( p% u% o% n1 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! V6 o5 L% z1 t$ I9 p/ _- A* x- y- h( c ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) u! Z, `9 s! F( K' O# z5 A( o5 \
- F ^, I6 W8 J& T$ P! t$ T, h
$ b: }; S# P$ x- w, X1 b4 s |
|