|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( L. T1 _6 ^2 i) i, k2 j0 B- [code]EDMA sample test application
6 O. n; [$ |; v" U - /*
1 f1 d1 Y7 G2 m, s* X% r+ D - * edma_test.c) W2 i Q# K$ s) c" T
- *8 C$ J( n4 z0 Y2 R- m
- * brief EDMA3 Test Application% z$ p- G. e( }; ?+ _
- *: |" e! C" B5 F ?' h2 k7 ?
- * This file contains EDMA3 Test code.4 h2 q3 w$ w R* G3 ^
- *1 G2 x0 v1 r, M4 G1 w: r& Z: f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 f. V7 ]: A+ _+ Z( X. t- H% z0 L7 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 c7 k" z j! c0 j' p% q( g - * TO CHANGE.7 Q; v$ w% S, ]8 k2 j( H, e5 o
- *
D" K, @) I8 L6 k/ f7 j4 Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( ?8 q- p0 @, o3 B8 @. Y - ** S9 Q" Q1 P: \$ Q0 I7 `5 @
- * This program is free software; you can redistribute it and/or# b' n0 ~! E& v5 U/ T9 ]7 }
- * modify it under the terms of the GNU General Public License as
& d' }. J5 N) Y; J - * published by the Free Software Foundation version 2.) G; x- p- d* ?
- *& T0 \: y* l, B _! L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 J1 {7 v5 ~, s
- * kind, whether express or implied; without even the implied warranty
2 x8 u+ M" l, S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 w, r( Y3 q0 D& o8 }, s( i0 P2 | - * GNU General Public License for more details.
9 g% h1 f, T- F9 r - */& o& a7 K9 N9 }: [. N9 i/ C. z2 I
8 p/ A- ~/ ] u' B6 p- #include <linux/module.h>6 ?( o- N! K* ^- q) l* D& A
- #include <linux/init.h>7 o6 h5 j- J2 E2 [! B+ s4 V( A
- #include <linux/errno.h>) K" o2 R& ~3 n1 S# {1 [( n% o/ Q
- #include <linux/types.h>0 G; h* g: u G- J
- #include <linux/interrupt.h>
# M: X5 u% Y2 x$ x) W0 s7 \ - #include <asm/io.h>4 G6 Y$ D, N e, q+ R
- #include <linux/moduleparam.h>& G, d9 g" e1 P$ }; F
- #include <linux/sysctl.h>
; _) z3 t9 F9 K3 J' U - #include <linux/mm.h>% z8 E: @0 S( Z; i
- #include <linux/dma-mapping.h>
: g4 H) {8 Y/ e# w, v7 A - ! ]7 s8 X. }8 g8 M. U! K
- #include <mach/memory.h>
$ a3 Z; |5 f+ L- N" ]; G - #include <mach/hardware.h>
7 W% v3 i9 q6 ^2 Q - #include <mach/irqs.h>
4 A9 \7 \2 p# p' }: w; M' I - #include <asm/hardware/edma.h>
: W1 B3 e- @- z7 S
) s( f$ l9 c" g0 E- #undef EDMA3_DEBUG
0 U/ c' u0 p. G - /*#define EDMA3_DEBUG*/
! l. p8 t& q# z/ G1 H
: m3 h- }5 v! O( `- #ifdef EDMA3_DEBUG
7 V/ j* Y. C0 p& w8 A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- g" Q! P b* P8 F7 N9 ~2 L4 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ @! M6 e; J" O ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 V, e7 e3 f! c% A" h - #else" t3 ~0 H5 E. C f' D
- #define DMA_PRINTK( x... )
1 W9 a0 i% G9 t - #define DMA_FN_IN& B g; }. X) u
- #define DMA_FN_OUT+ X% E( @3 V( Q% y( I+ A
- #endif2 g4 A1 _& J6 o* g8 V R
* D5 g% G0 n0 o( U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- v! H" U! Q/ K, d, a& D; i7 m - #define STATIC_SHIFT 3
3 W. f" z- g: S. B' G- L9 }+ E - #define TCINTEN_SHIFT 20) L! d* ?9 }* Y- a
- #define ITCINTEN_SHIFT 21
% s5 r4 g: d2 o1 b' @- K - #define TCCHEN_SHIFT 22
- [$ ^6 r; p; ?8 x) e; v3 q4 S3 S - #define ITCCHEN_SHIFT 23
/ h- ^# X5 \- k5 t _! L
& S! J' V- E: C; E& j' l) A$ n- static volatile int irqraised1 = 0;
- o' W4 r7 R, d' G% G& S - static volatile int irqraised2 = 0;
" `* A, m) i; b9 p7 L6 N - $ w4 V) n+ h8 o, o) A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" j0 ?4 X" T, j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i2 K {4 r1 R" c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! k7 c5 o) E8 l5 e0 C Z - 6 S n( h' M& `
- dma_addr_t dmaphyssrc1 = 0;
/ g" i) Z; w% P8 u - dma_addr_t dmaphyssrc2 = 0;0 |# j( U/ u' a# T2 P
- dma_addr_t dmaphysdest1 = 0;+ L" q) ?- V9 Z% L$ ]* S
- dma_addr_t dmaphysdest2 = 0;
" j4 W f, K, L/ z - 4 R! b ]/ O' p: r! x" L! y8 j
- char *dmabufsrc1 = NULL;
; S9 ?/ w" z& K% ~* } N) D, ` - char *dmabufsrc2 = NULL;
/ p! U* N; c$ e6 M; U - char *dmabufdest1 = NULL;
0 t3 y' n1 ~6 ~4 e+ T& L' A, R2 c - char *dmabufdest2 = NULL;
c+ \' I8 R0 V - 5 B, L- z% r$ H( [( R5 Y) W& D
- static int acnt = 512;
) X& `" \( E, m4 J" r- a( F% k - static int bcnt = 8;
( V* B0 @6 [' R; O% C0 J2 y - static int ccnt = 8;
2 T( F' @4 \0 l4 _! t - 8 K$ [* z$ K/ Y
- module_param(acnt, int, S_IRUGO);
5 F) Q4 | @: `0 h4 D0 @ - module_param(bcnt, int, S_IRUGO);
' Y1 `0 L& j( E. u) P - module_param(ccnt, int, S_IRUGO);
复制代码
$ m$ }0 t+ ]& h9 R4 D# u. r& @$ U. R5 L# g8 S: d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. K7 k) g# I) G9 u) b" U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# u3 ~" H m3 C5 m+ P. ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ~. C6 h, r% @0 m: f
! l) R' g% P5 n; V& C7 S o5 b6 H
3 R/ m3 B, P$ ]) b |
|