|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) f" d1 h$ x: N, L- b- [code]EDMA sample test application
" N) ], s4 P6 y1 X' _ - /*
: P% k# C: K. ~3 h& | - * edma_test.c% R( L6 W: U5 M' ^
- *
2 m9 y) i( |+ f; S( |, M$ |6 w9 x - * brief EDMA3 Test Application+ @. ?8 A+ u; J( h+ K
- *
/ d1 E& d& g9 o2 ]7 @- R( ` - * This file contains EDMA3 Test code.
7 g8 L$ ^7 h, F3 E2 D - *
7 R. v8 ?/ J! E' w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) j, L$ U# w! A4 m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% Q4 c0 W, ^' e. T. L! S- `5 G9 r
- * TO CHANGE.
% F$ b# E! `7 U( z - *
+ y: z, `& {9 U' ^! ]# g: v6 \; { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 X6 s+ t( U* l - *
8 V( j! D$ @, o - * This program is free software; you can redistribute it and/or
) e$ C Q! `2 X) {( L - * modify it under the terms of the GNU General Public License as
. l) K5 ~4 X$ U: j s$ V! G% e: e - * published by the Free Software Foundation version 2.$ d, q! a- h: q1 e7 i
- *
7 |, b2 x: w( W# ], a5 C: P" @- d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 i+ i' Q: C6 I- j; n
- * kind, whether express or implied; without even the implied warranty
) W" Q. {& R4 L- D6 l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 n( A6 ?. Y- g% ~ - * GNU General Public License for more details.
% J' ^) ?# Z9 ?- i% y8 T9 R6 A - */7 X0 I0 q! L/ [/ P0 U
! V2 l! F6 U9 m% X; X- #include <linux/module.h>0 d' H3 T0 A; j: ^9 e$ y3 {
- #include <linux/init.h>5 S, h) ^9 _1 H7 o: a
- #include <linux/errno.h>
6 C0 S6 j) w' G: }) z( x7 V' d( F - #include <linux/types.h>
" L) P" r8 L1 x3 u. |! b% x: g. e, T - #include <linux/interrupt.h>
l% p' Z* Z% F' k - #include <asm/io.h>
7 U% [2 ?! N: E; R3 ] - #include <linux/moduleparam.h>% T* P$ Z& X* M) Y0 |6 b
- #include <linux/sysctl.h>
: z }4 J. ~: `7 W - #include <linux/mm.h>
: B+ K% L( l2 W, { - #include <linux/dma-mapping.h>. K8 g* N2 i% E. |* w% j/ l9 F
' p) Z- L* H) I% i0 R3 Y! Q! |- #include <mach/memory.h>
7 h3 m' G' a' a- m - #include <mach/hardware.h>% r/ ^4 f' E. Y, \
- #include <mach/irqs.h>6 H: X/ c9 l' K- K6 y: U G# J \
- #include <asm/hardware/edma.h>+ A; u9 ~. E t6 L8 n3 K/ O
. `# D/ n! h [- {* g: P. L2 j+ L- #undef EDMA3_DEBUG
7 s; Z- p/ a0 E6 M+ h - /*#define EDMA3_DEBUG*/4 L E* T9 I n( _4 F- I2 F9 _: k
/ K+ f) r+ \8 q" Q9 L: ^- #ifdef EDMA3_DEBUG) Z3 a) C6 e3 ]) {- D7 V' Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 t7 ^' L& i1 d6 M0 J1 N3 D) d& K( t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) c% ~2 N9 ~$ V& D# V7 F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 x+ }! X2 C, `( n+ A - #else
; A! _- G8 f( B% x/ g - #define DMA_PRINTK( x... )+ N3 S( [# E' P
- #define DMA_FN_IN$ s3 a1 o' P: o
- #define DMA_FN_OUT
& U! _* j; M8 L - #endif9 P9 J6 `( Y( }
- 6 m. w) ?, A9 H) k5 v- m$ _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 K# V9 v5 X5 e( K
- #define STATIC_SHIFT 31 o7 P1 |& g" O1 q! d6 J" x
- #define TCINTEN_SHIFT 208 ]% I1 `& J' M5 o( I( R8 M! z
- #define ITCINTEN_SHIFT 21
2 x( g! R& V$ z) ^% }, T - #define TCCHEN_SHIFT 227 h {4 A! Z" J |5 X1 B
- #define ITCCHEN_SHIFT 23
1 x; h" {" @, _* U
7 h7 N- I: w& z- static volatile int irqraised1 = 0;% v; |+ H( O9 p7 y% H- n# u
- static volatile int irqraised2 = 0;6 ^% c5 }/ Q$ T7 S' ^; |7 B
- 9 y* R2 E! \ ^0 X# @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v9 O( W9 O# ~/ l4 q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! [4 ?0 a, {2 E# i9 ]& } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]! V2 j2 S, O, o
. m1 p5 o5 X3 V$ ^" ?: m; w- dma_addr_t dmaphyssrc1 = 0;: s/ L8 X+ _( P0 J1 Y( _
- dma_addr_t dmaphyssrc2 = 0;
) Z) ^- Y! i6 D6 y2 { - dma_addr_t dmaphysdest1 = 0;: _9 `- z. i( S5 A
- dma_addr_t dmaphysdest2 = 0;; E I" K) N2 C
" `) {" O( i* v1 c: z$ @2 ?- char *dmabufsrc1 = NULL;) K% X' @6 T e/ u* A# A+ h
- char *dmabufsrc2 = NULL;$ y/ M* x( p7 [( r6 C
- char *dmabufdest1 = NULL;! b+ D T; o# W% G# f
- char *dmabufdest2 = NULL;
8 _5 y. K- H# |* z - . ]2 k% X g5 c9 c) k0 P, P
- static int acnt = 512;8 l' g+ J4 L4 F
- static int bcnt = 8;4 R' q% o8 _) Z+ l! k
- static int ccnt = 8;
: S' @2 F& s3 U; {
$ W1 E9 C3 {( v* v- module_param(acnt, int, S_IRUGO);
# T3 ^0 _' P( |; \" O b6 K - module_param(bcnt, int, S_IRUGO);/ o ^9 |) l3 M3 u3 C5 E% R
- module_param(ccnt, int, S_IRUGO);
复制代码
4 z1 [, B4 d0 |4 |! W5 S
3 v0 T% g/ S4 a, c5 s. Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: y- X; I4 x2 |4 Y7 U8 n/ I9 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 M( u1 {# L9 t1 H3 A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% E: b) P% I2 m5 E6 Y. [% ]
2 b/ D8 N8 W H9 I* ?; W1 Q
! Z, J' p* H' _ |
|