|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! h8 F0 \. u8 `& m
- [code]EDMA sample test application
. S% c$ |! x' L1 r' l9 I - /*- {1 P* R" T: I. C n) L& _
- * edma_test.c# J @. e) d3 O& P( R$ `5 `
- *
- g! j& S8 {" u- J [ - * brief EDMA3 Test Application
1 @& R! i: F8 [; R+ c6 s5 I3 i - *0 a. ^' M i% @
- * This file contains EDMA3 Test code.
& H; K0 M4 ?$ P. p+ T" w - *
1 n( |8 u( O3 Z5 j" u4 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* b! A( d4 R8 J" {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' g* x4 O( p$ r
- * TO CHANGE.* \9 G0 X, b4 M; D
- *) |0 P5 u7 |1 |6 n$ P& u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" o6 Y' J. _* j
- *
1 l2 R* L/ x- o5 Y$ k - * This program is free software; you can redistribute it and/or# ?& y( M* _9 H: E6 t
- * modify it under the terms of the GNU General Public License as
" d' e0 `: l% _ - * published by the Free Software Foundation version 2.+ N2 J' ?5 U" ?& C3 _
- *
2 w0 H8 U6 a: I5 g( g4 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 w2 ~ }4 Y7 K% g5 h3 {" Q$ M) J+ R0 t
- * kind, whether express or implied; without even the implied warranty
" H' w; B. \& l) E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 G. w+ y* p+ F, E2 I# Y9 d - * GNU General Public License for more details.
. z- Z. \! h) D7 c; X3 B/ d - */
m# ^; H9 B- \) Q - 7 T9 x% f+ P. s+ M4 g# f: R
- #include <linux/module.h>' R2 H& S3 }+ K1 i# M- A
- #include <linux/init.h>
9 Y* x/ r4 o, m" D6 j3 [1 | - #include <linux/errno.h>
6 n/ i. P( u( I9 M. } - #include <linux/types.h>" y' b1 k ]6 s+ ?" d/ U$ f! B
- #include <linux/interrupt.h>1 C2 Z: {- X K9 _4 n; R# \6 @5 \6 p
- #include <asm/io.h>
9 b' j: V( U+ u, {! o - #include <linux/moduleparam.h>
3 Q$ X" A" l8 _; }% L4 A% w - #include <linux/sysctl.h>+ q0 F( j' `5 O0 X
- #include <linux/mm.h>
. t$ ]" D7 m! o/ e# ~$ A% H& i - #include <linux/dma-mapping.h>- m+ {2 g, y5 S, w6 h
4 L* N" O, x1 o1 H/ T. b: W7 G- #include <mach/memory.h>
6 u, b, _* R% j( @: i' w$ e - #include <mach/hardware.h>
, }0 U" }) r# X9 m- R - #include <mach/irqs.h>
- c3 C: Z1 w; _! h; q. k3 R - #include <asm/hardware/edma.h>
( e$ x; C; {% _5 D5 q" W2 e
2 [ z. ]; ~4 c- #undef EDMA3_DEBUG
- C, }3 y1 k- w# v% k- Z - /*#define EDMA3_DEBUG*/
: ]) U1 X' n: F3 L( U+ b
D7 Z# |# W* p8 H- #ifdef EDMA3_DEBUG4 k6 L' y$ y1 Z D( m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 [# h0 }: l J8 C+ ~' j2 O5 l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# w0 S/ h- D3 G0 l8 T' d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& e! N. I2 t+ ^ - #else
& I4 m$ X, i+ f2 O4 g8 s - #define DMA_PRINTK( x... )/ W! s+ J( i$ \! [3 u- X' T
- #define DMA_FN_IN
" Q! g1 B; J3 C) u" t3 I/ T) } - #define DMA_FN_OUT
, E( [0 U" \9 k8 c" h5 k. n - #endif$ E" N; _& ^. o2 P
- / X& i5 q) X4 F& ^ J+ c3 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 s6 l4 ]5 g3 V x8 l1 P
- #define STATIC_SHIFT 3
4 h5 Y$ i3 k& d% j5 I G) m3 u; B - #define TCINTEN_SHIFT 20+ C- d2 h+ z; v
- #define ITCINTEN_SHIFT 21
* w6 U2 k3 R: _( _ - #define TCCHEN_SHIFT 22
; X3 R; O O! j, l5 S - #define ITCCHEN_SHIFT 238 {2 k; P3 ^5 i2 `! P; v; S) {! n0 M
- 8 i A% k l1 \5 K5 O3 s( f
- static volatile int irqraised1 = 0;6 {0 y& V: O2 ] q9 K: [& s
- static volatile int irqraised2 = 0;
- X# }8 V9 G. W% Z/ u - ' Q1 j' a5 s) X/ R; T: s1 |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ?9 Z2 W! e/ X6 C& J/ y* f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, b- H& F4 |$ @8 \! C7 x/ ^7 u N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% Q7 d, j0 S" {! ~6 Q - 1 g: I; ?- H8 s! E. Y3 Q
- dma_addr_t dmaphyssrc1 = 0;
f& f( M9 ?4 A" ~ - dma_addr_t dmaphyssrc2 = 0;# o9 c4 d* O# o T
- dma_addr_t dmaphysdest1 = 0;) r$ x$ z; m, U1 l. Z
- dma_addr_t dmaphysdest2 = 0;
! N/ J; g2 u# E/ ?) M1 e - ( @% a& n3 ^: {7 i/ u) D
- char *dmabufsrc1 = NULL;
. Z/ A% [8 l3 u6 w( E' | - char *dmabufsrc2 = NULL;
' {! P) V _0 B9 ~- E W) e& W" s - char *dmabufdest1 = NULL;$ V; D. l' s( G4 {
- char *dmabufdest2 = NULL;, r3 H4 l: b, }$ m4 n5 r- s) ]" j+ u- x
- ( F3 R8 c6 [6 P& i$ k
- static int acnt = 512;
) U/ D1 g l) c- N& q9 s6 k2 p - static int bcnt = 8;5 m2 F2 {7 t0 z# t6 a$ z
- static int ccnt = 8;% U d; N. ` h
- ( {! h4 ~3 S: W8 l6 z- i
- module_param(acnt, int, S_IRUGO);
& _. M% e9 z4 ]" W+ T4 b! @; y4 d" Z0 }; ` - module_param(bcnt, int, S_IRUGO);
" E" y2 H9 _. Q6 n. S8 S K - module_param(ccnt, int, S_IRUGO);
复制代码 2 D8 A( O% t+ }- x" i
) n/ ]% O) ^6 J$ A5 S# l# X/ _9 }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' H: y V% y" O6 Z/ ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; U8 c% W5 ~5 E: C: q+ n' x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, r A* c7 b# ~! E" @/ r# r
" M. E: j9 G& E
! e, Q) _3 v) a: G i6 m4 D
|
|