|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; M7 L; G( z: ~, j/ n( o- [code]EDMA sample test application: ?- q4 g: V8 q- M7 W2 z$ j
- /*0 j: u2 y1 B! Q0 H
- * edma_test.c
0 {, @* p+ A5 |5 l. G - *
. x; v$ w& @$ q$ T, B$ s - * brief EDMA3 Test Application
8 Z! V' z2 q* }8 _4 w5 Z - *
' p0 b A7 F0 \ - * This file contains EDMA3 Test code., V6 x% k. U2 s$ h* u+ |. z
- *
$ P" M0 X) K+ |! J' ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! K+ e* A: b# w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 @3 T1 `6 p9 Y1 U r" I' u - * TO CHANGE.) y5 a1 E" Y8 @* y
- *
+ T' M0 n/ N* t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 z2 j4 U B0 e2 Z4 h9 `# N - *' @# {* e. x9 r( `" |6 O% J
- * This program is free software; you can redistribute it and/or
/ R. I Z% M6 o1 J1 _) h - * modify it under the terms of the GNU General Public License as
. g0 I* f1 m' E0 _7 N7 T0 ^ - * published by the Free Software Foundation version 2.9 U) W E/ |7 D0 K, z
- * W" F7 L3 M$ I, C. ?5 ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 p0 a) Y& h) i
- * kind, whether express or implied; without even the implied warranty
" i6 S& `* @$ n0 Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 {/ h2 t$ s# D; \ - * GNU General Public License for more details.
X. Z2 w5 @, C, {+ Q9 \- l - */
5 q! @! {5 T. E - 0 z2 \# C$ \9 n7 m+ V8 b
- #include <linux/module.h>
& k# t0 i7 M+ o6 @3 ~ - #include <linux/init.h>' z- W) a! c6 ^. U8 b3 {* `0 t
- #include <linux/errno.h>
/ q$ U; l# W' c - #include <linux/types.h>' e3 E9 p) a% u7 z1 k6 [$ B. K( M
- #include <linux/interrupt.h>2 ?$ \7 K8 ~/ S3 j
- #include <asm/io.h>
8 u* {1 ]0 N# y; _. x. D6 b5 f' N - #include <linux/moduleparam.h>
2 r+ [' G# b! p9 x y# r - #include <linux/sysctl.h>9 O$ ]% V( |0 n; P7 }) u
- #include <linux/mm.h>
4 `8 S. w7 G9 K* ]& s - #include <linux/dma-mapping.h>) P& U6 m+ N% c' G1 L
& Q( U6 h, {+ n" j' o# Y- #include <mach/memory.h>
# x1 `; j0 V2 G* k6 I+ n# u) x* } - #include <mach/hardware.h>
" x' d& h: @9 D( o: t( p) c! X - #include <mach/irqs.h>
* {/ f, d0 k* h" L+ f# ~& s - #include <asm/hardware/edma.h>
# x4 G+ ~7 k1 n, z8 k. K7 ~* O - 4 g) C( t/ n c8 Z. S
- #undef EDMA3_DEBUG2 o. K9 ` \/ K2 l
- /*#define EDMA3_DEBUG*/5 T1 G- r" w, j: h# ` g
- 0 |5 F# W- R: r; r5 i
- #ifdef EDMA3_DEBUG* m( F7 E) N+ P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) D, L# }+ Z X- a; a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 O2 |/ h7 R) b( @% k8 M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ K) G% @2 T) v2 _( n2 u - #else
1 W9 F6 W/ u& U# V% Z( b- `9 d; w - #define DMA_PRINTK( x... )
, g) |- ?' a# I8 B1 e - #define DMA_FN_IN: {" u) P8 C7 l9 f; T4 s1 ?2 H0 A+ Y5 A
- #define DMA_FN_OUT
. A+ w% G2 d: o- W* U0 o - #endif1 ]. V7 O3 i; ], B
- 0 a h% M% c$ S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! s* k% ` Y/ b - #define STATIC_SHIFT 3
+ |# ^. P1 I% _2 s. K3 M - #define TCINTEN_SHIFT 20% F' I# w5 \# ~) C7 f
- #define ITCINTEN_SHIFT 21( h4 f8 K x. w8 r& ~6 @% w* R
- #define TCCHEN_SHIFT 22
. {5 B/ E! K: ^. y# C6 k - #define ITCCHEN_SHIFT 23. | o- p. q# q. d7 Z C) E% i- k, E
/ E4 L- ]$ z7 k0 }3 ^- static volatile int irqraised1 = 0;
& F% D: M% A7 S4 A/ N0 g& ^ - static volatile int irqraised2 = 0;
5 B, P* k( z5 j. O - H+ b4 D3 n7 W9 s$ k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 D9 Q* `& \% o2 T9 P5 v( H/ g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 P, l' C4 @: N; T3 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 _0 D/ [! E9 H9 e5 _# H" j& Y
- 4 ]- Z4 M0 h$ u& n
- dma_addr_t dmaphyssrc1 = 0;
4 r6 a& q, l# C# }0 x - dma_addr_t dmaphyssrc2 = 0;2 z2 s3 Z) I1 V7 j6 {
- dma_addr_t dmaphysdest1 = 0;4 Y6 ~+ j, r) P. v; q
- dma_addr_t dmaphysdest2 = 0;
# @, r' O5 W- w+ B - 0 X( w' d1 |+ f; G
- char *dmabufsrc1 = NULL;
5 o+ A3 V3 {/ Y ^/ c. q - char *dmabufsrc2 = NULL;- I/ V6 c" p0 d" Y3 M4 w0 u0 ?( S# ?
- char *dmabufdest1 = NULL;
% ?% b ]+ j$ B& X/ w, U - char *dmabufdest2 = NULL; M7 ~+ Q/ e. T1 g
" x/ }7 z. F( Y- static int acnt = 512;
5 |6 e0 C5 T C M; m - static int bcnt = 8;0 @2 B( \) `* k
- static int ccnt = 8;
" N3 [) g2 f0 m j8 U$ g# ~ - 3 X$ z7 H" z; x% w2 b8 ~1 }* A; ]1 \
- module_param(acnt, int, S_IRUGO);
& Y* k: c( p D4 }. ?. X8 o - module_param(bcnt, int, S_IRUGO);
; P3 T& Q; H$ P" O+ n$ v - module_param(ccnt, int, S_IRUGO);
复制代码 5 ^+ M% q8 ^# m8 e% V7 f, w4 J
: ]8 B$ a6 n$ U9 n6 T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# z- d. a+ C/ | [" barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, |2 u8 P! Y. ]( W& t+ H; n9 r2 y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 G9 R3 u* Y# C$ U* z0 k$ ]! X4 l
$ v2 A, I2 `; g A8 k |
|