|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 q3 W6 i3 [( _: S, `2 _+ h
- [code]EDMA sample test application
2 D5 r% {7 e* M- k& n - /*
2 h3 N9 k5 J* R7 ^ - * edma_test.c
3 d. r7 _4 t0 A9 H! [8 q ? - *& W- c) R: V# P7 d: ^$ E4 n# Z
- * brief EDMA3 Test Application( W0 T# g7 L5 x2 ?/ y
- *7 U' s1 P/ U# o M0 N
- * This file contains EDMA3 Test code.6 u3 j3 s9 ~- y! v6 b- g* l8 u
- *
( V6 |- j' Q5 \* }: r) V& Y5 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( J8 G; v, i3 t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& l1 C' {' g" Y7 N1 @$ D
- * TO CHANGE.# R* n8 P w7 C* r
- *
7 s& o6 p$ T8 X% w, a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 ]: d; s! Z" j# o5 D* o, x
- *3 W8 v/ h* Q& \$ z! P' D- @9 e* @: f7 a
- * This program is free software; you can redistribute it and/or
6 ~, v5 B$ W/ q - * modify it under the terms of the GNU General Public License as' Z- v: n7 d, m' k
- * published by the Free Software Foundation version 2.
1 m8 ^6 @+ b+ Y5 O8 @ - *
3 H8 O" V" O* E ~9 M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 J7 N/ y3 r2 Q* o3 T& @6 [, y
- * kind, whether express or implied; without even the implied warranty
8 ^9 j2 Z, \ }" w$ G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) ]6 G9 p) F4 J% W3 N - * GNU General Public License for more details.
7 O# t1 b# r+ ~5 M7 R$ | - */
0 S( H/ U& v5 G. a3 L. S$ L9 z
! X' [" L5 ~1 `0 J2 [7 ~; ~7 J. K; H- #include <linux/module.h>. o2 Y; S' y: y, u7 b
- #include <linux/init.h>
9 y" h7 p3 Q. u- ?- a' b - #include <linux/errno.h>: z% f! e/ R8 X1 A
- #include <linux/types.h>! z* ^: t7 h' b6 [! S
- #include <linux/interrupt.h># H, y$ ]4 Q( V, y
- #include <asm/io.h>( {+ e' q9 m4 ?( o: _
- #include <linux/moduleparam.h>5 |, m" j H+ A. @8 Q8 |/ \" f
- #include <linux/sysctl.h>- @! I( U& Y8 x' X
- #include <linux/mm.h>9 T2 U! k+ u) h6 b! d. l# J
- #include <linux/dma-mapping.h>
/ _' m9 f; a* i4 v7 `
1 E X; u" @1 R- #include <mach/memory.h>5 v( ^* l$ B0 B. O6 B5 z# \
- #include <mach/hardware.h>- j9 L( j( t: z" S! P6 W* G
- #include <mach/irqs.h>
$ B' m# z* ]/ T - #include <asm/hardware/edma.h>+ |. t6 t, v; y4 Q( m0 E4 S
' F- D& H1 t& |/ B- M6 K- #undef EDMA3_DEBUG3 D4 t7 R; o6 v( n5 n0 t$ F8 i
- /*#define EDMA3_DEBUG*/4 \: g4 C+ g* i1 R: g+ y1 X \4 {
- / W @3 ?4 [# A7 D$ ] }2 C
- #ifdef EDMA3_DEBUG' }0 u5 U- y. b2 ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 N4 A5 M( j! w8 v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 w3 g; E3 x( U7 ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% m3 K o# W: V8 P5 T - #else
o8 i; E; K6 ]9 X i1 j& c' U - #define DMA_PRINTK( x... )0 f. s1 F/ C6 B
- #define DMA_FN_IN# |: g+ ?$ z& f3 {- B
- #define DMA_FN_OUT
& k- L# X3 V v - #endif
. L7 z% C3 [7 V9 b4 r% t - 5 r M) t" \; Q# h: R B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) B6 V2 z# f) P3 N! I - #define STATIC_SHIFT 3
$ {. m- Q3 V" V - #define TCINTEN_SHIFT 20
, c* O' f4 \6 ?& [' f' o; y& q W; M - #define ITCINTEN_SHIFT 21
8 ^! r/ Q- I$ s! X - #define TCCHEN_SHIFT 22# }2 ?, P% c4 B4 u: ?: b
- #define ITCCHEN_SHIFT 23
T! Z. F# e1 }, k9 t' l) i
1 z/ h6 u8 @+ N" @: c7 U- static volatile int irqraised1 = 0; b6 u3 {) P3 T/ o9 }$ Z5 |1 p
- static volatile int irqraised2 = 0;2 v1 ]2 K0 y k; w
- 9 J. \/ E: n' c# f$ f( W# b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* j% o/ d) ~* ?5 e' H% ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T! s" a0 }+ }. W, ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 o* C& r3 w9 T
; x, ?8 i/ r$ ]7 m- dma_addr_t dmaphyssrc1 = 0;$ u1 ]+ s6 Y; M8 Y3 `* U+ X/ H# l
- dma_addr_t dmaphyssrc2 = 0;
! o: Z! Z. n; O4 n+ c - dma_addr_t dmaphysdest1 = 0;
& |1 Q* s# G' g/ `: v: U. h - dma_addr_t dmaphysdest2 = 0;/ w; Y; I" F) A U. ~* V
- 0 c( S9 ]% ^$ Q* z
- char *dmabufsrc1 = NULL;
[# p" `% A; A" Z8 `) N - char *dmabufsrc2 = NULL;
1 l U" q" R0 S& z: D - char *dmabufdest1 = NULL;
+ X. F# n/ ?4 S# K3 x! c5 c9 B/ t - char *dmabufdest2 = NULL;
4 o" G( B; S% q2 s2 V O! F - 8 @! x* T; n, b4 R. i# E& j5 P. W/ `
- static int acnt = 512;
+ d5 [6 x7 ^& n9 }+ c8 E - static int bcnt = 8;
`2 E4 ~& R( P' R5 N- C9 B+ B2 x1 Z - static int ccnt = 8;6 a! p( @% \% f- Z/ I- t
- 9 Q! P6 g+ ^$ g" s9 ^
- module_param(acnt, int, S_IRUGO);* d8 _, f( X8 m% P
- module_param(bcnt, int, S_IRUGO);8 ^+ g; H; |; h0 Z2 ?
- module_param(ccnt, int, S_IRUGO);
复制代码 8 N& ?* M9 y. t9 j$ i/ ?2 j j
" k- B* ?8 D9 o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& U1 g% `7 m. F7 F, v; @ M6 O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 e) B: r( U/ h6 E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
Z5 P! c$ N" r" p5 N1 \$ E9 y) D
: S3 Z% n! b8 K+ v3 V; X8 g" M+ z) ~ w8 l `9 }3 h1 o( R
|
|