|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! |5 v/ e, J, z w/ N
- [code]EDMA sample test application
8 L2 J3 ^( i3 g8 u. l! _4 X - /*# F; N$ J) K; I( [2 T1 g5 F0 E% H ~
- * edma_test.c! _! ]) c9 w; g z2 i5 B
- *
$ F4 g! ?& U+ C) L* M9 }+ R R: U - * brief EDMA3 Test Application& p+ r4 S& p2 C& E/ z- c$ s2 x
- *
+ {: v m( G8 i1 H0 q1 s - * This file contains EDMA3 Test code." u3 V0 ~: Y3 T( X. ^- v
- *
; A6 g6 R, O2 n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 s( U, Y G; h }' ^3 b3 p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: E' a% u6 H* U4 c" g0 Q" d
- * TO CHANGE.
( N% b% v' G" J Q* T( r4 `- ^ - *
& ~9 R! ?7 c$ _ f4 L% P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( {. a- t/ Y# G$ ]! a2 }" B
- *- h- Z# b$ b/ N* m+ v: T7 } k
- * This program is free software; you can redistribute it and/or
8 \. P, b& s v1 {! g1 a# ~8 _ - * modify it under the terms of the GNU General Public License as
' {2 B( I; ?/ k0 Q# F3 U" D5 H$ h - * published by the Free Software Foundation version 2.) s: u7 p( s) a! {. ~
- *& V: L1 @6 v- P7 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 \/ ~; ?/ Z5 ^ Q* g5 g - * kind, whether express or implied; without even the implied warranty
5 {+ P2 B3 A) E# {- b2 T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 c# E" Z' Q) x$ f1 H4 R, }. q - * GNU General Public License for more details.0 s V8 ~$ s. c$ m5 K6 U
- */- f E' t7 O$ K9 q l a
- / l- _9 V0 B! ?: q# j
- #include <linux/module.h>
8 y9 Z# u" E9 o1 H) _$ r+ V4 s - #include <linux/init.h>
0 M9 _0 \! ] h5 p - #include <linux/errno.h>
" q T4 _9 T! f9 X( F - #include <linux/types.h>8 z( z+ K W, J% p2 ]: F" b+ n
- #include <linux/interrupt.h>
+ B4 I: O$ s% B1 e# j! o5 t - #include <asm/io.h>
# H* [) t7 _- J8 E: W - #include <linux/moduleparam.h>; \! Q8 d! ~: P, l' w0 N6 p( b/ w
- #include <linux/sysctl.h>1 [- Q+ u) P5 E" F2 A
- #include <linux/mm.h>8 Q8 w: [% J0 m0 O! N* B9 F
- #include <linux/dma-mapping.h>
1 j: i6 g0 K) M; _0 N - 6 j! _+ B; Z) ?- X! v7 f S: x
- #include <mach/memory.h>
% ^) |5 D, h& Z) s3 q; ]- O4 t! Z. O - #include <mach/hardware.h>
; P& `/ B% t! N6 v - #include <mach/irqs.h>0 y% E1 p. D6 `2 w' s4 p, }
- #include <asm/hardware/edma.h>/ e" h) @1 }6 {% o
- - v: ~2 @# X' ^
- #undef EDMA3_DEBUG
! M% f: J, a% v0 E" }& s - /*#define EDMA3_DEBUG*/8 @. _0 d' C( ?0 b; v! c
: W P1 x! {1 K! V' g- #ifdef EDMA3_DEBUG/ Z7 w0 J2 h2 b" s! v4 L8 Q$ N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: }3 e* H' B$ A) ~1 T8 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* g1 V" L: m. f! [& P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 }5 P- \( h! Z) Z
- #else" u( U2 q% C4 S
- #define DMA_PRINTK( x... )
4 A& q+ x0 f ?5 y2 x, V. _ - #define DMA_FN_IN# R7 f% ~5 H: N1 C) r
- #define DMA_FN_OUT% [9 V P+ I7 O5 `: j' _& W% p m
- #endif
' | u9 z' f$ z/ j& X8 f - # u8 ?6 ^5 h# F4 h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ R: M5 p9 d8 C8 }, @* I/ ` - #define STATIC_SHIFT 3
* z; c8 O4 Z9 H: ^- m' V: a. O- ` - #define TCINTEN_SHIFT 20
* r# y3 C' z# i7 s - #define ITCINTEN_SHIFT 212 d) f0 u3 ?# ^2 v
- #define TCCHEN_SHIFT 225 A% @ @% b. }/ ^' q) t: X' I& k
- #define ITCCHEN_SHIFT 23
7 Q' `2 v3 _4 |7 N: r) s) r
( T9 H5 W; P4 ` W- b- static volatile int irqraised1 = 0;
% x, Z! ]0 ^8 @: S4 Z# H0 r3 f+ p - static volatile int irqraised2 = 0;" {5 t+ z3 Q5 R4 [
1 Y& ~+ J- j3 s$ q1 @2 c( o3 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ?, M l9 L; B# @) H6 R$ d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& \ I. N- b4 I/ j5 H& w5 e2 [ h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- e1 [; Q+ B) B: h. R
. V* |' z) S, B6 l4 h3 ^- dma_addr_t dmaphyssrc1 = 0;6 Z% V$ B! O: A8 D7 B, `% D0 g
- dma_addr_t dmaphyssrc2 = 0;( f5 a! O2 e( w7 I! ]
- dma_addr_t dmaphysdest1 = 0;
, \% P1 k6 S! _2 B; r+ I& {8 G) w - dma_addr_t dmaphysdest2 = 0;: V+ J& l+ D# x' W+ ~- H
- 9 u" l; w& _. T" }. o
- char *dmabufsrc1 = NULL;/ I- {: D# h' k
- char *dmabufsrc2 = NULL;% T/ [7 y$ q$ D' r2 O; [" I
- char *dmabufdest1 = NULL;
6 N+ J1 e- g' d- u) j6 r) E - char *dmabufdest2 = NULL;
7 k5 n L( [6 K5 ?6 u3 Q - 1 \5 L7 _( R0 q7 {
- static int acnt = 512;
2 a7 n" P$ V( E7 \ - static int bcnt = 8;: c' v4 x( `' {0 z7 q/ J4 L
- static int ccnt = 8;
- P. w% Y; r* g# V - ) A) [, x3 e. h
- module_param(acnt, int, S_IRUGO);
7 L2 z! k8 _( U8 F1 a) ` - module_param(bcnt, int, S_IRUGO);, F" O% ^1 L2 G. ~
- module_param(ccnt, int, S_IRUGO);
复制代码
: t x6 u8 a' S% z0 X/ E8 Z5 A z9 }3 I- P, m2 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) g* ^8 ~ O% Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" A% J' q# H9 U; { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. j6 q* S# @ e9 E' z: _) O' W3 x: R+ Y' [4 x
( h+ n( x, s6 d' q) Q2 D b& \6 ^ |
|