|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ p8 T' g% n7 l' Y7 j$ s: K# A1 `* B* i0 ]- [code]EDMA sample test application% o2 i) s% ~2 `7 M2 G* |
- /*
6 i) j" t; K, _ - * edma_test.c+ k' v% L) W) q1 D/ c
- */ A" ^) [1 i" @ H# j3 K% {. w8 X
- * brief EDMA3 Test Application
9 b9 h% M" d" v7 g - *
5 p: p" ` U9 z- W: N1 X" B - * This file contains EDMA3 Test code.4 W# b% j3 l# c" j" p
- *
* y2 m( v1 T! k: o# @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ U) l& I3 N- I5 C# Z( g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 Z- Y# O g. E2 \* U2 Z% ~; ^. D - * TO CHANGE.! g' |. Y; b+ d2 x7 {# |
- *3 F8 D; |% u" K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' I4 }$ U' E% S$ Z1 o
- *
+ D E( Y1 ^9 `* @ - * This program is free software; you can redistribute it and/or% D7 |% N; B) N
- * modify it under the terms of the GNU General Public License as- g/ t. r5 Z; B/ e& w5 o v
- * published by the Free Software Foundation version 2.9 U$ q, C+ Y& x( q( ^! r
- *6 }6 l8 _2 b! g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! Y$ T; z' K. k' X9 h# G, F h% B) j* q - * kind, whether express or implied; without even the implied warranty, w! D5 |. E7 }. B7 V) I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 ?. [; l& V% A: v8 q/ D6 k
- * GNU General Public License for more details.
! b7 n; e; `% H G- F - */1 H4 L) Y; t) G2 H; H3 c
- 1 p' S3 P( q* {! r# [4 h% A( s
- #include <linux/module.h>
* U2 x, A* N9 J* V6 E( _4 k# ? - #include <linux/init.h>
2 O8 @" l2 p+ a0 H - #include <linux/errno.h>
/ ^7 Z9 ?2 [7 ?( p) f4 [& P - #include <linux/types.h>6 M; `4 z$ F' M# O. g% c
- #include <linux/interrupt.h>) K' s b* V! z# {. g
- #include <asm/io.h>! e" H6 V, T, _! @ m# r: F
- #include <linux/moduleparam.h> n7 |1 |, C/ d% m( a+ J
- #include <linux/sysctl.h>0 i# o+ |/ E J0 G4 d
- #include <linux/mm.h>' P5 F9 N* _, p8 i2 g
- #include <linux/dma-mapping.h>
4 A# x$ ~. a! {7 I3 p' [ - 3 s, v7 }7 _; u @$ Z/ I
- #include <mach/memory.h>
. F6 h' F: F/ Z6 h- O$ ~: l - #include <mach/hardware.h>7 `& h8 f4 [& J0 I: b
- #include <mach/irqs.h>
& @7 O y; u! k! E/ p) p - #include <asm/hardware/edma.h>
0 T2 K3 r3 g0 d' n) C2 @( i& u8 K
7 j$ c6 d4 g' u4 t% i- #undef EDMA3_DEBUG2 ?) }# } C7 ]9 ]# G" r
- /*#define EDMA3_DEBUG*/2 y9 L. o1 a% w7 w
" Q( \& ~) U( |% a: H- #ifdef EDMA3_DEBUG
( R2 \5 }( E7 [, i- q; K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ _- a$ ]: }# e: M7 v1 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Q, H; U& |5 {- ^+ ~" ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ N1 h' D9 A$ M0 Q5 {* j' a - #else- \+ d1 h- @+ @+ l! ?- b/ y6 F
- #define DMA_PRINTK( x... )
' Q& p8 S; Q) r4 X - #define DMA_FN_IN
C6 g7 S0 ^+ `, L% O - #define DMA_FN_OUT
' s* [( Y" A0 b0 ^; O# H1 K - #endif( i# r6 ^5 D7 _# L% {2 `' g1 k( @
- 9 C3 F9 _- f, U6 {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 h+ K1 I& l$ W$ B
- #define STATIC_SHIFT 30 y9 F; w7 f1 ^; n5 _) G, y
- #define TCINTEN_SHIFT 20" ^! l9 r# [, w! U0 j
- #define ITCINTEN_SHIFT 21
, r/ ?/ H, l' V+ P" u: m - #define TCCHEN_SHIFT 22
( F7 E* {! U( k4 ] - #define ITCCHEN_SHIFT 234 e! t9 n* F6 U
- 1 g( ]! f. e" x( u
- static volatile int irqraised1 = 0;, k, G6 H+ ~4 _; }% V6 q
- static volatile int irqraised2 = 0;' O, Z! U9 e F7 A% i& H
- ! p2 G! W4 p% Z2 G0 U1 @1 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# a B( u2 `; G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- E- E, R# o5 ~' B/ M7 b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ y0 I8 N, g G1 c$ H3 a2 U - ; `3 n6 I% {% O5 Q3 h
- dma_addr_t dmaphyssrc1 = 0;& J8 B' X2 w; u$ F
- dma_addr_t dmaphyssrc2 = 0;
$ m8 m% K" r% ]1 A7 k; q0 r+ p# o - dma_addr_t dmaphysdest1 = 0;
! b5 ^0 Q9 E6 M1 I: n! p& G - dma_addr_t dmaphysdest2 = 0;
( ~3 F% B4 E1 J! z$ }3 v
n3 D. a( g p3 ^- char *dmabufsrc1 = NULL;
# K! i) P3 U: i6 g" j1 [8 @ - char *dmabufsrc2 = NULL;
$ d- b; v" e! Y& Q) y. h - char *dmabufdest1 = NULL;: W) | F3 D! {( |4 ]! a" m
- char *dmabufdest2 = NULL;9 }# W, e% @/ z1 [' O t+ w- ~( `
- & `7 T1 b, Y( ^) d
- static int acnt = 512;+ y$ W) i6 `0 I- V
- static int bcnt = 8;
3 I6 j8 Q% t9 s - static int ccnt = 8;
- o( ^1 z- s! ]$ w - ( `, M$ t; _3 w* c& q' P6 h9 E$ \+ b
- module_param(acnt, int, S_IRUGO);
) K8 D7 a/ [4 [ - module_param(bcnt, int, S_IRUGO);. s7 h( v7 Y8 x% _
- module_param(ccnt, int, S_IRUGO);
复制代码
+ K& ^ }( ]' b" b$ P
6 J$ H7 T9 g9 `' q- t) q& g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% g8 u8 I# B# p; j2 P2 m+ ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" i8 K' l7 V% _8 [+ q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 Q+ f+ i( }1 ~0 X
' q0 [: ?% u0 T8 x- t) J4 F' [( J9 s. E
|
|