|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * [# R( E. B* O+ s0 [! r; P# b0 E
- [code]EDMA sample test application; q* s5 ~( g; U( N0 M6 O5 T
- /*
0 \1 N2 a5 a5 z, ^* U4 u6 d/ d7 n - * edma_test.c
; D: P# M7 {( q+ X% } - *
/ W! |5 _/ C! _. F4 ^$ B5 m - * brief EDMA3 Test Application
) C0 ?" I; g' Z1 ] - *
( i5 T6 @! Q( R6 x - * This file contains EDMA3 Test code.' P2 L: G' `/ R
- *
/ p( u) h* V6 [6 \, m9 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! B4 U S: }2 r3 \1 ?. n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' m% }4 n$ J8 p% g
- * TO CHANGE.) H* P1 D z9 U% P) o
- *
+ g7 [/ l$ i# ~/ V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 @5 q( Z& C& U/ |# u - *3 @8 n) m- x- m6 D+ b. @4 L
- * This program is free software; you can redistribute it and/or
9 @/ p3 r y. Q* | - * modify it under the terms of the GNU General Public License as f q/ N9 n( n2 L1 G: x$ a
- * published by the Free Software Foundation version 2.9 R" k, E8 G m N
- *2 _! y7 D; d* Q% O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* B2 S6 A: H0 n( K( {/ L- Q3 \
- * kind, whether express or implied; without even the implied warranty ^* @! }/ l: b, M& T% N: A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% ~$ T' \# L; t1 h& A- s0 l K - * GNU General Public License for more details.
+ Q$ D* @; |9 t) N+ I9 K - */
4 L# ~) n5 k9 @ - 6 K8 R+ M6 y/ _% F4 ]! _. o# g
- #include <linux/module.h>1 M' O. f8 @9 _) e5 j$ e
- #include <linux/init.h>! c1 y" F9 B2 |) a9 d* ]: |) T- G
- #include <linux/errno.h>
' @1 Q- J- k' i/ s4 b8 Q7 @- e - #include <linux/types.h>: r" q2 L/ ^2 ]* O
- #include <linux/interrupt.h>+ F' g: x1 q6 n; R- J- @5 h. I/ k! H( g: K
- #include <asm/io.h>
$ j8 d2 s& [6 i8 D4 M3 a9 W% v" ?4 a2 d - #include <linux/moduleparam.h>5 u/ v5 k, B/ ?
- #include <linux/sysctl.h>
; Y: Q. C. ^; p" w - #include <linux/mm.h>. W4 S/ G6 p+ |- W, l8 L
- #include <linux/dma-mapping.h>- @. K# N; w" o* C2 N( v
) V$ ] n' A- q5 K; E- #include <mach/memory.h>
% q. d l- j4 a - #include <mach/hardware.h>' O A8 Y9 j0 v% J; r4 Q" w. y; O
- #include <mach/irqs.h>
6 @6 w* C: o7 P- m - #include <asm/hardware/edma.h>( O& Q# d+ }3 z, y5 c
- ; g! a& z3 q- j) B; q
- #undef EDMA3_DEBUG
$ G A2 @, Z9 U/ ` b - /*#define EDMA3_DEBUG*/
" m J& ]; ?& \$ c" B0 { - - s1 w3 e5 v1 k, r2 o$ I
- #ifdef EDMA3_DEBUG8 R' V1 @5 R2 [* b; V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! {, L, m O- {! @% _& L) s; q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 D& Q) k4 l4 T8 f1 b% r+ k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 ]2 |* A j. h0 {+ \7 y( Z - #else
) ~6 S" T# B+ m. A. ?: s1 m- u- k - #define DMA_PRINTK( x... )6 [# t- B- l2 Y7 L- V6 r3 y/ |4 n
- #define DMA_FN_IN
* ]# w8 g3 m/ t8 M - #define DMA_FN_OUT# d' I/ Z7 x. @: f( \
- #endif3 q$ N8 O9 T- z3 ?$ j
8 t& W) e _8 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ m" Y, a2 Z# }. l
- #define STATIC_SHIFT 3
, W& [/ I9 D! j4 n - #define TCINTEN_SHIFT 208 q: P, [! P* F' h6 j* L, Q' I+ A
- #define ITCINTEN_SHIFT 217 v% G+ [ W* g! A9 G0 v0 v: y
- #define TCCHEN_SHIFT 22# V" d4 q# S$ D9 `5 A3 Q
- #define ITCCHEN_SHIFT 23
. X5 a6 G; }0 e5 p$ }
; C. w) G9 w3 u7 i( V" r" R4 F- static volatile int irqraised1 = 0;
1 y- f% C5 b/ i% F- j, G3 d - static volatile int irqraised2 = 0;
$ Q! j! l* U" w% X
+ F _) y. e) S: l: Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 J% }2 E, i+ n' ]) u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! u' h4 u. d2 S$ W- J2 y- B) i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* X4 w3 \2 x& ?; p% i
! @2 _4 W) _; a; q* U- dma_addr_t dmaphyssrc1 = 0;
% R' P* f: `% B - dma_addr_t dmaphyssrc2 = 0;- O& K3 H( ^. y; W: R
- dma_addr_t dmaphysdest1 = 0;
. C: `9 `% E5 N m- O. n - dma_addr_t dmaphysdest2 = 0;& h- k3 A7 @2 `: \
- ! K6 P! c, p5 n/ e9 c. @7 ?
- char *dmabufsrc1 = NULL;5 \$ D7 O; h0 E% h2 i
- char *dmabufsrc2 = NULL;* L% ]1 {% E! I" Q' G7 r C
- char *dmabufdest1 = NULL;
' D/ @3 `4 v; | V - char *dmabufdest2 = NULL; |, l+ ^, ?. p# G
( n( q8 z7 z5 R- static int acnt = 512;3 i5 n' c* u4 h0 o% S
- static int bcnt = 8;: F5 Q3 N9 C c4 V8 G/ V# r
- static int ccnt = 8;
) s: D6 r# x5 ]$ P. E, M- r+ f5 C
# K7 C6 v/ N8 B4 d: H; d- module_param(acnt, int, S_IRUGO);4 j3 q$ Q2 C# y: l6 {
- module_param(bcnt, int, S_IRUGO);
5 g ^) S3 N' L* i - module_param(ccnt, int, S_IRUGO);
复制代码
0 ~* U3 k. w4 c7 ?0 ~6 [, U, l
: D( ^8 \( a! q0 z* ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ l! j; P& }3 X+ Q6 |0 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
w) \; m3 ]! @7 W7 p5 h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* n) _. n: ^* }8 A3 V' Y( |7 g' v& ?
! @0 u# K$ b) B, J$ u
* v* P3 @# F& @% Y& D* g0 A" l |
|