|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 E* B2 D( J, [6 J
- [code]EDMA sample test application
6 E9 W6 V2 Z# t' l - /*
, q& ^0 O7 c1 p - * edma_test.c
4 V4 }6 J' u. O+ K - *
4 q2 Q* Y3 p) ?, X- z; F2 o - * brief EDMA3 Test Application# n% s8 y; f* ]; ~# t
- *
5 I, W! X0 l2 L3 [ - * This file contains EDMA3 Test code.
* W1 W ]" q" ], H1 h! J - ** A# J1 ?- A' b: @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 k) i7 X+ l; m: k- H& k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! v5 }" i8 K0 k. A5 B; s$ w9 k - * TO CHANGE.
1 K2 t0 Z6 L7 h- j4 v, N - *
& v T" U4 ?" Z1 H" k4 G- }+ t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 C9 B" q, F* v) X& } - *
' L" e3 h& B( e h4 d& d. J/ R - * This program is free software; you can redistribute it and/or+ r( O% C5 N! T
- * modify it under the terms of the GNU General Public License as
$ P- Q$ H2 d) o1 l9 {1 _' y. a - * published by the Free Software Foundation version 2.
& D4 P" u( O/ f3 |5 d' M( z( o - *$ T% w+ Q( x6 O4 S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 B5 f8 L+ a3 E) }* Z8 i - * kind, whether express or implied; without even the implied warranty
- ~2 i- p0 Q6 |' I0 y" M; T7 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ _* I6 I: `3 K/ u7 W4 Q+ }. h - * GNU General Public License for more details.+ ?: M6 v. x9 t' s
- */9 B- l0 F/ u/ [! _, h
- N' s- `9 K3 L- W- #include <linux/module.h>
8 Z0 [7 n' H! k5 K - #include <linux/init.h>8 g. G( g" x4 Z( U1 g
- #include <linux/errno.h>3 f, w* e! y' h8 @* w3 v5 n
- #include <linux/types.h>
& h+ I$ n3 U# P. h/ [ - #include <linux/interrupt.h>
7 u) N: S7 ]$ v1 S2 k - #include <asm/io.h>
; L i5 d8 }, o$ j% Q, s3 {4 D. k - #include <linux/moduleparam.h>6 |2 ~ b9 b; H a3 Z
- #include <linux/sysctl.h>
! m/ j5 E; M* A L4 O - #include <linux/mm.h>0 D# ~- a4 x; x5 F) K: b
- #include <linux/dma-mapping.h>( N$ ?, s: `' y4 D8 d5 o
5 ~1 I" b+ H% a3 j4 r- #include <mach/memory.h>
1 T7 t6 c: {! o - #include <mach/hardware.h>
1 H m: M; X/ c4 z - #include <mach/irqs.h>
6 r$ a% s# t/ L8 J0 @ - #include <asm/hardware/edma.h>
) y3 G s$ v4 g F9 k) @1 u - & E" c% }6 K& A! O8 h
- #undef EDMA3_DEBUG# R; S n; g5 D
- /*#define EDMA3_DEBUG*/
' g, F+ ?6 h' c! X4 d
. @# C0 V1 o; j6 p8 k$ |1 c4 `- #ifdef EDMA3_DEBUG$ [" N' @! I7 z. G7 W$ x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" a% Z3 u/ R" s' Z2 [2 j# z" R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 R6 g8 w5 N( _; @" e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 N* G& q- g4 A' v8 _ - #else3 P8 h& N4 {% d* C* K3 r
- #define DMA_PRINTK( x... )
, S+ s* Y* V& I3 | - #define DMA_FN_IN
" d& E8 L3 q/ b2 J2 @" H - #define DMA_FN_OUT/ y0 m0 s4 R% y5 E0 W0 q
- #endif
6 R/ K6 \) |3 s
- V: a) \& ]4 ?( v- #define MAX_DMA_TRANSFER_IN_BYTES (32768). f: \3 I% |" J" f% |
- #define STATIC_SHIFT 3
' _; @) a- E% m6 C - #define TCINTEN_SHIFT 203 `0 e& y% p: E+ y' r: ?" e
- #define ITCINTEN_SHIFT 21- \" U; j+ P# ?8 l- T
- #define TCCHEN_SHIFT 22/ O& V$ \' V4 e. j5 s
- #define ITCCHEN_SHIFT 23
& D0 f' m, \4 K0 Z9 Q% G. V9 x
4 }8 G* P' u# D9 K( I! ?- static volatile int irqraised1 = 0;
8 X) i* R/ @# s. } - static volatile int irqraised2 = 0;0 I0 @4 J. j; ?/ N( U! O" t, D
- & p. K: G3 ]. Z6 }! J. g4 \' }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, c" c" P# p0 B7 C- d) n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( v( c" f# j1 y7 _# U. \9 e9 ^3 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 A3 U* \) Z: E
- 1 r) T; f3 t: f
- dma_addr_t dmaphyssrc1 = 0;
! w. H6 v# Y \ y' ?3 T - dma_addr_t dmaphyssrc2 = 0;% l2 s# f6 n/ O. \
- dma_addr_t dmaphysdest1 = 0;
: Y8 Y- W% {3 u+ r7 V - dma_addr_t dmaphysdest2 = 0;
: e: |7 U9 l1 u1 y
+ q# g+ l ^0 t& {- char *dmabufsrc1 = NULL;2 p+ f+ T: W/ z: M) C2 b: r3 ^
- char *dmabufsrc2 = NULL; R" |! i3 {5 ]$ I
- char *dmabufdest1 = NULL;& Z' }$ V% j- p6 n: u
- char *dmabufdest2 = NULL;
6 S3 ?) O4 z3 f5 k: S' I! {
8 q2 Z5 E8 B, O. T, `4 i- static int acnt = 512;- n' G8 ~" G! i
- static int bcnt = 8;' ?& ^1 A7 F J4 o* h% s. [6 k( p' g
- static int ccnt = 8;) C: @% f* P1 }& V0 m" }, T. A. Y
- # M9 D) `2 q% F6 W
- module_param(acnt, int, S_IRUGO);/ S( L3 ^% O% ]: f. c
- module_param(bcnt, int, S_IRUGO);
8 i" ~) ]: J& g) }+ L/ r6 x - module_param(ccnt, int, S_IRUGO);
复制代码
- E9 C% U3 ?. Q2 a6 I1 _: e5 T
, }; T- {2 a9 x& O/ ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, n+ H' z& S* j3 m$ n
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 Y, M$ r$ A8 Y' h/ @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" b, U' B6 {4 C) m
* i8 c' Z/ j- H
2 v. U! b+ [+ k3 f5 y |
|