|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . ^9 Q; Q* a' P$ c# O. p/ J
- [code]EDMA sample test application& U- d. O# F. p6 Q% m+ B+ _
- /*9 S6 O2 U$ K; x/ y& l
- * edma_test.c9 h! n3 i; C/ o- z: T5 t9 Y
- *) l6 R: \$ _5 a# V! `: e
- * brief EDMA3 Test Application
! `# z+ M, D8 _. _ - *
; q) T. V/ X4 e# A: v* e) |2 A - * This file contains EDMA3 Test code.
) l+ R3 {& U" t' j1 K* O - *7 }7 a- x g D4 ?- f& m5 O+ m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# V9 [# C% H# e" V* g& P! _) | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! ?$ K- z+ Z! T+ `
- * TO CHANGE.
* G3 x) r. v/ Z/ @( e) J - *0 k6 P- N; R( ^8 N' g4 b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( O- G+ a4 R/ }# A% s3 H
- *( y( M" j. f7 v, x# e' U
- * This program is free software; you can redistribute it and/or
% H7 s" J4 K% l9 c - * modify it under the terms of the GNU General Public License as& o! V' \3 l' D4 P* d# Z& F
- * published by the Free Software Foundation version 2.: g0 O9 Z% G5 x" N7 b
- *
" C+ b. Z; b# c7 C$ T, T% \: c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 n- W8 t5 N3 u2 N$ @6 G' t
- * kind, whether express or implied; without even the implied warranty
* Y: W7 G# ^ ?! N, f8 ?# o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- W- B. v2 o4 c& z
- * GNU General Public License for more details.
# H* @2 r% G9 C9 } - */5 `, R0 V p- N% X+ _
~2 A( V& q1 N" V# F9 l7 J- #include <linux/module.h>6 K3 F" g# u8 W4 S. T4 y4 {) ]
- #include <linux/init.h>0 z l0 A) ^" y: J
- #include <linux/errno.h>: ?8 |$ v9 Y, ]% h
- #include <linux/types.h>! L( K; n/ u i
- #include <linux/interrupt.h>1 \" m6 O d$ B2 z5 O
- #include <asm/io.h>
( W( [6 n- ~2 }( l" A+ I7 M - #include <linux/moduleparam.h>
7 o, B; r" W* J+ N) P - #include <linux/sysctl.h>
9 C! k/ ~" m3 Y1 M" M: N+ c - #include <linux/mm.h>; d, x- }7 Z( g5 W: f
- #include <linux/dma-mapping.h>
* d8 E3 B% j/ D: w. T7 k; A
' V+ x; L! {" i- B) k- #include <mach/memory.h>
( U8 b3 o2 H# S% {: s - #include <mach/hardware.h>
' V5 l& Q! M, l1 L/ L. y - #include <mach/irqs.h>1 w4 X3 C, G s, J
- #include <asm/hardware/edma.h>
4 v% I$ n4 `& e* |9 @ - : h# I5 o0 X- h& R/ e: ^( Q
- #undef EDMA3_DEBUG
% B" O6 w% [4 V6 t& z* S' E2 Z - /*#define EDMA3_DEBUG*/4 Z7 S/ E- J5 ~, ~6 t1 `
1 O. O X5 y$ A _' l/ f- #ifdef EDMA3_DEBUG$ v; N0 x0 O: K# V) U3 L; _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; C2 g. }! h5 W# t# X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; A/ p5 t9 w' v: p) S- O* L3 k9 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* o9 \$ |9 o$ m+ j9 d - #else* T6 }* Z6 s4 W& t U7 N
- #define DMA_PRINTK( x... )
, w3 p' ?* q! n' D: Y. {/ O4 e$ P - #define DMA_FN_IN
5 M7 _2 N! t3 { - #define DMA_FN_OUT
5 `$ `$ G( U0 z1 C! E1 n - #endif
, V) ^: F& r: A: { - / ~) b- z o" ^; T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ g8 ?: I3 ~2 ~4 i8 m: [. I - #define STATIC_SHIFT 35 D6 U: ~5 q0 W3 @
- #define TCINTEN_SHIFT 20 C2 a6 ?# U; G/ N
- #define ITCINTEN_SHIFT 213 c' r7 ? ^* F+ ?& B" ^* N* N% N
- #define TCCHEN_SHIFT 22/ q ?: e* E- j. N5 Q5 c4 i
- #define ITCCHEN_SHIFT 23
n) t, V% \8 H! h+ l: W
& |2 y8 N" j6 H6 ^6 x8 c0 Y/ s t- static volatile int irqraised1 = 0;
! Z3 y& J) G* H5 M5 A* g; [ - static volatile int irqraised2 = 0;
9 p- L1 w/ }) z- e; `% N) V% {2 T) }
) X; G2 f7 S2 u) N: b0 M% H, j. @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
P; ^! F% {1 f, J! q0 g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. J: r2 t6 ^% A9 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( R+ Z! Y E9 r7 L& h
- ( ?" T' b# A. s4 u' Z" K
- dma_addr_t dmaphyssrc1 = 0;2 x) x2 G# E" {- H3 n1 U* {1 u
- dma_addr_t dmaphyssrc2 = 0;
' d6 `% @' D2 o& S - dma_addr_t dmaphysdest1 = 0;
: T5 z. ^5 k9 A4 T X* [ - dma_addr_t dmaphysdest2 = 0;0 b9 Q9 E d O4 t( H
- : }( C- F) x/ r/ z- f2 }) p; d) {
- char *dmabufsrc1 = NULL;
$ v, `! y6 y2 l1 V. r1 M/ b+ a u - char *dmabufsrc2 = NULL;8 r1 m+ H- ?2 t/ e" H7 ^: [2 H
- char *dmabufdest1 = NULL;' ^ r8 m# G2 O6 |( V
- char *dmabufdest2 = NULL;/ o) L1 `1 U3 U' G2 W a& g; m3 _
" h8 u0 M% C! S2 i' X- static int acnt = 512;
: ^0 r" P6 r( H* i& t* F - static int bcnt = 8;3 y- g+ G @/ Y2 [
- static int ccnt = 8;
8 m; t- M* N3 s5 V7 Q
8 m9 v) q, m& K- module_param(acnt, int, S_IRUGO);: ]5 q# }; V. n& g9 U
- module_param(bcnt, int, S_IRUGO);. y& \4 ]& @2 Q
- module_param(ccnt, int, S_IRUGO);
复制代码
5 j& p1 l4 z. f, D4 r6 c& Q, B
& l* Y& U' W" m5 Q% L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' y9 @2 M0 s- ~9 f2 G! garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 E" k: T6 f/ d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ I, T) l8 _, o" l0 u& K! l4 }
8 b; S: w1 D) L. h* Y2 b5 v U0 O. I1 h4 f6 _2 Q
|
|