|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 v$ @# X+ c- x* p/ a0 F* d1 @5 t) g# X
- [code]EDMA sample test application
0 o$ B4 e: m" n0 Y! L4 v. l) [ - /*
& Y& c) D& w8 w6 d; V1 } - * edma_test.c3 P5 d/ n6 t, X( I; b
- *
3 S2 k+ G4 a6 @4 I7 J* B - * brief EDMA3 Test Application' U- J# h! _+ R+ B
- *
/ b8 A; M" b; W, Z$ J7 J: K, h, A - * This file contains EDMA3 Test code.
& c- Q) b$ R; n/ _% q - *" [( r9 @+ Q3 r9 \) E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; U( M- k# ?" n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, I0 ^. N2 s7 H. |
- * TO CHANGE.
. a5 ~! o E) G/ E - *- G. E5 _! U" [% ^4 A. D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% f! v" c% t+ u. d8 M
- *. x7 S' W2 Z' m9 a2 l" J9 d
- * This program is free software; you can redistribute it and/or7 ~8 o8 ^9 B8 G; t
- * modify it under the terms of the GNU General Public License as
/ Z* Z7 c' U1 K - * published by the Free Software Foundation version 2.: u4 B' H5 ]5 I2 j# W/ I
- *
# n' T. ]# Z1 b/ \0 A! t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; @$ T* ?( i5 y4 v; l: c - * kind, whether express or implied; without even the implied warranty
) @8 R& F$ X/ v8 \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 J l3 n$ @3 P" d% k* M# a - * GNU General Public License for more details.
2 ]3 [' o2 A/ x6 K - */: X" _) \9 t: P3 L Y( L
- 5 \+ t' O3 t5 ?' a9 A: N6 S
- #include <linux/module.h>
$ ^3 ^& k$ l; O( E5 \. t# ? - #include <linux/init.h>
. s3 F4 Y9 n& I0 N0 g - #include <linux/errno.h>
8 l, V' R/ U4 b3 f" O: W5 r6 V' l - #include <linux/types.h>2 ~, A# i7 _) [% I2 R& Z, ^
- #include <linux/interrupt.h>3 }7 A3 Z& c0 V/ m6 Z. f
- #include <asm/io.h>6 r+ `; U$ U. t
- #include <linux/moduleparam.h>
- O$ K& N, y1 [+ m; @8 Y F4 G - #include <linux/sysctl.h>
7 H {' e) S, m3 \# d) }. g9 _4 A$ e - #include <linux/mm.h>
2 g/ t, y6 u; A3 x( k - #include <linux/dma-mapping.h>$ X6 B# y! {# @1 Z) ^! F' g& C
' y v* @4 F1 d& y" L* E. _8 Z- #include <mach/memory.h>4 J- o9 X" w% T2 c
- #include <mach/hardware.h> }! k# y+ m- k
- #include <mach/irqs.h>
6 ^' V( w: R, m% M2 `1 R' S* ^ - #include <asm/hardware/edma.h>0 S {4 x; X" S: P- l
- 9 o& n- X+ ^0 a1 ^; J
- #undef EDMA3_DEBUG) `+ v& M) f2 z" E) H
- /*#define EDMA3_DEBUG*/
9 Y# ^6 V1 B$ s1 w4 e5 w! `
+ G) B- A H2 Z' u9 X$ U9 Z- #ifdef EDMA3_DEBUG
8 u5 P# _& z5 V# x1 s, c3 E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- X# N( z7 g2 F$ V7 U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 q+ }$ X2 A6 t/ D1 _ u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ l# n: M% w4 p3 ~8 ~( {( u( t. l
- #else
, P& N6 {; h7 l& M - #define DMA_PRINTK( x... )
9 a* o) S+ i" _! j0 P' O - #define DMA_FN_IN: b$ Z2 ]1 W: k. ?% `
- #define DMA_FN_OUT' ]. I0 b1 | V
- #endif
7 J4 Z$ R2 `* S* Z. E
. A: r$ d# W0 t) c t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 B' K# a/ g1 _3 `# I- n - #define STATIC_SHIFT 3
4 o% o! a0 T! z; ^6 u4 D - #define TCINTEN_SHIFT 20( X3 X- G$ n5 O% D4 R- I
- #define ITCINTEN_SHIFT 21
) C4 I" @! U' Z! D4 {" c1 b - #define TCCHEN_SHIFT 22
7 b ~1 g7 w) }) V3 E$ H4 h/ f - #define ITCCHEN_SHIFT 23; u% Y \/ S2 F) T
. a" T7 `$ h( M/ B* r- static volatile int irqraised1 = 0;! h; m7 t7 V5 M0 X: {+ J9 H
- static volatile int irqraised2 = 0;
3 D$ H! H8 ]' |. T
5 {/ Y# i2 ]- q1 p( Q) A7 i, {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; s' t- V, p% T. _ c" o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% N3 A& Y1 m. Q6 w$ g3 t/ b& \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 b& H. B! D. z- i% x
. v3 J7 @/ M$ N* O9 X! f! Y" ?- dma_addr_t dmaphyssrc1 = 0;. Y" [) y& U; P* o* A; E! J; w& R
- dma_addr_t dmaphyssrc2 = 0;
& ?- C W9 @6 C4 F- { - dma_addr_t dmaphysdest1 = 0;' \. r5 g7 P" N6 x' t7 O% X
- dma_addr_t dmaphysdest2 = 0;0 G) F8 e5 o9 B) X, G8 y
- & i1 j% Q7 c; W9 `/ a
- char *dmabufsrc1 = NULL;% ~/ T& y8 d6 r
- char *dmabufsrc2 = NULL;( v+ N2 n6 T' O3 n: q" Y$ B5 b+ }
- char *dmabufdest1 = NULL;4 h3 f0 x! p% t' |, j
- char *dmabufdest2 = NULL;
$ h8 V- N3 n9 n6 ]2 T0 L$ f; g
& q4 U! n1 f) h! [ g! u! @- static int acnt = 512;% _! I) o3 X# X8 r) v; _) ~
- static int bcnt = 8;1 ^! C0 L+ l: j
- static int ccnt = 8;
) u3 o7 Z' x1 l6 |# G
# e& O5 }! R) M, K6 W7 Q7 l- x- module_param(acnt, int, S_IRUGO);
: Y$ b; P& T. f6 {! u' n0 E - module_param(bcnt, int, S_IRUGO);
3 ~& L- o3 U+ R0 U, E& [. h - module_param(ccnt, int, S_IRUGO);
复制代码 9 Y1 Z, l, E5 C! c+ z6 D
( {8 j' ?' d' R, L( [) o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; d' ]4 A3 t5 T# j; U% p0 U. h( v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 c% V5 F+ n! j+ |( R& A+ P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% N: T. W) m* `( I, I5 H
. Q$ v! O( K2 ~( [( L z! m
# M6 B9 m" H5 m |
|