|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 j4 k7 w& K/ P& f% O0 \3 I) v4 r
- [code]EDMA sample test application# V( a7 T! Q; J
- /*2 d% L6 n9 \ {2 C( V' D
- * edma_test.c0 ]" z6 i% @1 I
- *" }" H$ P$ N. j* E t& }
- * brief EDMA3 Test Application
5 c% i# j! A1 O2 z: w - *
, b A5 D5 S6 Y$ Q+ e: H. _' y - * This file contains EDMA3 Test code.
7 ~2 C/ d W4 d1 T - *; Z e' Z9 h' M- m: a0 v4 V, V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. D8 Q3 g, k$ G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 C' `8 ~. K% n {: D! k - * TO CHANGE.
; u. [5 Y5 d/ r) q - *
& p i+ r2 ]% F' h; @% O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 T5 S& u: I- q; w. K! l9 K
- *
3 ~% Y$ a' l1 _0 N& W1 Y7 y4 M' s# d - * This program is free software; you can redistribute it and/or {# w4 X: u9 w( ]
- * modify it under the terms of the GNU General Public License as' E( P. l2 Z; p' I9 Y: }2 _! t
- * published by the Free Software Foundation version 2.! G3 ]1 Q: X2 k- P0 d8 K
- *+ _+ w+ x+ K2 E7 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# N, k8 Q. P' T5 }* z- h' W - * kind, whether express or implied; without even the implied warranty: [4 h: \( _9 Y- _9 q) E: i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 ]/ m8 O4 h9 B. |
- * GNU General Public License for more details.
/ I' @% `* ]% Z! ]' y - */
; v5 p5 B* a: p$ @ - / I- s) _4 N& t' t) }6 f
- #include <linux/module.h>& _: ]7 s4 W# F6 m( |' I
- #include <linux/init.h> `, G& @6 @4 C; w9 u/ `
- #include <linux/errno.h>
1 W0 r4 q x5 ] o - #include <linux/types.h>
4 S+ g3 V: w) X' l' U - #include <linux/interrupt.h>
^: [+ D6 K0 L' n7 P& c0 |+ A - #include <asm/io.h>- {) d& ~ z7 J4 r
- #include <linux/moduleparam.h>% `1 w3 Q2 J! v9 h D2 c
- #include <linux/sysctl.h>* X0 g$ U+ J0 l) T! W, Y s
- #include <linux/mm.h>+ t V# V1 o3 d8 N
- #include <linux/dma-mapping.h>) t: P. @* @- f# @9 R
- J( L; @3 r+ \& H+ A
- #include <mach/memory.h>4 y* B( `# G* B
- #include <mach/hardware.h> {1 P: r' b$ {3 {" o1 p7 X
- #include <mach/irqs.h>
' K4 S- r1 V" t6 A: ? - #include <asm/hardware/edma.h>
9 @- U% v4 O, z# u! v
3 i% t+ T' S; Z' g- #undef EDMA3_DEBUG* d: I7 _: ^, x$ Q/ h* t4 p/ i
- /*#define EDMA3_DEBUG*/
$ b# K6 [, M: r8 D _
9 m% B# A# [ n) s' E0 O0 }- #ifdef EDMA3_DEBUG
6 h7 [5 r. |1 M8 o, }: t3 C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% K. S, k* _ P5 @# a2 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 N( S0 z8 J* i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) m- l5 h9 O5 f9 u2 f* L1 t* _
- #else, w/ E" n1 S8 }6 ?0 @
- #define DMA_PRINTK( x... )
2 ?9 R' V9 T t2 \% ]' B) { - #define DMA_FN_IN2 d- M" @) z* h- @2 a* x
- #define DMA_FN_OUT
. A6 G4 t4 j! e( n% I! A- ^6 \ - #endif
. P3 D7 x4 `, X; b
' F) K7 E+ d" Q x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( o$ n/ E% Z7 _$ R' g( o# Z - #define STATIC_SHIFT 3
8 b [5 o$ g$ i' V - #define TCINTEN_SHIFT 20
: l$ t8 Q' F2 A! \ - #define ITCINTEN_SHIFT 21
7 R2 `; C, a. B0 m: ^, ~ - #define TCCHEN_SHIFT 22
& q+ a& u A7 V. G - #define ITCCHEN_SHIFT 23
" q$ i" ]& R( X0 D. v! W1 @ - ( s# u+ v; n' r: A$ L! D% `5 {1 k
- static volatile int irqraised1 = 0;6 i% r. G3 T" L7 A1 Y
- static volatile int irqraised2 = 0;
$ ^/ d) k3 |( @" J
" j; b2 M) }7 @9 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! F% i' Q; X9 J8 A3 h( k; |# D! j( h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 B/ |! H6 ~& Q- K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# L7 ?8 S+ i. j' m# K7 _, C% Y4 m7 g5 A
# |2 S9 x2 Y6 x8 v& Q3 `9 k* w- dma_addr_t dmaphyssrc1 = 0;7 m" v% J3 h* Q4 Z8 j" F
- dma_addr_t dmaphyssrc2 = 0;$ l5 w1 u! T% m5 a; b
- dma_addr_t dmaphysdest1 = 0;
; m& q% n% K5 I, I - dma_addr_t dmaphysdest2 = 0;- l8 u0 e1 u1 y. N) b9 Y* A
- ' ~+ q0 d7 f* {% G+ }4 Z
- char *dmabufsrc1 = NULL;
/ n4 u8 m3 s1 M$ t4 z# J/ q - char *dmabufsrc2 = NULL;
: Q9 i6 n5 y o$ t - char *dmabufdest1 = NULL;2 F3 N: [5 ~* k, G: c. c8 E
- char *dmabufdest2 = NULL;
& ?/ t2 J( ^4 Y* C - 0 S/ D0 M0 f7 G; S3 H8 N
- static int acnt = 512;
! U( u F- o- \. I$ w) O5 e - static int bcnt = 8;; ?2 } s8 i9 I; w
- static int ccnt = 8;6 r6 x/ }3 s; H$ K3 W$ z
2 n( p0 M4 G! u% P$ l% _- module_param(acnt, int, S_IRUGO);
' p- {0 |% f, d* u - module_param(bcnt, int, S_IRUGO);" A: P+ ` q& }7 R
- module_param(ccnt, int, S_IRUGO);
复制代码 " {) T$ S# r% `' T9 E% \- f
6 @0 h" c/ ?7 |: l8 k: X8 M: A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 M; T6 G" E& ?/ _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
N- g i% f* W# ]6 ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ ^! s6 D# g3 z6 K6 E- n y5 u8 d: j; Q2 [! {
; H" a1 I8 {$ z$ w/ j/ Z' F
|
|