|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" ?( m+ K# ~+ |" \. a/ Y+ N- [code]EDMA sample test application" o r, N1 l6 e6 o0 T7 N
- /*' O0 @" V0 \$ V2 W, x
- * edma_test.c
( A0 ~ r2 b2 m( v5 d$ P7 o - *0 N0 N4 M9 u2 F- x6 ^/ ]
- * brief EDMA3 Test Application" I/ A7 l8 a6 Q$ @3 Z N0 R
- *
3 U0 C2 E$ `' v1 d. F; p- X" I# M5 I - * This file contains EDMA3 Test code.
8 v$ P1 j( z1 `. z& W" s+ \% N$ R' k - *0 A, S! I7 {+ H/ f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, U6 j; a" v. T( m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( D) h& F1 S' s; m8 v - * TO CHANGE.
" M1 }$ P( \3 w! } - *
- c R; {( R) } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ I: x O# S; t: {% Y
- * q1 A9 [! I ? i) X9 z1 j
- * This program is free software; you can redistribute it and/or
- x& p. j+ X9 R- M - * modify it under the terms of the GNU General Public License as
3 ]8 L' k K1 ^ - * published by the Free Software Foundation version 2.. h1 J p: s6 |8 y7 @' l
- *
. f2 u2 [ c( ^0 Q+ G j: m. T+ ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# s E+ z4 z$ S7 ]2 w' u - * kind, whether express or implied; without even the implied warranty
. q% }6 o0 z1 c/ j: F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 T- K0 q( Q. l( Z/ a
- * GNU General Public License for more details.& f/ q( R" b7 Q9 |1 l* |+ ~
- */" c2 b8 v' p; W5 M/ z: P- x1 g
- 0 `9 Y1 F' M% w( v2 D) k
- #include <linux/module.h>
& ?( S! M. i" k6 I - #include <linux/init.h>7 @% V# N5 M$ p6 M& b
- #include <linux/errno.h>
* C. Z/ Z0 }6 S - #include <linux/types.h>
9 g' u' Q( u3 a( r+ P+ c; ^% a/ k - #include <linux/interrupt.h>
2 O% q, k1 f/ k" ?0 T - #include <asm/io.h>4 _0 @7 |) P4 M) t7 N
- #include <linux/moduleparam.h>
0 R1 m& t3 ?% A0 C - #include <linux/sysctl.h>/ G9 v4 u3 _8 \4 @
- #include <linux/mm.h># N5 ?5 j0 B$ m1 D% \6 j$ Z: c
- #include <linux/dma-mapping.h>1 w% h% B% g3 i7 ?& g+ [
/ M* v$ f* y5 I% h z6 f0 O2 i- #include <mach/memory.h>
8 ^- {2 ?5 U9 `: E$ _( X - #include <mach/hardware.h>* m$ U7 {2 s! I1 N7 v* I d
- #include <mach/irqs.h>
* K! x3 {- F4 [( ~$ M - #include <asm/hardware/edma.h>! i: u& o( P- ^4 L1 T: M6 f
- # }* a i! F* s2 K$ N
- #undef EDMA3_DEBUG! x4 [7 [, G8 l8 O8 I4 A% m
- /*#define EDMA3_DEBUG*/
6 ^* @# r _7 p" x - 1 s, q- T4 w" o; W' C2 ~
- #ifdef EDMA3_DEBUG
# F2 G/ B) z/ C. B+ ?& j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ s5 I w8 z( Z2 Y8 ?3 a5 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( S- t6 {$ T5 \6 t/ p" y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
x8 s9 w9 b( ?. Y I2 m9 y% m - #else+ p$ w( @; q1 ?8 K
- #define DMA_PRINTK( x... )3 L9 n/ h: o3 [: K
- #define DMA_FN_IN( W( D6 w/ r: n1 I2 A
- #define DMA_FN_OUT
4 {6 K) q. b7 m6 T1 X, y - #endif1 A& m% \6 T S. e1 d* Z- y
! [ I( P+ o4 r+ Y& v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& T& y! }+ W# @+ D& _$ o - #define STATIC_SHIFT 3* s0 c& F: k4 Z7 \
- #define TCINTEN_SHIFT 20
/ {8 a! a- G8 _+ x7 z4 ~- M; v - #define ITCINTEN_SHIFT 217 a8 m( n9 c2 S L7 q2 p$ V& {* ?2 F8 x
- #define TCCHEN_SHIFT 22
# `3 F$ O0 V4 z( K B5 g( d - #define ITCCHEN_SHIFT 23
* a, v% F8 o& @8 G, O7 _ - * N" S ^* @' j: _, o0 n$ S
- static volatile int irqraised1 = 0;
9 `' n. r+ i; G4 x% L - static volatile int irqraised2 = 0;* o" o# ]4 T2 j) U/ X: X
- + ~5 l% Z( }+ g9 `" o4 @* S( Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) B: D3 _; V. G. T$ [$ \/ p# Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
_2 Z% u9 J. ?6 r7 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: m+ M% M0 @* W5 w5 V/ q3 \
' B- A4 `8 g' f! N: W Y T- dma_addr_t dmaphyssrc1 = 0;
[% P, g$ ^2 ~0 T( {! A0 N - dma_addr_t dmaphyssrc2 = 0;
h; q1 s: Q* ?3 C - dma_addr_t dmaphysdest1 = 0;
+ P: C: F3 Y6 ]+ |) o - dma_addr_t dmaphysdest2 = 0;
( g" a- X2 S7 |1 x8 \ - / ?1 l R6 o H+ w: E
- char *dmabufsrc1 = NULL;5 m* m5 z; o+ @3 Q/ D* d( H, z
- char *dmabufsrc2 = NULL;* ?* P- ~" B6 X3 l: [) l
- char *dmabufdest1 = NULL;
1 [ i& O' c7 g% z- x1 F - char *dmabufdest2 = NULL;
) i' m- r @. e+ x n - . Q; @2 {# @* j
- static int acnt = 512;/ [# e7 s! I3 h
- static int bcnt = 8;/ n8 w/ o$ T5 ]
- static int ccnt = 8;) z4 \. v/ q/ n" p3 `
; J# K( c3 o1 G2 w: n- module_param(acnt, int, S_IRUGO);
& Z* `, }& H% w! O - module_param(bcnt, int, S_IRUGO);) Y( F. x, x P" O, ~: p
- module_param(ccnt, int, S_IRUGO);
复制代码
" A% f( G4 z1 Z7 G5 ]5 S9 A- |% Z# {6 k, x% ?5 Z* b* T* z0 r( @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ E+ ?$ v& y9 Q3 X5 O/ {* ~, {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) U- M, p# L) r7 q# Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( V: ?! z( l: l( ?3 b# J' J3 f, q ?7 I! i7 m0 h
8 l2 d; o0 t& ~) A
|
|