|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & d/ p; p. Z* [* O
- [code]EDMA sample test application
) y# s( s' s7 G1 i! u - /*
" W' G" T4 q3 O5 D4 H - * edma_test.c/ R" b$ ^- q$ U0 M. p, w5 A
- *
3 d" `. {, w, ^, e* K - * brief EDMA3 Test Application
8 Y7 v4 f0 j' a1 i+ A9 W - *8 P* e$ n9 U9 i: s
- * This file contains EDMA3 Test code.
) }, u0 z7 V: ^1 {2 B* B - */ x; ?9 @# a: L# f' F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; B1 u1 d/ h0 J& T! E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; t+ F$ ?$ J$ P: ~3 j: r1 O3 L; K
- * TO CHANGE.
7 t0 l. _4 H) i2 ]: w: A - *: p6 J1 ]' Q# s% q. v- U G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, I0 V/ q6 B% t0 ~
- *" F: K" H5 o% _/ n- J$ k/ o- Z
- * This program is free software; you can redistribute it and/or2 d8 t' _2 ]! b- @" ]' w
- * modify it under the terms of the GNU General Public License as* w( r/ \* |9 k1 |! T& S' [
- * published by the Free Software Foundation version 2.$ e& P/ e* o( B- v) h
- *
1 _6 n5 c4 g/ M4 K% R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: U$ M+ r: W) Q0 p% h: w& _ - * kind, whether express or implied; without even the implied warranty
2 R! C/ t$ _6 E7 V6 @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: G- I4 ^9 S9 x( V2 w - * GNU General Public License for more details.
( j( f! I2 y* \- m V# _ - */ m' L& e$ q+ ]2 P
0 r* u" ^0 \, Q$ U7 Z- #include <linux/module.h>
' c. ], T! e( S4 e - #include <linux/init.h>
; w4 _7 `8 w) j - #include <linux/errno.h>
, d7 L+ D9 L$ ?) B9 h - #include <linux/types.h>7 o. t D& ~ V3 L( m! c4 X
- #include <linux/interrupt.h>
0 _- Q) R8 k, y$ e& V2 ~# N - #include <asm/io.h>- Z! u6 W% P c9 t8 i6 q" V9 P
- #include <linux/moduleparam.h>% t3 Z7 B; B6 g, ^
- #include <linux/sysctl.h>8 `9 M! Z7 ?# }. r8 b- w |6 a
- #include <linux/mm.h> s5 T! h8 l: r4 ?3 L- `
- #include <linux/dma-mapping.h># y+ l: J r* a2 a6 c; O! H
# ~9 i/ ` A7 P( K) [- #include <mach/memory.h>
% Q9 O3 e. l# B+ Y - #include <mach/hardware.h># ~$ I9 ?+ @+ L3 d/ u- c. G8 n( C' I
- #include <mach/irqs.h>
8 _! m8 _% ^ d0 {# k; F M3 M - #include <asm/hardware/edma.h>
" |- J+ o: b6 \, r
7 O$ h" t& Z* P( w3 j' @! H9 C- #undef EDMA3_DEBUG5 k" b0 M, y. z( o, E5 C. k
- /*#define EDMA3_DEBUG*/% B& p# ?& x6 N: m
6 a( m+ S K# g" V m7 j6 l- #ifdef EDMA3_DEBUG
6 `6 r B9 Z4 O3 f5 g0 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 ^5 n* g7 K1 T. `( n& q7 M- D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 v* y7 ^7 r9 K O0 s% I+ V# |) v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) k! f8 m0 r0 o1 X - #else
6 s- P& R" w. K/ f. e2 D$ @6 L - #define DMA_PRINTK( x... )) E" f5 V6 x/ B
- #define DMA_FN_IN
; b# X' I1 t4 y. A) j2 S - #define DMA_FN_OUT
# R, G5 _% I8 F3 h% W - #endif8 C& A4 _: H' g; i/ { H! B
}% c# t, _; K; T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ C# q& Y, u8 S/ k$ K. \ - #define STATIC_SHIFT 39 \4 ]: o' c" [* Q/ o; Q# t
- #define TCINTEN_SHIFT 20# p" E3 T% ^5 I
- #define ITCINTEN_SHIFT 21" q1 p% i" z+ c; h
- #define TCCHEN_SHIFT 221 S/ ]/ Q/ O- n6 l1 c
- #define ITCCHEN_SHIFT 232 ~- u) l+ s- r! L" P& Z
1 E4 L. E3 X1 C7 h/ j. s- static volatile int irqraised1 = 0;
0 ^, q0 b7 J S9 S8 }- w& Q - static volatile int irqraised2 = 0;
5 r% F: ^8 F! p9 o& }$ }
/ o3 q, Y, o( @8 F4 L1 L3 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ c- \8 h3 B* ~4 x( L/ c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); H+ X% K4 p8 L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- S" U4 y2 r- n3 B
- 6 G. ^) O8 W+ \+ \
- dma_addr_t dmaphyssrc1 = 0; z- u: ?/ o/ m2 v
- dma_addr_t dmaphyssrc2 = 0;
5 E+ [7 t) n0 [! Y - dma_addr_t dmaphysdest1 = 0;/ | I1 q1 R! {, q
- dma_addr_t dmaphysdest2 = 0;2 z7 R. E0 }6 n$ P7 g* J. h
- # x' [0 }" d) Z" o6 O8 [- \
- char *dmabufsrc1 = NULL;
) h5 y2 F: D! v9 x - char *dmabufsrc2 = NULL;
$ j4 X4 V {4 @% ]$ e - char *dmabufdest1 = NULL;
9 f# p3 X- }, j2 N" k% R - char *dmabufdest2 = NULL;
/ F. T: v1 h: X - % F% m n# H8 z4 W
- static int acnt = 512;
8 v7 l6 o. u6 F - static int bcnt = 8;: E; m! P' _& C0 s+ Y7 R" I
- static int ccnt = 8;! t) c2 Y& E; i
- ' }! C8 \5 |% U1 y" j: L/ X
- module_param(acnt, int, S_IRUGO);
2 v) N2 K* i7 z$ B' w3 y/ ^9 p7 C - module_param(bcnt, int, S_IRUGO);
& }8 g+ }* W6 _ - module_param(ccnt, int, S_IRUGO);
复制代码 ; E8 G% t" n, S% {
' b7 t( B# z2 Q& ^+ s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 N6 h ^- c) o" ^9 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: D0 X) ?0 W* k g0 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 D) G4 x% X7 n* C: f ?( C
; k7 S2 Y* R6 H9 a; y, S6 I) U1 V! n6 C( |* @
|
|