|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 c$ k+ s# f2 W8 A! s c- [code]EDMA sample test application1 v& H5 D2 j8 i8 E) z J
- /*% t7 s$ X' O: Y3 K! S! Y
- * edma_test.c
7 E2 d: Q5 M: l$ P, o& R4 a) L - *" I, \9 f) p$ _2 n
- * brief EDMA3 Test Application# M. R: h- V4 T. V: a5 E
- *
+ Z& A7 u O# R* X; U& p - * This file contains EDMA3 Test code.
( j5 C0 H$ F$ { - *$ X% d6 j: ?# b: `, z8 I# e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 H" O, q' [0 F3 F* ~6 W; s" m2 e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) `0 L) b* s% R, x( V5 T
- * TO CHANGE.1 [) o0 \' m* z
- *
1 i) \0 L2 i6 r9 V# D+ ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// v0 j' q; f% }5 I# j# i. n) K6 L
- *
! Q7 y1 o/ d) l: v - * This program is free software; you can redistribute it and/or
. k: Q6 T: _9 Q. b6 s - * modify it under the terms of the GNU General Public License as
4 q) Y4 L' \& W0 v - * published by the Free Software Foundation version 2.
$ b: k# i" |! ~* r- U - */ o% @! f, t/ h% k X! _' O. | F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 }5 [, c2 i+ a9 ^4 z
- * kind, whether express or implied; without even the implied warranty; C& i1 _: |4 a: h$ i, U( I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, p2 c, L L3 M1 w# h k
- * GNU General Public License for more details.
1 y$ n4 _& |/ Y& h4 t6 v* p% K - */+ l" _3 V" w5 \
- 7 h6 v$ K+ c* n/ _2 d! E6 D
- #include <linux/module.h>" ^" s* Q; q7 ^6 P% p& n
- #include <linux/init.h>
2 m% N) n K6 }5 X8 ]4 R, _ - #include <linux/errno.h>* A, V0 v% M, J
- #include <linux/types.h>9 l9 [1 P6 Q. o
- #include <linux/interrupt.h>
. e+ u8 c: c/ x. d7 d - #include <asm/io.h>
: b" B4 e+ o9 b4 c - #include <linux/moduleparam.h>
L3 j$ V. w8 O) V - #include <linux/sysctl.h>
, s# N; W' \+ m$ b - #include <linux/mm.h>$ o& }3 ~" C9 ?. @/ l( c
- #include <linux/dma-mapping.h>
# F1 _ `! ~ B - $ c' s" C$ \: E1 o
- #include <mach/memory.h>5 z5 u6 X* m) P+ L# z2 T- N
- #include <mach/hardware.h># t/ p/ P) X* ^" T
- #include <mach/irqs.h>
+ D+ Y c7 {6 \0 V* W# X7 _, ^ - #include <asm/hardware/edma.h>
$ |0 B) }8 X/ k; o' d! k
. ^, j. C6 C1 g1 o+ x$ p- #undef EDMA3_DEBUG# L: r B3 }; y3 ?0 d# B
- /*#define EDMA3_DEBUG*/
$ N6 Z" Z, N8 k( t" b& M$ `
' n+ c1 j0 [& x) G- #ifdef EDMA3_DEBUG
5 G, w w/ ?/ Q6 O i; A" X8 S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& L8 ] b' X# W" Z6 t& V/ g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Z& Z9 F% x. G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 u2 G0 I8 B# N( w9 u3 i
- #else, |4 i4 D2 e b0 r G" k o
- #define DMA_PRINTK( x... )7 s0 m! [. M% a0 F- H
- #define DMA_FN_IN
! ?( f4 a3 K" a - #define DMA_FN_OUT
4 m( M! B h( _7 Z - #endif
& d4 \: S) k! j. P' A/ X1 @
, |5 y9 Q& }! I- {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. P. G8 H6 F) M- T - #define STATIC_SHIFT 3
9 U: _# j3 Z4 z7 G; ^ - #define TCINTEN_SHIFT 20
% Q+ g) n. N$ U1 s6 \! J+ f - #define ITCINTEN_SHIFT 21
. W9 |; ^ P! g4 |4 O! y - #define TCCHEN_SHIFT 22
) w5 j0 z$ r' }3 } - #define ITCCHEN_SHIFT 23
4 C n9 T3 u B9 P - / o6 M6 [ V0 H/ M. Z3 r
- static volatile int irqraised1 = 0;
J8 Q8 k4 @: O& q$ ]9 P - static volatile int irqraised2 = 0;) K/ \6 n; U* y- r+ X
- ; Y% J% e0 D2 `: z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; Q% o" ]: V5 Y) J2 I, a: q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; b, j4 v- H( U4 S' P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 s, K% c: n. v- j
9 V+ d5 M, E4 a- o) ]- dma_addr_t dmaphyssrc1 = 0;
/ h. R9 m0 ~& ~% e3 n) n7 g0 Y - dma_addr_t dmaphyssrc2 = 0;; P5 e7 w+ M+ P
- dma_addr_t dmaphysdest1 = 0;
% C. g9 U* z/ }* t. K0 K- Z - dma_addr_t dmaphysdest2 = 0;8 J3 p) u7 b1 \/ U# @: I) @
+ q/ z) K3 D# H9 D" \" ?% T- char *dmabufsrc1 = NULL;
" Y; M5 W; h+ j& l - char *dmabufsrc2 = NULL;
( m, U9 a! K$ G - char *dmabufdest1 = NULL;2 Y- J9 y" k# n5 H, X4 j0 X' ~% z
- char *dmabufdest2 = NULL;$ w4 \& [9 E+ p
* |6 Z% c- Z; A( b+ e* K) X& t" _- static int acnt = 512;
5 w; }# K/ r1 e; `: h' `( s - static int bcnt = 8;. d9 ?5 F3 P ]
- static int ccnt = 8;4 s! _4 D# H' q' H/ |" g+ E4 Q
! @# ~5 d4 }' c# x% q- module_param(acnt, int, S_IRUGO);
- }! r1 {0 G o# K2 C5 l - module_param(bcnt, int, S_IRUGO);
: \8 s0 _% g. q! _ - module_param(ccnt, int, S_IRUGO);
复制代码 7 s! t0 t* }. Q: c2 ~* G
+ G1 G- B1 `" W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 f$ ~8 d+ [* H! [+ Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. [& `& \/ I4 f o" o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ e! {3 g$ l5 {
$ h+ j3 [) Q, e3 T
3 q" B- `$ d( {% h9 @
|
|