|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 |9 w, }$ s7 G$ R& @$ Z% _6 J
- [code]EDMA sample test application
+ T6 {% Z ?7 q6 c - /*7 L4 p9 c _. Z: E& ~) T
- * edma_test.c- Z) k: n& E# e. M. m p& J( r
- *
! c, o# C9 f! M8 X - * brief EDMA3 Test Application
% D2 s' u1 P2 o3 a; K - *
$ q) p1 h/ p5 Q - * This file contains EDMA3 Test code." K; M8 G8 Z2 g! ]
- *! h$ T. G: H. Z/ k; k6 ?. X& P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 k* y B/ E$ O9 O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 G2 |. x: a @, B% U' ?
- * TO CHANGE.7 F6 F2 d$ I. R! T6 x
- *
4 ^5 @' t' c6 L9 {0 r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 Z0 \4 Q! v- v: M) [
- *0 z3 ]: I9 i) G& P
- * This program is free software; you can redistribute it and/or9 |5 ^/ w8 G# r. m/ B7 `; R% q
- * modify it under the terms of the GNU General Public License as
# e* ^5 L& L$ a7 K6 w ^; K4 j3 E - * published by the Free Software Foundation version 2.& D# p: ~7 C0 ^+ n: P7 p
- *( W* l$ ^0 ]; Y0 G8 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% H8 l% z, S, x1 s; ?; j
- * kind, whether express or implied; without even the implied warranty
* a/ q/ M2 h- _( p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ k! _* k- d5 c2 m: _ ^ - * GNU General Public License for more details." U0 Q9 X) C+ M4 K$ O! ?* f/ J5 M
- */1 M1 Y$ e/ x- F! L
" }/ t+ g' l: J6 ^: M' ^7 M/ |- #include <linux/module.h>, T4 w# V) ^$ i
- #include <linux/init.h>* U+ f: P: E0 @( K; {
- #include <linux/errno.h>
# B3 I( V$ ^8 U3 w5 r - #include <linux/types.h>
0 I# U2 F! x5 A) J - #include <linux/interrupt.h>
; l; L [$ N. X3 w: p - #include <asm/io.h>
3 `' f6 D" N; e# F* S$ m - #include <linux/moduleparam.h>: W5 o9 W- {& l0 _
- #include <linux/sysctl.h>
X. U4 C- Y/ `! }& ]/ K - #include <linux/mm.h>
) l6 w, Q/ q% a8 d% o/ s/ ? - #include <linux/dma-mapping.h>
! ?" l b, L" y - 4 |( L& \3 H a4 Q
- #include <mach/memory.h>" {9 r3 K3 `& E" r
- #include <mach/hardware.h>
" B: \! C! r- o- w" G0 s r" D - #include <mach/irqs.h>
, J; d/ U3 B/ t% v, q1 L* ^6 w' P - #include <asm/hardware/edma.h>
3 S6 ~' c+ N' Z A: V, c
+ Q- r# W' M# L) h- #undef EDMA3_DEBUG
9 Q- u2 Q5 g, {2 [0 M% _7 `7 s5 U - /*#define EDMA3_DEBUG*/% M |6 v# v% E3 O- J0 z
- $ k5 b* B3 U# j- h2 A
- #ifdef EDMA3_DEBUG3 t, A( C; G' W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- n; m+ N/ j8 _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Z7 m5 N5 f6 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 J0 |5 f- I7 }1 X - #else
" p3 X6 m' q! K7 r5 ^ - #define DMA_PRINTK( x... )
; ^# o+ d5 E# S$ ~ - #define DMA_FN_IN
" s* L) [# @. x F) Z0 n7 s - #define DMA_FN_OUT
j1 ^9 J( V3 j+ u' \; [ - #endif9 C6 C7 B/ i* g+ u, F
- : w( u# v2 q+ y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); E/ x/ x+ h: z6 u% X- x
- #define STATIC_SHIFT 3
$ V1 H7 t! B6 l6 Z9 J U% Z. J - #define TCINTEN_SHIFT 200 P" U2 Q6 ~' G' d
- #define ITCINTEN_SHIFT 21. E5 X# ]( i1 k9 y& D$ v
- #define TCCHEN_SHIFT 22
+ w2 f5 X- U4 j# F2 ] - #define ITCCHEN_SHIFT 239 w6 k: j9 T7 a- E# S- m2 U
Y- i) f7 v4 |- static volatile int irqraised1 = 0;
2 q8 C$ r0 l5 N) }& N, J |+ n4 d - static volatile int irqraised2 = 0;
5 q7 I3 X0 H! _9 N3 y - 2 r9 [3 q6 f8 z9 l2 s9 D& o2 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* C# i6 }& n7 V6 {2 h& b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 N5 s3 c; Z: ]/ e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! E: p7 W: U# Q. F. Z1 Z - $ x( p0 A( p0 D% M3 l7 a. o9 \
- dma_addr_t dmaphyssrc1 = 0;# v B- I3 ^/ d" R! U# M. y
- dma_addr_t dmaphyssrc2 = 0;1 j. A8 S/ b7 i2 c; f
- dma_addr_t dmaphysdest1 = 0;
; g/ T ^* M2 u' p - dma_addr_t dmaphysdest2 = 0;' D$ ~6 @, V* K' l- i7 G6 _4 c
- 1 r+ ]& F, D' S5 _7 O
- char *dmabufsrc1 = NULL;
! U3 Y) {( ]0 f. D" v - char *dmabufsrc2 = NULL;) B; l& |( g7 p: R1 H
- char *dmabufdest1 = NULL;
8 l* p9 s! n8 Z3 J' h7 U - char *dmabufdest2 = NULL;6 X* d; a, o# k1 v! T
- $ i" w/ C- ^* h( ?
- static int acnt = 512;
* C! ?: j; P6 } o - static int bcnt = 8;1 k# j5 K6 ^! Q W$ x2 f
- static int ccnt = 8;
) i$ l, i9 p7 a7 G6 t
8 U$ @) v# X% w B7 x( M9 {- module_param(acnt, int, S_IRUGO);
7 ?! Q) G& q! `! f' W: {! i1 S4 x - module_param(bcnt, int, S_IRUGO);. \' }+ c; G5 ~( H) N
- module_param(ccnt, int, S_IRUGO);
复制代码 6 W4 e( V% v U6 v2 h I
- U, }, _2 A, E; l9 j- \) q+ H/ Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 t, ^4 ~4 y! _5 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. J# y1 a& {- ]) q7 e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ R2 X# r1 ?2 ~# m% D- B& j
% p9 P) k1 ^" ?7 f6 u5 h+ Z4 @. k: w& G: n, b" z7 X6 Z) a
|
|