|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 v8 F( t7 r3 e+ N0 J
- [code]EDMA sample test application1 H. J' w6 {, j8 M- Q% S" y) B# ~
- /*7 j; w; u7 q( l! p6 [" ?
- * edma_test.c
8 \! V$ |3 c, z( z - *& d/ ~) `2 c- B7 G
- * brief EDMA3 Test Application
6 v5 y+ N' R3 l - *
% q) S" p! X" q - * This file contains EDMA3 Test code.
0 L1 F+ i9 K: C O; N - *
/ R/ r, n- w+ ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ R% X, t6 C6 s8 R, F( W* l4 D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& }* C+ o/ p5 C! R0 R D4 E0 ]
- * TO CHANGE.# p. h& e, o. ~1 O4 m2 M" ]% C
- *
0 U+ Z/ m9 `) ~7 g! T. ~2 Z7 s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 V p! F! I: d9 A/ L& a
- ** h" B- O& D6 y, ~+ q& U
- * This program is free software; you can redistribute it and/or! A7 T% }( n) Y* F
- * modify it under the terms of the GNU General Public License as2 l# X# e, }* T4 u' x4 s
- * published by the Free Software Foundation version 2.! B4 s+ c7 Z( [( A
- *
9 Q4 ~2 W6 H; p2 `% U8 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Q" S9 l& F7 [* q0 `
- * kind, whether express or implied; without even the implied warranty
$ \% |7 `/ {/ z4 M1 X* B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- E5 t! }( Z h3 b; Y& Z _0 t - * GNU General Public License for more details.! b7 k6 G/ D4 u+ b6 d* p
- */
! x( C2 ^8 i; P9 t - ' H0 a- y6 A% E6 i Z; _9 V" f6 l
- #include <linux/module.h>
/ K# c3 W/ T7 M* h; d! Z% f. L1 ^ - #include <linux/init.h>3 X5 ~, y5 S- J
- #include <linux/errno.h>* @7 t5 [. k0 g
- #include <linux/types.h>! I4 \. T7 L6 x! x3 f B
- #include <linux/interrupt.h>4 b4 m3 K5 G+ d5 X. l3 M3 o' l% ?
- #include <asm/io.h>
% U( {4 R5 b' z% p& V7 r - #include <linux/moduleparam.h>
; \$ h* `* \% H - #include <linux/sysctl.h>9 |: |1 [8 Y4 d3 v
- #include <linux/mm.h>3 }9 t' F' }# J, `
- #include <linux/dma-mapping.h>0 v( ]5 B& b7 p3 G. M
, d8 W$ z8 H. P: G0 S- #include <mach/memory.h>
9 L9 O: P9 z+ {+ O. }5 z1 r I - #include <mach/hardware.h>
. J" j+ ]. e6 w I2 i3 U - #include <mach/irqs.h>! [, N; Y! D+ b" n, s( j
- #include <asm/hardware/edma.h>$ w( B6 ^8 G, S) u2 p
- _( u. I3 P1 r) g+ ^# ^1 m0 U
- #undef EDMA3_DEBUG
: e( b1 G5 x0 h Q0 |8 r - /*#define EDMA3_DEBUG*/
/ _) ~3 p4 t1 e# O2 f4 h) ^- F' h! A
% h0 `2 g# j) J9 G( o$ C- #ifdef EDMA3_DEBUG
2 r: a5 f8 g4 M5 y$ X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 Q! ]2 x0 ?! M$ W/ ^; s" ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 B' _8 p; |* M }! Q5 x: ^7 ~/ ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# [$ K; ], Y8 ~ k& I! Y' i% P) n6 [5 t' B# t
- #else' ?. f( u. U3 y- _; @
- #define DMA_PRINTK( x... )
4 h0 f1 ] L4 K5 J! o$ p, k4 [ - #define DMA_FN_IN
. D- I! ^' y4 U3 N! v8 S! K - #define DMA_FN_OUT
3 V' @/ ? p3 A: Q - #endif# q# h( Z4 K9 f
: D1 X. s3 s) K m9 B) L Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. S( V, f0 s H! U5 r - #define STATIC_SHIFT 3
* D: j7 e0 |. E - #define TCINTEN_SHIFT 20
3 P, t) g0 H8 p; U - #define ITCINTEN_SHIFT 21
5 U3 E- J2 w; B6 @; n4 D9 E - #define TCCHEN_SHIFT 22
! e' R5 m2 x* N2 u - #define ITCCHEN_SHIFT 23
5 u& w. c% z5 i1 Z/ `2 a4 |
m" M% |- z, B9 |; [- static volatile int irqraised1 = 0;
% ?4 [( S( U8 @( P2 v s7 T) d - static volatile int irqraised2 = 0;
3 f+ j) `: {( C7 N" Z3 K' i$ t - " F' J' q' X% Q2 ^, G. \( x; v4 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); d: F0 O7 w1 O! r' y( c; _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( v5 W, _! _, V3 s0 j& U8 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- W% C6 \: @* w( d: e3 j
$ D1 }: ?7 a$ g0 z6 A7 h$ {$ U0 g7 l- dma_addr_t dmaphyssrc1 = 0;3 p& n$ u- i( @. ~; i
- dma_addr_t dmaphyssrc2 = 0;7 h; o' v; s0 n5 N, ~/ ?
- dma_addr_t dmaphysdest1 = 0;' w/ x {& C. F& w; K. L! p$ Q
- dma_addr_t dmaphysdest2 = 0;
9 ?) p k. Y w( d' p0 D - 1 o3 L% H1 Q& G7 f' _
- char *dmabufsrc1 = NULL;
! b2 G$ }+ a/ C) r( v# m - char *dmabufsrc2 = NULL;
/ f9 d& v3 k3 I" E, y {/ J - char *dmabufdest1 = NULL;
) M3 M! H' h1 J0 Y4 [& s1 L) k - char *dmabufdest2 = NULL;
8 R' w' A0 J! |8 l - $ S$ } y' Y: j3 T5 i" C
- static int acnt = 512;0 u/ Q' D, c1 r& C
- static int bcnt = 8;
+ a& J1 @$ }+ O0 z: M - static int ccnt = 8;
* L4 K. W, L/ g3 i! x - 6 Y. T6 c0 Q- F5 e7 V
- module_param(acnt, int, S_IRUGO);' m, \4 l/ R0 A9 s! z+ w2 a
- module_param(bcnt, int, S_IRUGO);) [5 q" i$ _( H% O
- module_param(ccnt, int, S_IRUGO);
复制代码 " I4 h. s: B0 `1 _- |7 B R
/ ]" ?* ~! y; X4 ]$ c: t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* ~6 s+ i* `. P7 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 s' P8 J" j+ l" G& Z! U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* v2 C% m, g! Y: `* O6 s3 [- e9 T2 C1 B$ H0 M1 R) U9 @
; h& d/ F |' D' l1 D( @7 V G |
|