|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & n, V+ s$ ^* e4 E# v
- [code]EDMA sample test application
3 g% _0 ~; v5 B - /*
3 W* F7 U1 P' |6 M - * edma_test.c% [/ h3 D, r1 }$ A. }
- *6 F3 j0 y0 H; p3 K. x
- * brief EDMA3 Test Application
0 W# G4 h! w5 q: j' w i; S - *
# Y9 A3 }/ g& W1 K3 P* \$ E - * This file contains EDMA3 Test code.
( i K' X4 p A) p3 T9 A - *# a' r4 c) O" S% ~; }8 c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ ~( z1 s' O" U6 J" L+ M. U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) o% u9 G6 e4 w6 d/ Q- K1 Y& x2 d
- * TO CHANGE.& h; ?# j# Z: B& S% V: O
- *7 S; B9 W& V1 K4 F. F( T. j7 X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// z: m' V$ d* ~" ^
- *3 _0 |) m" q0 K- B- B
- * This program is free software; you can redistribute it and/or, f/ C& c) G9 ~9 s, J4 m f
- * modify it under the terms of the GNU General Public License as
9 A6 P# L% W0 @" _' w - * published by the Free Software Foundation version 2.7 i9 b, O4 ]+ Q8 Y [! V
- *
1 R( A; _ F! v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, `% _' M. z+ P7 M9 l - * kind, whether express or implied; without even the implied warranty
) B: z9 q" t; Y3 @! i: D* [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! [: u2 P, `% Y; I* b0 K8 I - * GNU General Public License for more details.
7 o/ g9 [5 H: ]2 |" C - */8 X4 l/ }- ^8 @" N
- 2 _' C8 H0 a: \* n9 L' S, V
- #include <linux/module.h>3 L# t+ y) |9 X. a8 C6 R
- #include <linux/init.h>2 c5 }1 O& z+ G' v# ?/ N8 W
- #include <linux/errno.h>7 o# k! e# L* N9 Z" W; a9 V
- #include <linux/types.h>
5 x9 x+ D3 ? i( l" L# j - #include <linux/interrupt.h>
0 |( j# I+ N8 U0 X3 d - #include <asm/io.h>
8 p0 y) O+ M, Q' X$ Q - #include <linux/moduleparam.h>
( N, l- w( o4 D$ m - #include <linux/sysctl.h>
2 n! [: e# M! g6 Q6 S/ ?% _ - #include <linux/mm.h>8 r) m" h! Z8 K( Q
- #include <linux/dma-mapping.h>7 K# K( h5 F/ l; S& \
- : U. b# C% ^+ m. W: D) `5 h6 {- h% P
- #include <mach/memory.h>* P( \; b v- ~0 d' S. g1 c( W
- #include <mach/hardware.h>
6 M1 f5 I% B+ L. t3 E) G3 b - #include <mach/irqs.h>* t. F( r4 ]0 @, @9 |- r: M- H+ s: ]- U
- #include <asm/hardware/edma.h>2 h, M3 E- C6 H. ]
- . D/ s4 S5 A# X6 n! N$ H
- #undef EDMA3_DEBUG! t" {7 L% Y- |& \# [; N! L
- /*#define EDMA3_DEBUG*/
$ M. W/ E+ O$ b5 l
. t% B, N0 H6 t8 x7 d4 K' O- #ifdef EDMA3_DEBUG
3 A+ l# f# f% ~! q$ i' F, [3 r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& G l6 A) R- H. m" t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* g* T- {7 T/ P/ N' K* ^) ] m$ n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) K3 ?1 G" R( x9 i4 ^% G& z. u - #else
$ j' C/ w( U9 q1 N% F - #define DMA_PRINTK( x... )) `0 @$ G; {5 _3 u; n* L
- #define DMA_FN_IN
9 Y. U0 i! |: W' X; d3 F - #define DMA_FN_OUT
/ p z/ |+ L% P( {2 V0 k3 U7 Z6 U8 N7 X9 ~ - #endif
; l: [; m0 K0 h [5 \% P( H2 [ - - D6 |& f& R: i& o. y! V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 C% A. g- ?9 v5 {9 }
- #define STATIC_SHIFT 31 \; d3 s0 ^8 H% e0 d: ^0 N
- #define TCINTEN_SHIFT 20
* ~3 U$ a9 w' h6 V! O S' f - #define ITCINTEN_SHIFT 21
* l; a( L% t) H7 G' V/ T& | - #define TCCHEN_SHIFT 228 ]! _- `5 W* Q( D
- #define ITCCHEN_SHIFT 237 n+ s; _+ ^/ l% Z4 t: u3 v( b! `+ ?
- " P" v/ i0 ?8 s I
- static volatile int irqraised1 = 0;* t Z: x4 x, D$ ~
- static volatile int irqraised2 = 0;) Q' `! G3 @( E& I. n/ C i! N. B
$ T. |+ M4 V- d6 ~# {$ @2 ]3 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I: `& w7 I1 q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
G) Y$ {; z( o1 B# q$ } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Y7 |' P4 |3 Q5 _9 F/ f
; c/ ]7 K/ t3 v- X4 q& U: Q- dma_addr_t dmaphyssrc1 = 0;; M$ u3 c7 |5 B9 e* U G
- dma_addr_t dmaphyssrc2 = 0;
6 o E: H4 h1 e, D - dma_addr_t dmaphysdest1 = 0;
6 c- c; ~& ?2 N) v - dma_addr_t dmaphysdest2 = 0;9 }5 h2 |$ j! a Q$ h" Q7 }( T
& l3 D* G9 J% N4 H; u; W- char *dmabufsrc1 = NULL;1 c9 x4 i9 a( }/ i8 c
- char *dmabufsrc2 = NULL;8 i1 A4 ]! c4 H& V) O9 @
- char *dmabufdest1 = NULL;
( E. _: Q0 D; _" n" y: } - char *dmabufdest2 = NULL;
( J3 l! } l6 y% a4 ` - / B$ w- T8 V' i* `, F
- static int acnt = 512;
, P4 M* c8 ?) v" C* Y" J: j - static int bcnt = 8;
* f6 o o4 x5 H! [$ P - static int ccnt = 8;
; b9 l0 g% N5 c& o
* ]5 m5 o4 }# j# N5 ^" B- module_param(acnt, int, S_IRUGO);
% e( F6 ^+ p o% `; Q. E e - module_param(bcnt, int, S_IRUGO);* O J5 j V: Z# R
- module_param(ccnt, int, S_IRUGO);
复制代码 % P! |7 `5 E3 \; I: M- p/ B& H( b
* O3 k- K3 X" r) v4 \9 l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 H9 a! ?0 d8 _0 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ s8 X) P5 S$ x6 z( `2 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& }2 K/ o# c8 @. j. `- t
' T& t; S I; u4 T3 }1 C% b$ ]9 a1 i' `3 v$ Q3 s
|
|