|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 ~8 H! b. v$ ]1 ~( _% s
- [code]EDMA sample test application) d8 j* n4 w7 l$ i" X' q
- /*
+ v" _% `* a$ P1 }/ J - * edma_test.c
5 c* A4 N7 F* w3 I" S - *' i2 U9 g; e: }0 |
- * brief EDMA3 Test Application
3 U8 A0 e& b4 V2 f' r" x: X - *
/ b {# M6 z/ I$ J( }/ S1 M - * This file contains EDMA3 Test code.
" Z/ O7 Z) t: e0 w3 ?( ~ - *) S0 Y F/ _2 y( e; K; `4 f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( G( h- k, c9 I/ h3 j' Q5 }7 x; s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 p. L9 V6 S" a# Z
- * TO CHANGE.
, h, N9 H. j. Z2 r9 R1 f" o4 n2 ^ - *
3 E% Y) @$ b" h0 T; r3 g( N$ C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! e6 Z% R+ G& ~9 D6 _- n
- *" P% o6 P9 N( ^3 {& l
- * This program is free software; you can redistribute it and/or
0 ~5 L& n5 h' K- C - * modify it under the terms of the GNU General Public License as' J3 I) |; F3 V1 E' a* `0 [' }
- * published by the Free Software Foundation version 2.
4 b8 M" {# a" u( G5 B - *
$ K1 c3 N: ]! n) }4 t! W" ?/ w! ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% m. Q3 B% J5 d, p; m7 C: n$ T
- * kind, whether express or implied; without even the implied warranty
) m2 g6 X: O; g3 H" i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 A% x3 Z6 r1 l2 U! g8 D
- * GNU General Public License for more details.. l8 |) j7 R; m" H' [" e
- */$ O9 E' j8 b( k! j6 t: y) q
) [# T! c% ] L- #include <linux/module.h>
6 i8 p( A0 v; h) F - #include <linux/init.h>
# s: h4 S I, W& I - #include <linux/errno.h>
( a" B4 s$ ^' i3 I! O, y1 Z - #include <linux/types.h>, @- @- Z; p8 W! \
- #include <linux/interrupt.h>7 Y, c, G- ^6 N5 _, T x) L7 T! G
- #include <asm/io.h>. [# n5 N+ _3 ]( S6 V( c7 S4 N! b
- #include <linux/moduleparam.h>" Z/ o. [1 m3 [: N- p" i, h; t) `, ^
- #include <linux/sysctl.h>
W; I/ X9 I, e# G8 S - #include <linux/mm.h>9 l! G, x! J2 ]" T# ^
- #include <linux/dma-mapping.h>
! D2 }4 E3 e8 x' V. y2 ~ - ; V, C2 `. l, Z
- #include <mach/memory.h>
( W) N4 L% y$ n7 v0 S# F" v - #include <mach/hardware.h> K0 q1 N" ~( v' o% d: a( U& ~8 |. Y
- #include <mach/irqs.h>! g7 F1 g6 L2 [' u- b( a
- #include <asm/hardware/edma.h>- i* B# W' }/ G1 T2 J7 V
- : H* g1 E( U7 ~, g1 c, f# ], I
- #undef EDMA3_DEBUG: E0 m- J1 O! G" p+ r2 J
- /*#define EDMA3_DEBUG*/
; U/ ]7 ~* [$ d5 R5 R. b6 x
. X- ]5 ]% t! V; O- #ifdef EDMA3_DEBUG2 ]5 I" ?9 m9 a! M% N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ u( q L/ s! {1 ]8 T9 v; { { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 ]% B. H9 ?1 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. [) c/ B( Q( E1 X& P - #else
3 n4 @) r/ Y3 d4 v$ ?( G - #define DMA_PRINTK( x... ). d0 ]! C- L: m" Y6 u2 @3 b" i/ b
- #define DMA_FN_IN2 S% K& x' Z# s! E
- #define DMA_FN_OUT
1 |+ N$ i5 W: n1 |; c - #endif
0 J: k8 D7 t, s9 P% o
( v8 _! z0 p/ s N' \; u* c0 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& \8 s1 O. m' f/ m$ D
- #define STATIC_SHIFT 3
; E5 b% ~$ E; D1 d, v9 Z - #define TCINTEN_SHIFT 20: A0 w* w8 Y" Y$ P
- #define ITCINTEN_SHIFT 21
' [ y" _8 Q" O* p1 }7 n1 n - #define TCCHEN_SHIFT 22
# o0 J" A' U$ L. B" N& q) o - #define ITCCHEN_SHIFT 23( `; Z$ q" i/ v; ?. Z! y
' n5 k* C8 B/ l/ \# Y+ O- static volatile int irqraised1 = 0;
6 z# v$ m% P3 {* H: D- [1 ^ - static volatile int irqraised2 = 0;; D, G: | E! i, H# M& l
- ; A4 p9 l6 f# x; x1 l' u& b! r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Y* ?0 R' v/ A3 ~; p4 [+ Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! s I2 ]# I$ I: x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ {# S& n* ]( V* y3 m
- % F5 M+ O$ j' S2 [5 v! X3 F
- dma_addr_t dmaphyssrc1 = 0;' J7 J* G( y/ i- B
- dma_addr_t dmaphyssrc2 = 0;! X& ?* Y# C6 Q8 H' T6 g
- dma_addr_t dmaphysdest1 = 0;
; C5 ~. M5 P9 x4 O# k+ l - dma_addr_t dmaphysdest2 = 0;
# z" C0 M# g$ k+ k' @% ~8 ~ - 3 k. _- L; ]( }' v( ~" A
- char *dmabufsrc1 = NULL;9 P7 [8 s1 ?# Y$ g8 E
- char *dmabufsrc2 = NULL;) v" C3 s- [7 f# I
- char *dmabufdest1 = NULL;' b. M5 {" U8 Y: X0 Y
- char *dmabufdest2 = NULL;
$ t. R: e0 F2 Q" N- F1 E
4 a$ q- ^1 P' i7 U/ Z- static int acnt = 512;
' r: {, E6 W+ |) z7 u, { - static int bcnt = 8;) Q4 ]$ N( g) @7 h. F: z" j7 D
- static int ccnt = 8;+ V2 ^5 N# ^: A% a2 e" J
; @- g; Z3 O7 M0 o* \( Q; l- module_param(acnt, int, S_IRUGO);
9 {) u( T4 s3 ]2 z - module_param(bcnt, int, S_IRUGO);
: H& f. g4 [) ]: h5 l. g - module_param(ccnt, int, S_IRUGO);
复制代码 # `4 l" W4 v) A2 c8 [) e
7 [: n& @- |' t4 [: V( J7 ?7 w" ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 C) ?' c; Z3 m0 `0 i2 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 E$ ?& y* O9 `/ ? M9 p3 `3 F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 ^ c# ?5 k& M# m6 g$ j$ G& K
# R( |& E2 a* ]5 n" I$ _% i& P- b/ K S) D
|
|