|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 _4 d0 J0 z0 p6 u; D7 l
- [code]EDMA sample test application; _2 _7 u+ M2 E9 O i7 J
- /*7 @ [2 h$ A& ~& }4 k0 P5 [, v
- * edma_test.c
( x( F' h6 Q2 y8 B! i - *
! E3 r1 ?8 B/ F& @* S* k5 }6 K - * brief EDMA3 Test Application9 R- a$ C4 O) s
- *7 [8 O- {* ` Q5 M. U
- * This file contains EDMA3 Test code.
5 Y6 u9 P8 {( i2 k0 `1 u8 n - *
+ | W8 r# S% f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 s8 c% ~5 X2 {, J& j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' D1 \( i. q, d+ ~9 [. \- l9 }
- * TO CHANGE.
7 w& n: s; N( e4 U* K - *) E7 p' h! z, C. q0 z7 j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ u; I2 P8 j: Q9 ~4 s
- *9 i6 U7 U( I/ p6 ]' V% o
- * This program is free software; you can redistribute it and/or
0 ~+ E i3 _3 W: N; ]% U& o - * modify it under the terms of the GNU General Public License as
3 N9 s. k0 e/ _, o - * published by the Free Software Foundation version 2.
* o' R: Y1 |' F8 h, [, M6 ` - *9 ^ s" K6 Q5 q/ W: C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ~1 s+ d3 B% R3 h1 w# A7 }- z
- * kind, whether express or implied; without even the implied warranty X. H0 Q& d, V% X4 D& A5 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
r& }1 g4 w- {0 u - * GNU General Public License for more details.
+ T1 G( b8 W+ b6 J( h- f - */5 S# S4 L$ z6 A5 T- R) |2 u
- * E. Q1 n* ]1 ^: S
- #include <linux/module.h>
* h* d J& }; e1 T5 }! k - #include <linux/init.h>+ @/ f" i+ L3 Y$ n
- #include <linux/errno.h>& f) L. M! C4 Y) }" b
- #include <linux/types.h>
: b: y( V t9 [4 G/ T b - #include <linux/interrupt.h>
: ]0 w, C- y5 x3 F7 ^- E8 k3 f" C - #include <asm/io.h>! C+ k4 G% _5 }4 m$ n0 Q
- #include <linux/moduleparam.h>/ V" r$ n. J0 _ a/ M
- #include <linux/sysctl.h>) q+ _* \( c: [3 w6 ^. J
- #include <linux/mm.h>4 S6 S. C& i5 M5 }" X$ ~
- #include <linux/dma-mapping.h>
8 R& T- L$ U2 z0 ~: M& l - 9 G3 A$ o0 G" j$ A3 _! k
- #include <mach/memory.h>
; [: h4 _" \- A1 U5 M9 D4 F2 r - #include <mach/hardware.h>$ G* `) a; f9 Y; Q
- #include <mach/irqs.h>( W. J7 P5 \; e w( [+ C1 B
- #include <asm/hardware/edma.h>
5 Y7 A/ W* x r. _ - - e* ?9 l2 C9 |; F1 W5 v$ D
- #undef EDMA3_DEBUG
, ^4 `- |& I# M( ]2 x3 j, P - /*#define EDMA3_DEBUG*/1 L( E2 {) |' c9 y% K8 d) X
- - {2 s- a1 R; L! ^8 L
- #ifdef EDMA3_DEBUG3 [+ u3 b& \0 e9 I* J" T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 `0 \3 H" x1 Q. s# z f/ M+ m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 K! u: D% ~( v5 p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! F1 q+ ^/ T0 J8 r: M" c' c
- #else
8 J9 ~7 R* c1 i: x' I# S& T0 u - #define DMA_PRINTK( x... )! F! J6 ^2 s5 U) }& P8 k. s
- #define DMA_FN_IN
2 m$ r7 `7 u' ]5 |" k - #define DMA_FN_OUT
. Q" C) M0 ~. V3 C - #endif' o, B7 e2 u5 n! S
- . l% p$ c0 U5 {6 q: L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' L$ O8 f, I. Z9 y9 u0 q( s - #define STATIC_SHIFT 3. K! G3 k: r+ l+ J7 \' a2 d
- #define TCINTEN_SHIFT 205 q- w2 x. ]5 X) G% T: {
- #define ITCINTEN_SHIFT 21
, I! Q. e% W" a; X) B) L* y" j - #define TCCHEN_SHIFT 224 B( k/ ]$ I0 r3 _7 K3 I8 X) h
- #define ITCCHEN_SHIFT 23+ n4 ~! |% D0 C7 z
% Z! o/ ~( [$ G2 M- static volatile int irqraised1 = 0;
- w8 L# o1 ?, t. ^7 k5 ~, x - static volatile int irqraised2 = 0;
7 |: V$ C. M( W6 w0 D& j' b8 } - 2 B t- A- L( Y- H# B; j R5 i8 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% b6 [8 V# }, a- J) F/ \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# r2 k( T% V" S0 m+ \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 M0 n- ]4 r& T. ~* v$ O8 B
6 O( J( j/ ^" t3 u. l" B" u- dma_addr_t dmaphyssrc1 = 0;$ ?- ~9 E7 V( p" u" k4 w' z! B
- dma_addr_t dmaphyssrc2 = 0;
, K' {& }2 } }2 n( i2 q, j M# [0 x - dma_addr_t dmaphysdest1 = 0;
1 ?# \' ~- N! t) L. o- o" S6 E - dma_addr_t dmaphysdest2 = 0;( ]7 S# J) d( B( R' d5 k W
9 ?5 X3 i. o9 s: j* x5 J: {- char *dmabufsrc1 = NULL;
1 L8 ^' k3 Z L3 w _; M - char *dmabufsrc2 = NULL;# P- {6 w3 I3 E9 h4 H. f1 S
- char *dmabufdest1 = NULL;
$ O4 j1 L: ^/ d( L: Z9 F - char *dmabufdest2 = NULL;
8 w( R6 ^+ ^- h. c" D/ s- \
6 `1 x& Z/ \ V) \4 R7 I S- static int acnt = 512;
; O: e- O! U ?5 d - static int bcnt = 8;
9 ]: L8 i7 O, v1 }- M - static int ccnt = 8;
5 W+ U" g3 W) z, H' m
. h$ D) Q; P J- module_param(acnt, int, S_IRUGO);
: o6 i) _5 ~6 u$ g4 ^ - module_param(bcnt, int, S_IRUGO);
1 b' Z5 B# ]* n/ x8 q, D9 b _" c - module_param(ccnt, int, S_IRUGO);
复制代码 ; c5 \, n: I3 e3 A
5 k6 V1 G8 p& `6 o3 D2 x" r f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 D8 I4 ]3 D" |: q* U' A1 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ~5 k: J* e- O/ B7 f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 M; ?, d9 L. c* f& Z1 `! c
! S1 i& Q# `3 i# a, a8 P$ a" a
# O% M+ k1 q; C, N4 w |
|