|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 l9 w" s |# ]) r
- [code]EDMA sample test application
7 H6 B( R" n- D+ ` - /*, g* N8 _+ s; l, {7 x
- * edma_test.c
' g' ~3 I- G6 m- C8 }! j% E$ d" f - *
0 K. c9 e" x7 F+ `) J* p+ B - * brief EDMA3 Test Application
5 ^6 X& ^# I; X4 P3 l - *+ E/ Y6 }) F' ?# l+ d A
- * This file contains EDMA3 Test code.
" B) }' q* ~! z' T) c - *) G& [' d7 L& K7 M( ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ B7 P3 v( O4 a4 B4 `' p0 B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 V8 `' I. a7 i% ]# u( g2 U
- * TO CHANGE.
% R V2 {% \( Q9 o - *5 n0 z2 w/ a* r4 v" t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 W6 g: I- e; K {$ |' ? p) h# ~ - *" S* Y! n' {5 n" l# ^. ^# h
- * This program is free software; you can redistribute it and/or
' D7 v7 t5 a2 E- G - * modify it under the terms of the GNU General Public License as
7 \8 n9 Y) O! z3 b - * published by the Free Software Foundation version 2.
3 D$ J' V+ x6 T' \! Q - *
/ ~; w; e9 v- I' Z O; u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 h n2 B9 _* ^4 s/ E
- * kind, whether express or implied; without even the implied warranty L2 [3 C7 F# Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- o* ~. c1 A7 v6 S$ s - * GNU General Public License for more details./ C) M2 D% L1 u w- s; U9 p- |
- */
. p+ T9 t1 N" W0 y# J
$ M" O% @( r/ f( V- #include <linux/module.h>6 ~9 R% _+ M) j- b! q) R$ [
- #include <linux/init.h>0 u: J" t2 k1 }3 D2 \! P1 N0 O
- #include <linux/errno.h>
# p3 ]; X9 ^- t- m - #include <linux/types.h>
+ S' [/ U/ `! v - #include <linux/interrupt.h>& ~: g3 e; g. [: P, N
- #include <asm/io.h>; X, \7 D$ X/ I8 i$ {! p7 S4 J
- #include <linux/moduleparam.h>9 q2 Q* n% a/ a' R
- #include <linux/sysctl.h>" D* y3 d; x7 C- r4 T: A' P3 T
- #include <linux/mm.h># z" _% [) H1 p, `2 T
- #include <linux/dma-mapping.h>: i( f/ u. Y% H4 S7 J7 V
+ ]7 \4 T z2 Z2 o* s. Z- #include <mach/memory.h># c0 b0 F/ t3 w
- #include <mach/hardware.h>
2 c3 H; f# F& v+ `/ A - #include <mach/irqs.h>
) m( L7 D# N* R. ^4 \+ O( W - #include <asm/hardware/edma.h>
- x4 Y' G3 o8 N9 o: t - / F- X7 x. T& U6 C- q1 H! n
- #undef EDMA3_DEBUG9 R" m+ U0 E, G2 O; x( S
- /*#define EDMA3_DEBUG*/
8 R1 I: p2 B1 u7 }, D
' v: m% Q" K& v. H- #ifdef EDMA3_DEBUG$ z2 h+ o( P* R3 k _: Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 H0 ^5 [ S! J8 d3 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); p% G/ [+ K' G" z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& D' X: w# n$ s1 R# q! ]$ P! j
- #else
, N4 X6 n9 B) J/ f& K - #define DMA_PRINTK( x... )
3 L2 e: f2 j3 B* ` - #define DMA_FN_IN4 e3 z7 a# w" Q! [& [
- #define DMA_FN_OUT
+ _- @/ ~) ^, u" v - #endif
& }* {" z/ K: k$ M7 e2 K; i" b
* ]& |% u$ r7 S* H( x# @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ c5 \) `0 W6 A1 S5 z* } - #define STATIC_SHIFT 3
$ Q) y' J. s: }# e) V7 t4 Q4 P' Q - #define TCINTEN_SHIFT 20' L6 v" h1 [. t% ^
- #define ITCINTEN_SHIFT 21/ c }/ m, U4 o0 h
- #define TCCHEN_SHIFT 223 q6 q5 _+ M- [
- #define ITCCHEN_SHIFT 23
! ?) @8 [( u# j* v! q: e' z+ u
9 f' o9 r: }/ Q8 B- static volatile int irqraised1 = 0;
0 Q, f* b! P/ K; @ - static volatile int irqraised2 = 0;0 s0 X3 \+ D _2 x+ R) z+ y3 L
: N7 ]! _3 }, r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P: I. k# `2 S0 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 s2 H/ n7 I$ o: i5 b% e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 j! R: }+ m% X( @9 v2 S$ |
: N0 ~0 i+ ^. r$ f- dma_addr_t dmaphyssrc1 = 0;; C/ }1 \: W2 @7 I
- dma_addr_t dmaphyssrc2 = 0;5 Q# M2 {; }! I S
- dma_addr_t dmaphysdest1 = 0;9 C: u Y& y1 l. ~7 B
- dma_addr_t dmaphysdest2 = 0;
5 K, }1 i# }/ Y& n6 x3 t
( [( L: l- }2 N$ k- char *dmabufsrc1 = NULL;' V# b) [$ i2 l" f4 N: o" W
- char *dmabufsrc2 = NULL;
5 C. b+ x$ U: J. g9 c% L - char *dmabufdest1 = NULL;' G" A8 Y: s, u( C& o
- char *dmabufdest2 = NULL;
; I4 a6 j; R7 o- F
' O8 r/ B9 S( S9 ^- static int acnt = 512;
/ ^# ?' p$ ?8 F2 L - static int bcnt = 8; b4 D3 ^& P! K9 P: M
- static int ccnt = 8;
8 N O& Q/ T! }! n) I
) P k ~7 C* z' G) ], w7 v' b; z- module_param(acnt, int, S_IRUGO);
; Q8 b5 V# f% t, b I7 y - module_param(bcnt, int, S_IRUGO);' V6 O! o" Q/ R. }
- module_param(ccnt, int, S_IRUGO);
复制代码 - O5 C6 h2 V% k2 Z5 a
- W3 K2 a0 l9 H. a& [; {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 F: X- }$ Y$ x+ I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* c# o- y# L# M6 z# \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- C `) c. g3 v: \) N" V( y$ T* ?* u$ M# C- z4 o+ B. D
! q* r: V4 o0 ^1 A
|
|