|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( _* }: I" e2 n5 ~. U5 @, \ U# Y- [code]EDMA sample test application
( ?% a+ t$ W% t& u - /*
0 h& F6 d; `" e, U. p7 @ - * edma_test.c) m+ G8 P# ~2 K
- *$ ~4 t8 s$ ] t! F
- * brief EDMA3 Test Application4 ~0 D: E3 x0 P+ p' h1 Z
- *5 K1 o1 `! X) |5 k
- * This file contains EDMA3 Test code.
$ r7 F/ W' j o. r. S1 ]* p/ S# g - *
& p+ j1 l( T3 {6 T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& o$ D F8 q3 N" z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; V& B5 G/ R7 S/ |' E& h: w, I
- * TO CHANGE.4 @( ? m6 V( u1 v
- *- y& W( F0 ]1 u2 s( Y: v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 B1 N; {5 k* a - *# @8 y% ]+ w& h' J0 Q2 a1 |
- * This program is free software; you can redistribute it and/or; U8 S! z1 ?) ?% [' X' m
- * modify it under the terms of the GNU General Public License as
- v+ Z7 A- i1 M9 C( e - * published by the Free Software Foundation version 2.
3 q& |5 V3 Q; A/ x6 Q2 p* J7 [ H4 J - *: |& s/ j' q! T8 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ r7 _. t5 c- h T1 J* r- Q - * kind, whether express or implied; without even the implied warranty9 A7 Q- D8 ]! a" E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; ~7 D/ n( A% c' r* W* k0 [4 p
- * GNU General Public License for more details. h" O( c) h$ N) i% S$ u
- */
2 s& p% f& s! K2 ^* C! s - ' X6 j" i+ B0 U. f2 O$ j
- #include <linux/module.h>
" I, E- P( d. X% g0 S' w4 C0 A5 i* C - #include <linux/init.h>- h0 i. F8 C3 Z
- #include <linux/errno.h>
0 Z5 V1 V9 u7 a$ }7 V- p - #include <linux/types.h>" e: n7 Q8 w9 l7 |. X; C" |
- #include <linux/interrupt.h>8 e O5 q& t8 V4 R
- #include <asm/io.h>+ f: h5 s! N7 ]3 ^
- #include <linux/moduleparam.h>9 |6 a8 \' w- f) { N
- #include <linux/sysctl.h>
. _) c6 p: u9 ^# {7 J5 ` - #include <linux/mm.h>
$ A% L g1 `! J* b6 I - #include <linux/dma-mapping.h>2 A, l* R7 {7 d0 a, E; S
- 9 c n/ m8 v, ~! K- M: Z
- #include <mach/memory.h>2 a+ Z6 F8 S ~# f
- #include <mach/hardware.h>5 U6 Z1 a! u% O+ E4 X$ {1 h( b
- #include <mach/irqs.h>5 K0 n5 `) b7 t4 @1 {% L( o; l2 V
- #include <asm/hardware/edma.h>
0 l& Z! E% I1 U0 {" ]$ O
; A5 f* ]$ a: u- #undef EDMA3_DEBUG b) W4 J( w8 ]1 s9 {' x6 X A# n
- /*#define EDMA3_DEBUG*/
- v9 W! J. L+ y! [ - 7 z1 R+ a/ }6 m; G' x( }, _( p
- #ifdef EDMA3_DEBUG. w5 A& M5 K# L% w3 [1 g' B6 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- C. z2 @0 |! A. J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" U; r9 E" w$ ]5 G( W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& z# A3 A' _% ~* p4 @4 o
- #else% f- y6 | P8 s/ V
- #define DMA_PRINTK( x... )
+ _$ y+ ]8 [! c2 S4 g# W& ]4 g - #define DMA_FN_IN t6 h. s: [; {1 }/ r$ ^+ ~
- #define DMA_FN_OUT$ D# t0 ~2 ^5 q( s& h( k
- #endif/ e! r! T" M# w3 \/ l; B+ Y
- & x" f3 R% F5 I2 e0 `; u) W/ G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& v6 h! Q M* p4 O7 @: | v
- #define STATIC_SHIFT 3
% o! D M- W1 ]5 w+ e* E; ] - #define TCINTEN_SHIFT 20# v) V0 N4 a4 K1 ]
- #define ITCINTEN_SHIFT 21' h' N% Q1 A+ _0 L7 g( \) s4 c
- #define TCCHEN_SHIFT 224 N5 U7 K# c) V1 S* w) G; t
- #define ITCCHEN_SHIFT 23
. G6 {7 `, \. Z3 J9 E' h, {4 S& \; h - ) O3 H0 x' K+ ? E
- static volatile int irqraised1 = 0;( P7 s* }# I% A
- static volatile int irqraised2 = 0;8 k# n' T% W% k9 E
3 G( }0 V9 q# Q' \- \; J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: `+ K4 O* v3 {. Y* Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ T/ N9 ?$ w3 }' I4 K) I; [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); }3 v- C0 M) x4 W; y3 H
- 2 q/ m+ o: e1 L4 N% g
- dma_addr_t dmaphyssrc1 = 0;- Q) I- L- }8 Q
- dma_addr_t dmaphyssrc2 = 0;
/ U4 d3 W# Y$ i. Q2 X# l - dma_addr_t dmaphysdest1 = 0;
( y3 d: ^, @* |" `2 h- ?% i - dma_addr_t dmaphysdest2 = 0;
) e) v, ~/ A) K7 v2 [
/ }( ^' s2 u9 o- char *dmabufsrc1 = NULL;
. l0 z+ t4 m, V) J$ A - char *dmabufsrc2 = NULL;
. p& n; s3 ~" |* p9 y+ l/ s! L - char *dmabufdest1 = NULL;4 l9 ]: F2 I8 u
- char *dmabufdest2 = NULL;
T7 ?( j, _) u' ]. i" }0 V: o# W
$ E7 R i" Z' a/ @9 T7 d- static int acnt = 512;
% B- H# W% X( g! p% \# j8 F ~ - static int bcnt = 8;, S% E* U* y1 Y# x7 K
- static int ccnt = 8;
# U# `1 f3 b. G* W& c1 z
: f; W/ ^4 q- v- j; o! Z- module_param(acnt, int, S_IRUGO);
9 ]$ |( q T# S9 g8 b: G - module_param(bcnt, int, S_IRUGO);
/ C7 w; h; G% U0 H* V7 f4 v# J - module_param(ccnt, int, S_IRUGO);
复制代码 $ D. ~9 T: x* b4 e
. m6 ~4 [2 Y |, ?1 [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% X) b( o' m) n0 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( _" x* e0 ]. F5 H: e" k6 `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 Q P' }' y- }! @7 n
: g( O9 P1 \- @ ?0 @1 C9 N
5 w! ]* V) |4 _$ l5 u |
|