|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' ?* |/ d J, }* p$ ~- [code]EDMA sample test application
- Q$ w% D" a/ M' b% Z- o- H% d2 s - /* q& b! L6 o) I" R, g
- * edma_test.c
! b8 ]/ m1 o! M6 ? - *
: }8 Y5 t+ p. u% ^+ L - * brief EDMA3 Test Application' ]& }4 h0 T; ?0 ]. h
- *
$ C# X: A6 f0 z0 i - * This file contains EDMA3 Test code.
4 ?. W. X$ a: }' \; X, T - * c) K: f* C* j8 p& K9 x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ l% D3 d2 N! @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ k: U& ?: m9 i$ h i, O* x - * TO CHANGE.
. X( m3 {7 c1 L2 S - *3 Q: b7 e; Y; e7 v8 Y7 e7 W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 ^$ c) u' v* W! |- c8 W - *1 t0 r; T6 b ?
- * This program is free software; you can redistribute it and/or
3 _2 V }: s/ U, T2 v - * modify it under the terms of the GNU General Public License as N4 | e6 B' \# h) o1 U+ e
- * published by the Free Software Foundation version 2.4 T6 Q$ d1 W' I# c
- *
4 C5 e8 c/ o% V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! A$ T) h0 F* Z4 }; x - * kind, whether express or implied; without even the implied warranty0 P$ K2 `; b+ P( q# p& g' R* ^8 o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 I7 L$ x1 P# r; c8 E. H2 m1 n; k - * GNU General Public License for more details., e# ^0 u0 Y$ `& X' i
- */
0 n1 N0 M, u/ b. a& ^" Y - 9 {& I& @* I$ a5 J. M' U
- #include <linux/module.h>
9 r1 F# J0 \$ \5 z) n1 { - #include <linux/init.h>
1 B6 w3 Y, f, h2 R V - #include <linux/errno.h>! E% T' W1 j+ c* r
- #include <linux/types.h>
+ v' q& K0 P8 H" y# D$ k - #include <linux/interrupt.h>% n0 w6 _, {' k5 s" G
- #include <asm/io.h>6 B+ w4 o* v. T$ s, I/ @" N. d
- #include <linux/moduleparam.h>0 l r/ n A; g. L* Y& ]
- #include <linux/sysctl.h>
; Q& k, A8 s5 B0 g! R - #include <linux/mm.h>
1 r$ y9 I' [4 n7 R4 s - #include <linux/dma-mapping.h>/ _& W5 B' y* [" j& ]- A
- " \" b- o/ ?/ l# x* u/ d# j
- #include <mach/memory.h>
& @" Z& x5 `& t \( s, T - #include <mach/hardware.h>
5 R3 f4 ]9 @' q1 ]# V+ m, e - #include <mach/irqs.h>
: j' ]; o- ]/ w8 r5 \3 s - #include <asm/hardware/edma.h>! E, C' g% P' k' Z9 }6 b
" V& \ A9 k' w9 W \; A- #undef EDMA3_DEBUG8 w* G# ~4 g0 j y) n
- /*#define EDMA3_DEBUG*/. N5 |1 Y0 \/ |$ f) n/ V1 d) w! p# A4 W
- / _, i/ l- f5 @" n! D2 x. j0 ^& J
- #ifdef EDMA3_DEBUG
( C, d, F+ x# I) \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) u( Q5 Z1 G* @* h, W* a+ U$ k' {. F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 h* e/ z& a% | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ N( ]% p+ l0 C0 O' g
- #else# k6 m6 q9 U( y4 \8 j/ c
- #define DMA_PRINTK( x... )9 K! Y- k6 u5 O M+ D" D
- #define DMA_FN_IN
9 z- Q1 h+ ^' R- @* V" d- P - #define DMA_FN_OUT
' M4 ~, d$ J0 o. ~% c- |8 U - #endif @3 [3 D; c, \; f- R
- & W8 ~) E7 D/ a2 M6 Y$ r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- Z: ]* `- |# N( a9 i3 ~
- #define STATIC_SHIFT 3
, e2 B. q" A! X! V. @% | - #define TCINTEN_SHIFT 20
/ P; C2 q0 X; R0 \* } - #define ITCINTEN_SHIFT 218 X7 o) _, C* U7 l$ ]* a/ t! [
- #define TCCHEN_SHIFT 22
4 r/ Y3 F) X) [ - #define ITCCHEN_SHIFT 23
4 a3 E/ N& ^) I6 R8 U' E - 4 K0 q3 I& V9 b1 S# j+ b& Y4 J
- static volatile int irqraised1 = 0;7 F" o, ~( X5 g7 Z. y. ?, r" Q
- static volatile int irqraised2 = 0;
$ k9 m: H/ L! }# @
0 {& S. K! m5 H' m! @: m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( P' q6 Z! k9 g) |, P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 C5 g7 q* @9 r% h' z& B# m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Z0 x0 {$ N$ E$ o7 @
- % b# v; d( h5 }3 y! }! {& \) F# ~7 T
- dma_addr_t dmaphyssrc1 = 0;
$ t2 x' F6 n' M+ @/ p# b - dma_addr_t dmaphyssrc2 = 0;8 q1 E; v' f6 Q, }
- dma_addr_t dmaphysdest1 = 0;
/ A/ Q: `2 ^$ ]+ c: v - dma_addr_t dmaphysdest2 = 0;
6 Z7 P0 x% G8 V4 g' E" K
% J* z( i* u1 e/ y. |( {- char *dmabufsrc1 = NULL;
: l# i4 D* H6 q# @ - char *dmabufsrc2 = NULL;. \- e" Y7 t3 n2 X# Y5 c
- char *dmabufdest1 = NULL;& s- A1 n9 h0 ^5 n1 K; x
- char *dmabufdest2 = NULL;" z# U" W& e! K8 ^ H
- / t! F9 e, O( Z, v
- static int acnt = 512;
4 c, E0 s% x# X& e - static int bcnt = 8;
9 ? t" ?) d# z, B" {: U - static int ccnt = 8;% a2 y# e1 m& ^' U$ l
5 o4 w3 `* `: a$ D: O3 ^$ k' g- module_param(acnt, int, S_IRUGO);& I1 f9 g8 x1 v( l4 s) d; y4 P+ N8 O, n
- module_param(bcnt, int, S_IRUGO);
3 K2 [' ~1 i+ c - module_param(ccnt, int, S_IRUGO);
复制代码 $ k" \/ x$ r N& Z" P# j4 J9 A8 g! a
2 Y/ J* E5 O' K- R3 B5 o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 ?5 u+ G* S$ m' i# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ P8 e, c6 \ c9 Z0 R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( Z% X' B# j# {5 R& j
% O) h/ S" ]: @8 u9 W6 Q: T! a* Q* P. b( l& D0 I# z
|
|