|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 j* e, `. e+ L0 L) ]! f
- [code]EDMA sample test application
. H, w3 N" Q2 Z0 I1 r" K3 a - /*" ^; g2 D9 A: C5 S" M
- * edma_test.c
' r' ]0 h: J0 j3 p/ C% w8 J1 S - *1 C2 U L6 h6 M& ^/ Q
- * brief EDMA3 Test Application
8 n2 E: {+ g. E" h& T( s% J - *
9 x2 F8 d6 D: S5 U( ~1 t - * This file contains EDMA3 Test code.
& m& y8 J2 v/ A: R - *
$ I( j ^# \& {8 }4 W! b/ T* F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 r9 P+ M& V* O+ R" c' T B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& P" g4 i( q% w8 w8 Q
- * TO CHANGE.3 m9 d0 g. v( J1 a
- *
2 R5 F; `; w9 w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 r6 `- M+ }4 W3 b$ d: v& R
- *
3 G( z2 |# @0 S* E6 P1 L, N - * This program is free software; you can redistribute it and/or
# X" D$ G; R9 X- ?1 ~' o - * modify it under the terms of the GNU General Public License as
- k/ h# T8 J! f! O - * published by the Free Software Foundation version 2.
8 j+ I7 k0 K6 F, f9 g& f - *
L$ [- P' o* w+ s) } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 j3 |/ y, [8 g4 ] e: p
- * kind, whether express or implied; without even the implied warranty0 G8 L9 C v9 {- \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- d* |' K/ M8 V
- * GNU General Public License for more details.
7 U% U- }, d3 Z! X - */
) m9 W) l0 \# y3 j1 u - % ~) J) @8 e2 `( J% g* h
- #include <linux/module.h>+ ]! u6 u/ @. W8 \7 Z- H+ u2 r0 a
- #include <linux/init.h>! e: q! W9 x. { G
- #include <linux/errno.h>
& `0 b& t7 x2 |1 {2 i2 G9 O - #include <linux/types.h>
' D+ r( P6 m) Q" C - #include <linux/interrupt.h>- I: k8 l+ d2 M- u3 e r+ j
- #include <asm/io.h>
# [& p, g( Y1 e+ b - #include <linux/moduleparam.h># h' R! Y% q9 Q0 p `. j k, p
- #include <linux/sysctl.h>$ H* M* @5 T- u
- #include <linux/mm.h>
# |) i1 k; x( F/ `. p8 Y - #include <linux/dma-mapping.h>) f M5 }+ A y# g# ]0 [8 e
' X# J& z7 O& N! Z O- x' |- #include <mach/memory.h>7 h8 V4 p6 Y( \4 e2 s* e& m' ~/ X; D( d
- #include <mach/hardware.h>
6 o, D& ~8 S$ E2 R- k - #include <mach/irqs.h>
' ?: \4 q; o: [ - #include <asm/hardware/edma.h>
5 c" b4 }* u* J/ R - , @9 K1 L' N- A$ T4 B: t7 R$ ?0 C
- #undef EDMA3_DEBUG
' n, ~) J! C, S$ J7 {5 c - /*#define EDMA3_DEBUG*/
* w9 K8 M" P+ H' J& ^6 P
3 a* {5 g7 f, S6 `- #ifdef EDMA3_DEBUG j5 G9 ?/ \2 z0 J& ~7 m8 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) {$ Y3 \9 o: w1 T2 P9 ^3 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 P! ~9 l: l) x a9 Y" Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ q# ^. x& X: c9 T' s+ W) B2 V - #else5 `# S5 u9 ~3 B2 V
- #define DMA_PRINTK( x... )6 S1 l0 Z: w3 Q; q
- #define DMA_FN_IN
- `/ O3 H+ |5 W' \ - #define DMA_FN_OUT" X4 L0 _) e: ?0 y" N
- #endif8 C, D9 f R8 O+ i2 a6 s6 h7 l
- y8 \' P& `! f n0 V6 K) O: v$ L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% x; {" M% x& s - #define STATIC_SHIFT 32 H% A _6 f" y0 g$ I3 V8 T# M
- #define TCINTEN_SHIFT 20) G5 ?. t3 B; a! x
- #define ITCINTEN_SHIFT 21
/ _' I% G# c+ y" n, W. j6 |1 o% S - #define TCCHEN_SHIFT 220 w& B& `* B; o! t5 g! g4 q
- #define ITCCHEN_SHIFT 23
) o% U4 ^" I8 b; O/ [1 K+ M9 _
( X- c" h, m+ Y- static volatile int irqraised1 = 0;% l9 J( A: [( J" X
- static volatile int irqraised2 = 0;9 O. U3 s3 \' G" P
- / n% Z6 a# f/ c: [9 V' ? ]; T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& ?! }: o) V7 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& C& I- ]6 ?" T4 F- X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ?4 S2 l2 b+ m# S: q
- , b1 q# |8 a Y
- dma_addr_t dmaphyssrc1 = 0; i& v9 L# i, H5 {3 E5 V3 P7 w8 `
- dma_addr_t dmaphyssrc2 = 0;/ U8 B8 G3 v8 H9 u/ P
- dma_addr_t dmaphysdest1 = 0;
) T; N$ V( T, R8 [ - dma_addr_t dmaphysdest2 = 0; _# Z3 q9 `/ P) P$ r
8 g u: k) Z' L, }7 e- C- char *dmabufsrc1 = NULL;6 s1 l# X* ?- p) }& u/ y) q
- char *dmabufsrc2 = NULL;
( r: Y# u$ o% X5 C0 r - char *dmabufdest1 = NULL;9 Z9 E; E, X$ s8 O
- char *dmabufdest2 = NULL;' `3 ]$ A+ j5 M" N p1 h
) G: o- P) Q5 ~7 M- static int acnt = 512;
9 k ?2 i, c. n0 a - static int bcnt = 8;) a$ l. C% @ y3 @
- static int ccnt = 8;
# w4 X9 ~7 y8 Z/ K - / |: b8 H) Y7 f k3 _" o& I- \' F
- module_param(acnt, int, S_IRUGO);9 ?6 F2 _; C1 Y! U; w
- module_param(bcnt, int, S_IRUGO);
; f- T4 z6 @4 W: k I' t - module_param(ccnt, int, S_IRUGO);
复制代码
% p% I$ o; D/ H7 b0 S* z" Y' ?+ P1 f' X( z# ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; B1 m( p& D0 V3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# `* j) ~- s0 Y9 a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ I9 w$ h0 }" `1 B0 N* y
1 u' z2 I ]& c
; w) Y; `0 P$ W6 ? |
|