|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( S: L, `0 p0 }7 y' k. @+ u/ k- v
- [code]EDMA sample test application
: K, ~: |8 I* h% G+ L - /*
+ S% S2 j- s1 e - * edma_test.c4 y% F h; n/ x" C# c4 c8 B6 p
- *
! R1 G8 U1 `7 Y0 d8 _, Y - * brief EDMA3 Test Application% m5 v3 W' m' H, e* _- n
- *
! |7 [+ @( I( p, k9 {: H# j/ ~/ ] - * This file contains EDMA3 Test code.) ?5 n7 n8 u: M( Y1 U* p
- *
# U" A1 W* ^, f1 h d; s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) ], C+ o; i5 _5 V* N, N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; n& p2 x5 p4 Q" p - * TO CHANGE.
/ e* [- F8 V" v' m - *
: [3 X- t6 g5 ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ Q5 D. h5 x5 M; h - *
0 o$ C z' \! K9 B* s; | - * This program is free software; you can redistribute it and/or
, o* H6 \: S9 k* E/ A+ d - * modify it under the terms of the GNU General Public License as
9 B' V! S- |! H! `, n - * published by the Free Software Foundation version 2.
8 k' [5 r3 h$ i/ H- N- o - *4 D1 D z8 ~: |% H" X. P, y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 u, x% b' X/ t1 T3 _7 G2 W! Q( ^, L
- * kind, whether express or implied; without even the implied warranty1 V: Q" S/ e0 ?/ }: O: z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! o/ W8 k2 k: J9 B - * GNU General Public License for more details.
S8 ?: @6 S9 a - *// z6 C5 u- N) t: k
$ S5 R' t& I. Q9 H5 X3 d M- #include <linux/module.h>" N0 {2 q5 k# I. M0 N! E1 N
- #include <linux/init.h>2 W3 K+ d. I3 c9 w& q* t) A& o
- #include <linux/errno.h>; j s) v3 D. t$ m/ x: g6 g1 `. E
- #include <linux/types.h>
8 i/ o% x q1 `) J) t* u: \ - #include <linux/interrupt.h>, |+ i4 I8 {3 Z3 o' R# ~5 L
- #include <asm/io.h>- S; m' x- y& {2 M6 H) }
- #include <linux/moduleparam.h>! Q) I- Q& H7 m8 S% p
- #include <linux/sysctl.h>
1 \# a- g) h% X& N) ?5 @% q x, ] - #include <linux/mm.h>6 q% n# I, s7 Y, b
- #include <linux/dma-mapping.h>
. b9 o2 s$ E7 k" o4 N: T% }7 _ W1 V
4 ?& w& `9 H3 ~2 C+ w9 A9 x- #include <mach/memory.h>% A4 l4 K9 Y+ Q1 t' z# L
- #include <mach/hardware.h>
( m5 R) O/ F" H - #include <mach/irqs.h>
$ ]3 x# ^1 N& J J) a v - #include <asm/hardware/edma.h>
( N$ F1 p+ E% M1 ]0 a6 F. ?
% C, ?* m% H4 s W- #undef EDMA3_DEBUG" `: ?0 n3 `4 k5 L2 V
- /*#define EDMA3_DEBUG*/
x0 \% ^% E+ u {( _) R
) X! [, w! w' t, L1 L5 y; |- #ifdef EDMA3_DEBUG2 j$ ?1 l% N7 i7 M% b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 ]: T4 h! ?" ?/ v8 S9 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 C& m- l* x4 M2 \9 \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& g0 ~, L( d3 j
- #else
( g7 e! E$ c7 o - #define DMA_PRINTK( x... )
' G9 u- Q8 A5 \! S6 | - #define DMA_FN_IN
+ a/ a* z, Z( Y; k8 \ - #define DMA_FN_OUT
# X+ o* {/ B# J# f% C/ h - #endif; P6 {; g8 |4 D$ r3 ]
; h0 k) L, L5 b* J, c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 \1 B% }. j% O7 R
- #define STATIC_SHIFT 3! j* Z- U) B h/ s- c# p& u1 G
- #define TCINTEN_SHIFT 20" G9 C6 R7 J* f' `& x* I0 A
- #define ITCINTEN_SHIFT 21
5 u9 {5 N1 o: Z6 t+ j - #define TCCHEN_SHIFT 224 Y3 f* U0 \' t7 f3 y7 a
- #define ITCCHEN_SHIFT 239 u0 Q3 j# h- D7 p' a
- ! k7 P5 J5 x! I2 ~% M( A6 }0 c- }3 V
- static volatile int irqraised1 = 0;, I' J( V# c; \, N C. L
- static volatile int irqraised2 = 0;
# L& P+ i# I1 w - " k. } H( |* P% [$ J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 z# o/ d8 C* L I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! H+ Y! w8 V( k0 E4 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# O* n( I" {6 e [2 |
/ G# u8 z, Z C N" j- dma_addr_t dmaphyssrc1 = 0;2 U9 _0 a$ h. Z& B
- dma_addr_t dmaphyssrc2 = 0;' C2 | l4 P* D: J) n$ S; [8 X- j
- dma_addr_t dmaphysdest1 = 0;
' N- @4 L$ c# b. ?5 r" ` - dma_addr_t dmaphysdest2 = 0;
7 `3 C2 l! w5 G" J5 C, k4 ~0 }
! F* ^$ n/ v3 a; a, k- char *dmabufsrc1 = NULL;3 M4 G$ z; w! r O
- char *dmabufsrc2 = NULL;# ]7 X' Y5 M8 N3 \" r
- char *dmabufdest1 = NULL;
a$ F! a/ S9 r) {5 ]2 U u - char *dmabufdest2 = NULL;
( B" j& h9 b3 Q& ]3 x - 2 o: R5 H0 q. C. j9 t
- static int acnt = 512;1 W* {6 y. E- M6 R8 O3 R- k: k/ Y# D d
- static int bcnt = 8;+ w8 N8 r( C5 q7 J, [/ Q5 T
- static int ccnt = 8;
N2 g/ z/ M7 v' d A - + Q& y% p) B$ v# [) L% M
- module_param(acnt, int, S_IRUGO);
+ O9 w4 [3 t, t* t: g - module_param(bcnt, int, S_IRUGO);. P4 Z& O/ }' ?* _- d, g" x. O! s6 ]
- module_param(ccnt, int, S_IRUGO);
复制代码 . `* M- M: P6 N4 K
1 N/ n5 Q$ `$ [+ T) l/ |' A/ l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! J6 q7 o% Y$ Q U" Y. H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 [) \* l0 q* R& N% V3 p7 }+ E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! g) y* M3 h& G" S- \
0 F* g: a- Q# Z+ [7 ^4 g9 [. f7 [2 @
|
|