|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! X; ^: v5 [2 q6 k. k) A j' t) s- [code]EDMA sample test application0 k$ y/ o; E. r& v; C2 ^" f
- /*6 E* R5 ]% J1 } {, S7 F' @+ L
- * edma_test.c
8 d" L7 c9 D8 [0 [. J" T5 E/ P - *$ N$ O8 ]; `5 A) F6 G- F! T
- * brief EDMA3 Test Application( ?) T' F- z, M2 u8 w2 U
- *( N8 z2 N& @) c S
- * This file contains EDMA3 Test code.
0 a2 h! X! |7 m, z9 x1 u - *7 e0 R5 C N" D' u4 p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 \1 |; M( M- T Z% J1 w7 u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 l% G" ^8 j2 k- p - * TO CHANGE.% w8 x+ Q' f+ Q) s, p" W: [1 ?
- *& Y4 O2 l+ v' R6 i$ h, B5 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. i+ J* e' G9 B( p. r
- *
* q" t, j! R; z: d7 k, v6 S - * This program is free software; you can redistribute it and/or
6 S( ?2 Z/ H% E" u) l - * modify it under the terms of the GNU General Public License as3 a' G7 q% Y& o5 ]) B8 E
- * published by the Free Software Foundation version 2.1 H$ m: R( y5 ]! f5 ^
- *
& K- l% w: H/ Z: k: H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 x8 h ~' @0 Q! f0 U) N2 N - * kind, whether express or implied; without even the implied warranty
# H* `5 E$ g2 s2 h2 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 h9 W; U* T$ @4 n7 k {
- * GNU General Public License for more details.
2 A+ B( W3 U1 |( t/ F - */3 U; ]/ N. `. T4 m8 G
- & S5 c3 h. P/ N5 r1 a6 c# m* n
- #include <linux/module.h>- E; T. C1 D T
- #include <linux/init.h>. N' M9 a' C, a4 ]8 B
- #include <linux/errno.h>
" \; [9 T' D+ w/ m - #include <linux/types.h>
) W' h- s J0 d: U9 r: ?+ R$ f - #include <linux/interrupt.h>* E6 h) e/ p: [$ b3 x6 F
- #include <asm/io.h>
+ S7 Q5 I' k5 ?, y# [; n7 z1 R - #include <linux/moduleparam.h>$ J8 |% j. M" |: T3 P J! _
- #include <linux/sysctl.h>
. M+ _6 |6 @3 ~3 l$ w" Z6 O L - #include <linux/mm.h>
1 M: r4 ^9 _7 r, \1 _5 d' p* K; _ - #include <linux/dma-mapping.h>
/ M6 b% B9 y4 r8 L - 9 @% c3 t6 h) D
- #include <mach/memory.h>7 y) r9 |5 V i5 t* d
- #include <mach/hardware.h>& O) }" [( P* o1 D4 w4 d3 K, d
- #include <mach/irqs.h>; _/ x2 S0 s5 \2 ^
- #include <asm/hardware/edma.h>+ I. }# Z0 K( T$ N
, e7 U2 Y5 T, s; {( H6 r1 x5 c- #undef EDMA3_DEBUG7 G8 e" U! |7 v4 u( ?
- /*#define EDMA3_DEBUG*/
% p3 l' R0 C9 D) [ - 8 @& W$ G. o5 u) d* @# P7 d
- #ifdef EDMA3_DEBUG
' n% X3 `7 T! R: M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 s7 _) _4 h4 }8 s/ K' G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' G" W$ r9 ]' q# F$ \3 k1 s: u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: Z" L. y/ A1 |# s5 _* R - #else
: E9 E1 i8 _- Y1 {3 n9 t) N - #define DMA_PRINTK( x... )
$ T: b: i0 c: \1 ~5 b4 @. W [ - #define DMA_FN_IN1 P" v# P+ t0 P O) O# u5 ^
- #define DMA_FN_OUT( L6 k7 N7 H& z% M( Y/ I% x
- #endif3 y+ ~4 _5 G" ~& Y4 ~! T
- + \, y* e/ b) @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): p+ x; Y% C9 K4 L _% j
- #define STATIC_SHIFT 3# n! D5 t; {- A6 i
- #define TCINTEN_SHIFT 20
/ A9 A8 O3 K s - #define ITCINTEN_SHIFT 210 k& n4 e: e% u. A; ^, f# M
- #define TCCHEN_SHIFT 22
3 ]9 @9 H ?; M9 C9 N( N& t9 x - #define ITCCHEN_SHIFT 23$ M X( j3 m/ _- {
, {' v- r2 }" I# I: B5 s% [- static volatile int irqraised1 = 0;/ q$ \& L) g8 L( s9 l. m
- static volatile int irqraised2 = 0;; {5 I" L# D5 H. Q# `. @
- + C) A# V! B4 o- }" R( C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 e) ?# a. u, t! e/ m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ P q9 T% R# |' X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 O, Q- h5 n6 d; H$ K# \, {
& B& y+ ]: T& O2 N. R' C& @- dma_addr_t dmaphyssrc1 = 0;
8 p* H: {" C, s Z, J- B - dma_addr_t dmaphyssrc2 = 0;; R9 U/ b3 m5 V6 m$ u) J- X
- dma_addr_t dmaphysdest1 = 0;, b/ |+ \' o% C, {4 `
- dma_addr_t dmaphysdest2 = 0;
# \ f/ X# V1 b9 s
0 V) d* J4 T. n6 f* t- char *dmabufsrc1 = NULL;7 T% X+ Q" k8 {( I# }# c
- char *dmabufsrc2 = NULL;
. F+ L6 C/ G: c3 [% @" P - char *dmabufdest1 = NULL;
7 o; W+ ~& p7 z) _ - char *dmabufdest2 = NULL;' P( ~6 W+ @7 T# d
3 L" d) R- n& n% d5 Q7 {- static int acnt = 512;, n0 g7 K1 E1 g4 Y. [9 a$ q
- static int bcnt = 8;, J1 v7 k8 t$ \) z5 R4 ]
- static int ccnt = 8;. S4 ^& w# [5 k G( M
- ( k4 a( z* C1 b0 i* G/ w5 k+ M/ _
- module_param(acnt, int, S_IRUGO);3 M3 I$ S, s- i4 B" j
- module_param(bcnt, int, S_IRUGO);: G: E1 X8 A. {( `4 c
- module_param(ccnt, int, S_IRUGO);
复制代码
1 ]3 B" |8 Q% Z O& Y% l% }& ]& l- l( w5 V4 N- C: c4 g. O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 d1 \* C0 D! d4 s+ ]9 @; v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 \' m; W; L% U/ ?9 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 T m* Z! W. A9 [; C' `
3 t3 t# k" o, H8 {2 j2 `4 z/ m
& z' x/ E, y, }) J3 @
|
|