|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ h( p1 t6 E6 D1 M- [code]EDMA sample test application+ E" q; v K* G" z
- /*4 L; W+ D* ^& n# |9 h
- * edma_test.c
) @. V4 e: f1 t9 p* n - * g1 C( D* X7 [. Z% F2 R6 @/ o8 M& O
- * brief EDMA3 Test Application8 q5 M8 G: p2 a5 n; m
- *
& G' `. G, t: |: h% J - * This file contains EDMA3 Test code., v$ o7 ^ q! O' a
- */ ]- t* h% v% B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 k" H- r3 Z+ }0 z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
Y9 }4 r1 q* `3 N - * TO CHANGE.
5 u8 V0 r6 h6 z- J8 \ - *" S/ x! y. V2 M: m9 K9 Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 K4 I3 E8 ?" @
- *
! f) a2 K& }) N' f t5 s. z0 T; b - * This program is free software; you can redistribute it and/or
& n/ u3 u3 N3 ]' S - * modify it under the terms of the GNU General Public License as
/ p- l- s Z9 V I* z9 @7 Y - * published by the Free Software Foundation version 2.) f9 |# _# g" ^2 i D; b! K$ y4 f+ N
- *
" T# J( S2 @0 |. n; e2 G6 M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 ~2 ^, \( e) h) }5 p
- * kind, whether express or implied; without even the implied warranty" f6 M O* R L' d$ }. F0 a$ p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" B( E; n- V0 t0 @- e: G0 H
- * GNU General Public License for more details.
, T- i) k/ Q% y! p6 ?! ?) F8 E - */
1 S4 ] y ]$ V8 _4 W; D
4 M( S" |- Z! k- #include <linux/module.h>
* x) P, [& v; G; }# |+ i& d0 } - #include <linux/init.h>+ J9 D0 G) Q5 {
- #include <linux/errno.h>% w( r8 u. H+ b/ j$ K# x
- #include <linux/types.h>
" t' T Z( q) C n - #include <linux/interrupt.h>
' K9 u" [. j0 h- G, [* H( x, [ - #include <asm/io.h>6 R5 e# T, Y9 i
- #include <linux/moduleparam.h>
! X5 e8 |! y! x. x - #include <linux/sysctl.h>2 ~. {3 I8 m! _+ V% K' v6 t( H9 N3 m
- #include <linux/mm.h>/ F( n* z4 e6 e/ M: m
- #include <linux/dma-mapping.h>( D2 N' [) X/ G- ]6 |
- 9 z# @7 I2 S* x: S0 [
- #include <mach/memory.h>" f& H* ]& B o3 h2 D) r' g d; [
- #include <mach/hardware.h>5 L+ H+ H1 \& U- [4 X6 n3 @9 i+ D+ L
- #include <mach/irqs.h>
% I8 c8 T/ }& y* X Q; e4 q. M - #include <asm/hardware/edma.h>; S6 @& V+ k) D, {: q# v) n
- ' w$ A2 A1 Z4 i' |& V2 L3 \. e" F U
- #undef EDMA3_DEBUG
5 Y1 i5 r c2 v* t) \' q; A - /*#define EDMA3_DEBUG*/
8 } ^+ P; B, C ~# N5 l - 0 f' \& b3 M# I+ J/ W
- #ifdef EDMA3_DEBUG) _! l. E! ?8 t7 [# \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 g0 P8 A1 v) r# c) S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
j7 y$ f4 s& d- t+ E9 r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 v: w8 r8 H1 W8 y2 h _
- #else
2 S5 s' ~; R; n' q! k0 d/ q9 x - #define DMA_PRINTK( x... )
( T1 o0 O/ W3 @7 [7 \6 A - #define DMA_FN_IN
3 S5 X0 a V" {! J - #define DMA_FN_OUT
/ [& M9 `& z/ i" Y) j1 n - #endif: {% J% T7 ~. A r- r. @1 M' \. A
- - e: ^! S+ v5 g7 V: w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 a4 Y* C8 s) }2 V$ O/ ^2 R8 U- C
- #define STATIC_SHIFT 39 H. d6 L4 r7 w' q0 V, x0 y* o
- #define TCINTEN_SHIFT 20& O' r P; N, L* g
- #define ITCINTEN_SHIFT 21
7 ]# `8 C3 _1 A8 p; O& V2 ^ - #define TCCHEN_SHIFT 22" d7 x) k* f4 L- V& m6 q* c
- #define ITCCHEN_SHIFT 23
^0 v m2 [: N, r- n) F6 O2 Z5 i/ L - ( `$ a4 |: c4 f2 X6 n
- static volatile int irqraised1 = 0;3 `7 w" \" Y, `& D
- static volatile int irqraised2 = 0;: t7 s E! d$ o! c" G
- % F3 h0 [- I. u2 ]7 k# ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Y {6 A! ~7 S: H, f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, F' c E5 f, e0 @ p" {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( X) ~7 B9 [1 p8 f3 U, J% D3 |
$ G/ R- |) [' m3 Y* ?4 u0 O2 A- dma_addr_t dmaphyssrc1 = 0;
' S4 e5 D \# f5 O! M, j - dma_addr_t dmaphyssrc2 = 0;4 u+ b: ?6 e9 @! [; k0 } o ^
- dma_addr_t dmaphysdest1 = 0;4 S7 N' l# b: R" }
- dma_addr_t dmaphysdest2 = 0;: i$ P3 L: v! d7 |# B0 P( c' l
- ) h: e) K, @$ q5 q6 e4 K2 z$ @
- char *dmabufsrc1 = NULL;
- t+ s$ D# s. N2 ~ - char *dmabufsrc2 = NULL;; V. S3 h! j) m! J* O
- char *dmabufdest1 = NULL;# @4 h N. @% V, z0 j" U ~
- char *dmabufdest2 = NULL;5 W% M3 y& B$ q$ y3 ^) i+ e
5 F9 ~+ d% z9 K% w. o6 x- static int acnt = 512;7 R$ l. s3 h* W, B9 _* a q h% l
- static int bcnt = 8;0 d6 _) Y" e W7 z! ~4 B
- static int ccnt = 8;* i7 c$ m/ C. @' E
$ g; r/ w, l3 ]7 M" V- module_param(acnt, int, S_IRUGO);$ W' q z2 X! S% Y' E' p" z
- module_param(bcnt, int, S_IRUGO);
1 l* P" v; P/ }1 a - module_param(ccnt, int, S_IRUGO);
复制代码
0 J, M8 \. ?( E3 t7 W' ]0 y5 W; b8 F7 e+ g( T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. C+ S a$ j6 u5 |6 n6 f, `3 y! x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* _: m- o2 z- d5 C/ A3 M3 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, v& h; J# P1 f% V, ~ z" K4 j# x( |& {
+ }0 g4 a0 V1 Q7 l
|
|