|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' X5 O3 z: T/ T+ U6 n# r# Z- [code]EDMA sample test application
3 U+ ^! h+ Q& E% [6 H5 [ - /*- f7 ~# S0 U* W
- * edma_test.c* G$ J. }0 A3 x
- *
- W$ X7 ~0 i; U% K& i - * brief EDMA3 Test Application
5 K& v q3 u3 O: ^- k - *
5 ^5 ]; k8 B) _+ K - * This file contains EDMA3 Test code.
, [+ \8 x. L) F; d% ^6 C4 ~; P, B - *
/ G3 @ `7 E5 K9 o7 J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! r6 A' C# t% K. O, o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. H. z% H- S/ Y) L
- * TO CHANGE.
! }) T' o) P' L8 R' @ - *- z% d a" P7 G" f2 b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// w8 v/ q# P9 X) {0 y8 S
- *
( M. M) x, M2 Q/ X4 u. { - * This program is free software; you can redistribute it and/or
. I4 @* F4 D8 [! \0 X/ ^6 { - * modify it under the terms of the GNU General Public License as
; h' S2 A* S6 o$ `! d# c1 w - * published by the Free Software Foundation version 2.
9 m* |$ x& J$ L2 Q - *, d: z7 N, I6 R- V* g8 D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. R% k! @4 |/ X" N- s, F: ]) E" R/ O
- * kind, whether express or implied; without even the implied warranty
( {0 \' k2 r, b) u. { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 ], C8 j- d m, N0 n
- * GNU General Public License for more details.3 f5 n, E9 t+ D; A% N7 p
- */
! a+ T0 y, q/ V) w1 Q - 2 h( Q0 ^, Z: @/ m
- #include <linux/module.h>/ ]# {: D5 T& [+ c, Q$ [
- #include <linux/init.h>$ d |2 h& d9 x
- #include <linux/errno.h>. l D3 W$ n% W5 x2 [
- #include <linux/types.h>
, U0 L2 Y8 W/ {4 F7 G f0 \ - #include <linux/interrupt.h>
8 X! O$ }- p' E$ e - #include <asm/io.h>) z/ X. s, S, r- e8 F
- #include <linux/moduleparam.h>5 ~; \8 N" L' s9 m- T
- #include <linux/sysctl.h>1 P8 l) Y0 b) h' }: H
- #include <linux/mm.h>' {, [4 j6 I$ M. C z
- #include <linux/dma-mapping.h>
3 }8 L. m+ V1 u9 D8 h, A - / k/ I% D% d S( r& `& F
- #include <mach/memory.h>
7 Q) j' h6 H( w( \ - #include <mach/hardware.h>& {$ J. U, t& P. _+ s' \
- #include <mach/irqs.h>
. W& Q$ e6 @: ?( B" } - #include <asm/hardware/edma.h>
Z- R" g$ m2 \: X* H2 H7 F6 B
; Z9 U( ^1 R) S. ?2 w: ?- #undef EDMA3_DEBUG5 W; Q' l- S/ t S' {- A
- /*#define EDMA3_DEBUG*/% M) k* r3 A; ]% N
. I& _$ v( M2 n- #ifdef EDMA3_DEBUG
! g' r$ d1 d2 f) B! A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: Q3 g* ]! b X$ F) g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ ]/ q# C" Q& N) Z: c- ~6 F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. r4 Q3 A1 D; s/ M ^+ m5 M - #else
2 t) @( q3 b8 b9 @4 {; _4 I0 s - #define DMA_PRINTK( x... )
2 a- w* ]: g6 A$ r1 ~$ K - #define DMA_FN_IN
6 f' |# ]3 L, ?# ^ - #define DMA_FN_OUT
) ^( O/ ~9 x2 `+ U, d" P+ j7 [ } - #endif
3 @" O( ]6 \! n. ?/ R - ' Y% w. B! b& F! l' L: Z6 F% E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! K5 Q0 D9 e" k _
- #define STATIC_SHIFT 3( t' c8 w/ j1 o$ V e/ W0 p: {4 f
- #define TCINTEN_SHIFT 20
# Q# ]! `2 w/ W! a5 z j: E - #define ITCINTEN_SHIFT 21
. p# K! D2 s) a+ E7 m [4 D - #define TCCHEN_SHIFT 22! `9 {+ ^" |; J- J, I
- #define ITCCHEN_SHIFT 23( R# H* d7 f; ~
- ) g) X* f ~8 x, Q. ?
- static volatile int irqraised1 = 0;. i9 @% Q! _* c1 [1 O
- static volatile int irqraised2 = 0;
% B& ]5 Y* D' H - 2 R* ?7 h: T# u% U( |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 R b. [" b6 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 n9 E6 m( @1 A6 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
Y2 t: ?# [/ G* {: f - 7 s' |" N0 ~ L/ e' s6 G
- dma_addr_t dmaphyssrc1 = 0;
* l- P. t) x) X6 r8 [' g - dma_addr_t dmaphyssrc2 = 0;; A2 J7 G+ x; X* ~) q3 ]
- dma_addr_t dmaphysdest1 = 0;
; s; ~9 S, E/ G! d: b8 i$ ? - dma_addr_t dmaphysdest2 = 0;
- ~, Q. F0 \6 G3 }
0 o( S- w; F1 G* z1 b- char *dmabufsrc1 = NULL;' ^9 @. ]; Q( E# Z
- char *dmabufsrc2 = NULL;
. l! Z! P3 P1 O. u% G- M7 \ - char *dmabufdest1 = NULL;
2 F4 E, b/ s. }" b - char *dmabufdest2 = NULL;
& S* Z* ~7 l3 J: d8 K9 {' i
, o% d! K5 T& E0 H x6 q- static int acnt = 512;; ^/ i1 P: B, H3 j
- static int bcnt = 8;
9 [7 a# h' p0 \* u7 [4 _ - static int ccnt = 8;
; j; P$ m: Z) v3 Q" c - . |9 ?. Q" ?; T W3 l/ ]
- module_param(acnt, int, S_IRUGO);
) {, P: n0 U/ |1 H/ Z( ]" G8 g - module_param(bcnt, int, S_IRUGO);9 O! y X1 j. {& H% A
- module_param(ccnt, int, S_IRUGO);
复制代码 6 g# T$ }: t: r7 j; I
7 S2 f. y4 O+ c- X$ V. b, n+ j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) U" V& `8 Q9 C6 t
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 T$ Q9 C" X# U/ d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( N4 S+ X1 L: g. s, D: M
' J2 a( k4 s: C' _. d7 Z/ y8 d
2 R9 V4 N- v* d2 a) i4 w |
|