|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 x8 k% m- k2 L4 E; s) p- [code]EDMA sample test application
, @+ o2 w& w: C5 y& C4 w/ K' j - /*
! ^6 w( k: c N2 w - * edma_test.c8 Y' J" j3 M. w9 B
- *
: k1 i$ r' f0 A. f/ ~" h - * brief EDMA3 Test Application; i( E" E) m( R5 R. h1 H, c
- *; \$ r6 x8 e' @: U: L$ M2 g
- * This file contains EDMA3 Test code.* ~% e! V2 C8 l, Y( e( }, f
- *
+ Y* c4 p4 Z' g6 T3 ^# j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 O6 `5 B/ O2 L0 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 h9 Y! Y! [* q8 B R: _$ g* N2 D - * TO CHANGE.
6 j' G7 t& l, A* H - *6 t: }3 e4 r8 [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& b( l4 z4 D7 y9 K. Y* i% _# f- ~/ P& K - *5 s: q+ {/ G' [: V5 ^
- * This program is free software; you can redistribute it and/or5 o* a0 a/ k/ l# D5 X
- * modify it under the terms of the GNU General Public License as( w# ~4 d6 C( X1 d
- * published by the Free Software Foundation version 2./ s- k* Z7 D$ M _( u1 i4 R! H; g
- *8 P; q4 D) U) t" P4 f" q$ ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 ?0 O. i+ [: J% } - * kind, whether express or implied; without even the implied warranty: `' h$ o4 `& {( y7 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 C: ]1 @( H& h% h; @
- * GNU General Public License for more details.: S5 j7 |3 m+ ` P4 X; Z
- */; o3 D) W; d& k
8 q6 {6 A+ M4 P3 n4 Q0 d- #include <linux/module.h>( x: X, P% w |
- #include <linux/init.h>
, a& Z- K2 B# _( w3 s) I! A; H* x - #include <linux/errno.h>3 m6 n; p* X) N( c! X6 P( o) \
- #include <linux/types.h>% P1 X- O: ~8 Y
- #include <linux/interrupt.h>$ ~5 l9 K) Q* r- r
- #include <asm/io.h>
6 V2 ]( }& H* D/ F - #include <linux/moduleparam.h>
% d* M1 i# P j) Z3 d) m - #include <linux/sysctl.h>
5 g4 l+ {7 u0 F. B - #include <linux/mm.h>( s1 G/ e; C# l, @* `& l; M7 {0 l" g
- #include <linux/dma-mapping.h>
, B' `' b) A- A9 P. O J" ~& }6 o
6 r% I- G$ K, f- #include <mach/memory.h>+ M! n7 E+ d* ~, D5 [
- #include <mach/hardware.h>
" T9 }0 |; s! P - #include <mach/irqs.h>7 k' }+ w6 T, O
- #include <asm/hardware/edma.h>) [& k: V0 l5 u! m- V9 m
" P/ @) z' C& z. ?+ U* e" F- #undef EDMA3_DEBUG
5 M; C# ~" A3 w1 P$ z2 @! a6 g - /*#define EDMA3_DEBUG*/
2 P" ^$ C( S+ R2 }, | - 7 O5 U" H& [" C# v) Y
- #ifdef EDMA3_DEBUG
0 u; m( Z" n1 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ N4 M9 w6 R* x$ [( g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. j+ ]; b) h: s" P, Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% `- `% K4 O+ n- Q
- #else
9 R8 @/ {8 N2 [( _ - #define DMA_PRINTK( x... )
5 X L; E# O" P% X5 L% w. K9 Q6 _ - #define DMA_FN_IN$ L7 b2 e6 w7 A/ O1 q$ d
- #define DMA_FN_OUT- Z- B, ]! V/ E4 s/ \# {
- #endif( _4 W- C: @! z# x0 t
- $ h4 f7 j4 P7 _) `( \ ^' N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ Z( ^ N. V$ P" T, m6 ], Z
- #define STATIC_SHIFT 35 C. X9 B- V. l, G
- #define TCINTEN_SHIFT 20
/ @2 r n) S! l: ~8 a/ V/ R; } - #define ITCINTEN_SHIFT 21: d m- F) {( c( H# Q6 h
- #define TCCHEN_SHIFT 22+ Z# s" f5 e$ m" y
- #define ITCCHEN_SHIFT 23
8 A; ?) I5 k. z( v: p2 h - . f2 p! X4 b1 s; c) F7 |2 q* |1 ~6 q
- static volatile int irqraised1 = 0;1 z4 P& d3 w7 b& z' |* g
- static volatile int irqraised2 = 0;5 K- {! l6 }6 ~; u, o
- 5 G) C& R* L5 J) \- ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 X* `0 Q$ n- h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); V( h i0 x8 ]4 \3 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- |3 G; f6 k7 T" b3 b& A - , d$ K- b2 b8 z8 K1 p
- dma_addr_t dmaphyssrc1 = 0;
+ A# X7 X0 U2 t. H - dma_addr_t dmaphyssrc2 = 0;
3 ?' r& ?6 N/ D" i* Q - dma_addr_t dmaphysdest1 = 0;
9 p/ ^7 C& P3 { - dma_addr_t dmaphysdest2 = 0;
5 Q! H+ Z1 G" t: N0 i# }2 F
2 s: I2 B4 @6 r" g: Z" C! y- char *dmabufsrc1 = NULL;
5 U8 Y. X* t, t5 z' t) p0 E - char *dmabufsrc2 = NULL;2 l5 T: M- j3 P. t4 y. Q& H. T$ P) ^
- char *dmabufdest1 = NULL;
5 ]8 o& t) g) n+ i8 M! `# ?" p - char *dmabufdest2 = NULL;
3 X# w1 N. H9 n
2 Z$ i9 L5 K% Z; z- V- static int acnt = 512;- G* ^( C( v8 ]: B) [8 K
- static int bcnt = 8;
1 ~/ a9 d) N s' L - static int ccnt = 8;
U* ]% J2 {* D" S/ r' A
1 t9 q) u0 O' E7 Z! @0 H- module_param(acnt, int, S_IRUGO);- i, @" o0 T& s8 l& m0 t+ @# g
- module_param(bcnt, int, S_IRUGO);2 p/ A" s4 F& y1 v# g r
- module_param(ccnt, int, S_IRUGO);
复制代码
C! ^1 j, K( N6 f% x* V- y+ G" o( u2 q: ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 P9 j; x0 A1 n) y" G9 a% p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ ~! f9 {& D; g4 C% P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, h$ k( v8 a8 X6 M; W2 N
& e4 Y$ b0 F4 W0 j& m* G" A$ ^" N0 U+ R
|
|