|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 `' w% V8 Q4 S7 u% E" h, N1 Y- [code]EDMA sample test application
* X- B9 [5 K' `0 ?$ ?+ } - /*, Y7 _7 F. f' [( z G
- * edma_test.c1 Y$ N7 H0 g6 S) Y4 O- k
- *) q8 |/ ~4 R0 U0 ^
- * brief EDMA3 Test Application1 z9 z# W# ]( ]1 Y. i, J
- *
/ g* p; I! M; ]/ y - * This file contains EDMA3 Test code.
) v! W- h6 L! h" ^1 x - *
6 E& d) M+ z: ?, f# d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- b0 B$ J: }! u) f1 N! m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! U) v9 R8 D& X' I4 f: v& f
- * TO CHANGE.
. ~3 f( S5 B0 Y: }8 `- [3 N" H1 k - *
" F \, l. w2 |" W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" w9 }3 A' m& U$ d6 Y3 |8 F
- *' ^2 ]5 }" f n& V; \) m9 e4 G
- * This program is free software; you can redistribute it and/or* P J# [0 V5 M* Y: |# i8 I
- * modify it under the terms of the GNU General Public License as
' c5 k" O) u: C; E - * published by the Free Software Foundation version 2.
! E2 y4 y7 w7 j M- W - *: G3 l' Y! j4 Q( x- V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) U3 I W W9 P5 E# y1 a4 |* J4 ~6 r3 p# |
- * kind, whether express or implied; without even the implied warranty
0 E, T- W/ d; ]$ P0 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 D' Y- Z) n: S9 ?% o
- * GNU General Public License for more details.
/ L, G+ D) Z6 Z - */
; \8 Z l; S( i& {8 m4 p) i - ) s/ T0 T5 R9 f5 L( |, D
- #include <linux/module.h>
7 M% h6 R0 u( h* B( W - #include <linux/init.h>9 Z- p$ r7 s5 Y
- #include <linux/errno.h>
: a- w: k0 y/ T* L - #include <linux/types.h>
8 [4 T; k. w# T) N- ? }) p' E j - #include <linux/interrupt.h>
% l. j. r2 x8 F% K0 L6 P - #include <asm/io.h>
- [( s2 t. Q1 `0 U- i - #include <linux/moduleparam.h># Z1 X/ `1 j0 ~3 Q) `1 v( y: [
- #include <linux/sysctl.h>
3 R: H+ n, V$ z5 F - #include <linux/mm.h>5 O5 q6 {6 Y+ s2 `4 n2 ?, {% O
- #include <linux/dma-mapping.h>4 D3 }9 |* j# K6 ]
- ' t* s F6 J! A) c+ j/ v
- #include <mach/memory.h>
+ Y8 j1 e" A" }- x! t/ ]7 J9 R - #include <mach/hardware.h>. A5 v6 j3 L" ]$ ?& b5 K% t
- #include <mach/irqs.h>
" x) V U6 a& }; i0 z - #include <asm/hardware/edma.h>
7 B9 Z" m, p% \+ t- ^ O - 8 E4 ]1 {5 \* A5 {' B2 {& ~9 l
- #undef EDMA3_DEBUG& s4 l8 D: @# U3 ?$ |$ ~
- /*#define EDMA3_DEBUG*/5 w" p$ c0 x; P2 }& O% ?3 }
- 8 i4 D2 i, u9 r: y
- #ifdef EDMA3_DEBUG& Y3 E. M3 e6 k, g4 d! I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. s) {6 \" _6 C: Y2 G) ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): Y+ a8 g# g0 q& A* q" N7 }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 _) S; g$ T% m: f. V - #else
2 G- j$ M- F" l3 X# E& b - #define DMA_PRINTK( x... )
- l; Y2 V3 n7 t3 y' t5 }) } - #define DMA_FN_IN
. E1 B4 Y7 U# R+ \# i - #define DMA_FN_OUT: h+ S) I6 N0 ?. L
- #endif0 C5 k1 s% ]. X0 D$ d: N/ p" w
0 x5 E0 n/ c& f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% k; C( P. B9 v+ R( W; q" e8 K - #define STATIC_SHIFT 3
/ G; I( d7 `% c$ V' X - #define TCINTEN_SHIFT 20
5 C! S( A8 N7 h, ^ - #define ITCINTEN_SHIFT 21" o# U. {* V- S; ^$ G8 P
- #define TCCHEN_SHIFT 22
* e! @6 l: g6 @* l - #define ITCCHEN_SHIFT 23
' ?" I# I9 Z3 a+ K0 c: Y7 M! h - ) e$ K, Z' o$ q5 y
- static volatile int irqraised1 = 0;
, r+ [) l5 I( Z" s) v- { - static volatile int irqraised2 = 0;
/ W2 L8 U `/ j& m& V0 {, V; A - . L. S4 d# w- D; h- U( J! n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* i- u: h$ n7 ~. h2 @+ E2 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 C9 x6 P$ _4 p4 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N$ L; x" g3 B4 o, h
- # {8 Y# H7 a9 h+ w n! u0 b6 i
- dma_addr_t dmaphyssrc1 = 0;9 s7 [% w) {# g$ b
- dma_addr_t dmaphyssrc2 = 0;
6 u7 H* g$ c( w+ Q: L1 L - dma_addr_t dmaphysdest1 = 0;
$ V/ v+ ~$ ] @* n - dma_addr_t dmaphysdest2 = 0;
5 |8 E" J% ^7 L2 i' ~3 m" c) p h - / q" R& [. {! R3 V
- char *dmabufsrc1 = NULL;' m( m0 e8 n2 o; G; [; z. L& V
- char *dmabufsrc2 = NULL;" ?9 x+ v6 R j. `
- char *dmabufdest1 = NULL;
) w! O4 j8 |; c j! J6 ^ - char *dmabufdest2 = NULL;- U" w+ G4 x" s
- $ N, I& t; E( l j1 T
- static int acnt = 512;# k6 Q% ?& M( y d& Y. M
- static int bcnt = 8;
# f, I0 w3 I2 V! t& S9 t - static int ccnt = 8;
1 Q, m: e- g6 ]" b, G1 g: K - 0 M- ~/ H7 v! `# d
- module_param(acnt, int, S_IRUGO);
- b$ {, M+ L- o - module_param(bcnt, int, S_IRUGO);
, I; ^! L( `5 s. X, U - module_param(ccnt, int, S_IRUGO);
复制代码 # G! Y% f8 c7 Q/ ]' u6 R8 w' L0 S4 e0 o# c
# S6 G! P% [1 |5 [/ i5 |1 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# q2 ^# y* N7 Y0 f/ W* `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 P/ z" |/ \* \( d( K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* x( V6 E) [/ D* Z: W p: B5 F; e, a* Z7 X. ]# z
9 S8 L% G, s4 ^# X9 J( |
|
|