|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' q' ^; {% E0 p
- [code]EDMA sample test application& n) j2 Z8 m. x& y, F1 v% w4 _( H1 K4 e
- /*+ \" C$ l# O3 ^1 a, i7 ?
- * edma_test.c* W) ^. ]5 D; b, z1 X4 Q: Q
- *
2 W: U8 g- i! K* d! d W - * brief EDMA3 Test Application
+ M% I: d) R% |) W9 C. b - *$ B( G0 d2 i$ @7 A- M8 b
- * This file contains EDMA3 Test code.
% ~! G% ^1 M( } - *, {# ~# |3 _7 t, K& `( |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ }2 b% x" R, e$ K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ U# W* P) q8 S% o C `' p - * TO CHANGE./ v, T1 n2 O3 z8 u; ]% |) F5 ?/ P
- *
5 ]/ S0 a$ H& A) `$ C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: m+ s# ?$ L6 n6 U$ Y
- *3 G; \: I7 a$ m6 t; ^- ?9 _
- * This program is free software; you can redistribute it and/or
d7 I' I7 w( `6 [1 p - * modify it under the terms of the GNU General Public License as
9 f8 t5 ], P' e# F5 L - * published by the Free Software Foundation version 2.
7 R* `0 V5 X$ b. i7 k$ p - *
' q# L- B8 M6 W, s/ N; l6 m9 |; n' r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- S. S" m4 j" q/ y8 b
- * kind, whether express or implied; without even the implied warranty6 s6 W( Z8 g2 C" U0 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 Y& ^1 T% d# [2 q) m$ f - * GNU General Public License for more details.% m- P; w" W+ d7 n) d
- */3 B- b& H. @7 d" B, \5 d/ g
- ; k( ^1 L$ D8 v+ G; J# f
- #include <linux/module.h>
7 v8 H G* |( g0 m+ Q5 ~+ [1 [ - #include <linux/init.h>
% J4 ~/ H- g# n2 V* g - #include <linux/errno.h>
7 v/ `9 i; [. _' W8 I2 ` - #include <linux/types.h>& T. I' y) Q/ q' q F" ^1 b9 _: P( l
- #include <linux/interrupt.h>
$ }% h2 d; H3 E, C; T - #include <asm/io.h>' t: N2 p% ?$ R! ^& j# ?$ f; ~3 a
- #include <linux/moduleparam.h>( n8 m4 R0 B6 | d9 i2 N
- #include <linux/sysctl.h>0 }9 Z" U { f% i/ t7 }
- #include <linux/mm.h>7 q, y9 [7 p1 E
- #include <linux/dma-mapping.h>* G) `6 o' T* R' E" [/ C; A
/ Z) O/ \: c: ^9 c, H; \% F- #include <mach/memory.h>
1 p2 d: }: L5 H5 M* x5 Z - #include <mach/hardware.h>+ E/ d& c/ [% ^' T
- #include <mach/irqs.h>4 [6 }3 Q* `' { i0 U) s
- #include <asm/hardware/edma.h>% t, c$ k& T7 X
- 8 N1 ~ H: \& T3 [2 @. r* p5 v
- #undef EDMA3_DEBUG
, }8 n2 `; b1 \& M) C - /*#define EDMA3_DEBUG*/
, ?* {) W7 F! Y& k
' M O1 H/ o4 f; o a5 o- #ifdef EDMA3_DEBUG
j9 r) w2 ?* G$ y; B' A$ h/ [( q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 K- o% T8 r, [2 H# B. @6 y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 X5 I# y: N- Y/ q% M5 F; y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! S7 d$ o$ s: Q0 }6 @
- #else) Q( B% w8 ~9 j+ |/ t Z* k* @
- #define DMA_PRINTK( x... )
) @3 ~7 {, k0 |- a - #define DMA_FN_IN
$ \) W+ B& h' K ?; I/ K, w/ X - #define DMA_FN_OUT3 H5 O. Y( P: X/ ~
- #endif$ _; H$ R0 Y+ F( g
- & f# ^) e2 D" g8 W' M# \, g/ a6 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' M% m9 U5 }% W8 ]& X
- #define STATIC_SHIFT 3( e+ `* B' c1 a" T! ~
- #define TCINTEN_SHIFT 20% |5 D: R) X, }) U
- #define ITCINTEN_SHIFT 21! \ ^1 ^6 [% N' _+ o: y* w; c$ N
- #define TCCHEN_SHIFT 229 o/ ~( ?' V4 ?3 |
- #define ITCCHEN_SHIFT 232 f5 f, V6 y; A0 I- K
- , u' F; {: O+ [
- static volatile int irqraised1 = 0;( [! N7 c- R2 x' O2 }5 H& z* \
- static volatile int irqraised2 = 0;
G' D* @# h2 Z% A9 y; r6 g
* n0 a0 i( z1 Q" X) ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# h# ], n' |8 e% `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M4 A6 x, }4 ~, H+ S: x* C( F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ M8 h& X) ~+ a' x6 K; j5 x
! w# @- J: v* w Z- dma_addr_t dmaphyssrc1 = 0;2 L8 A, Q& T0 A# C2 y4 x. v0 ?& z
- dma_addr_t dmaphyssrc2 = 0;' V4 h# ^/ m6 o$ n
- dma_addr_t dmaphysdest1 = 0;# k! e( d$ \/ H* Y: g5 \5 v# ~6 q; ]4 u
- dma_addr_t dmaphysdest2 = 0;5 B! {: x/ |- |. c
- 9 r4 H5 ?3 m4 ]. A
- char *dmabufsrc1 = NULL;! \. V9 `" Z4 `
- char *dmabufsrc2 = NULL;
& c! t& x3 {. m - char *dmabufdest1 = NULL;
/ m0 l) q- S5 x3 U8 ^* T0 U - char *dmabufdest2 = NULL;
, G2 i0 _* _, i, _' E - 4 x9 `6 h: }* V4 S( b
- static int acnt = 512;
9 z; v# a! U+ }) K H - static int bcnt = 8;
0 p# n# |# G; B0 g* J, G - static int ccnt = 8;3 C8 [! x3 R# N8 ^
- 8 G8 C( f" t) j* d$ m# t. p
- module_param(acnt, int, S_IRUGO);
l7 J9 f" i$ _ - module_param(bcnt, int, S_IRUGO);
+ s8 g' h y# p d% h4 g: Q - module_param(ccnt, int, S_IRUGO);
复制代码
9 U9 M6 s) e b9 h# q% U; R, B. s2 i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& U1 G; y1 c* [6 I% J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 c7 j {% N+ P" W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 R) l; V/ V7 @
& _' m7 I5 r6 Y" R" L
$ w, q$ l1 A# I7 N7 Z1 ?) S |
|