|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; a) _- a2 `% U9 l+ }$ A
- [code]EDMA sample test application
. C W. ?: c. V- w# s. z - /*
9 @# ]4 N+ E2 D* N - * edma_test.c+ a: I& ^# |9 L. ]/ O/ D8 A* v
- *% U5 q4 V* e' T- n1 m) F
- * brief EDMA3 Test Application6 e X9 p" `! B
- *' Q/ K, Z! w' O% @5 i
- * This file contains EDMA3 Test code./ U% j9 @# R0 A4 Y3 i# z
- *; p) A8 a2 D6 C# X4 ]) f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 g6 P0 D# t3 I4 \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" T4 x- K ~. ?8 y8 H! t2 D0 L: B
- * TO CHANGE.
/ `8 p/ x) D |: c7 `! Y - *2 B4 U0 W0 X! q6 n) _) c+ Y' ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' ~1 K, {2 L) p2 R3 b- A
- ** H3 r _8 _+ {1 v: a; g4 E1 p+ G
- * This program is free software; you can redistribute it and/or
2 G. {: P! L% A; R, c% @( ~ - * modify it under the terms of the GNU General Public License as2 n4 q8 C, u% A \' X! g
- * published by the Free Software Foundation version 2.' C+ I$ d5 L) B* Y% u% S( Z
- *
) O! S+ { Z3 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( ~; O+ @7 A4 F9 @! }& I
- * kind, whether express or implied; without even the implied warranty3 P/ K% [1 C- S& J A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 o3 o7 T; A# ?, l& e3 T3 [ - * GNU General Public License for more details.
6 D# {3 ^! @9 Y$ V - */3 J0 K3 {1 q3 |8 j) b7 D z
- ; i0 v1 g7 k$ P5 `9 Q
- #include <linux/module.h>
5 Y3 ^2 U# Q1 Y/ t - #include <linux/init.h>+ D+ }" G, H- M! R5 K# x$ J
- #include <linux/errno.h>
4 ?9 y" A1 @6 x/ G* F0 X b, O0 @$ r7 P6 Y* f - #include <linux/types.h>
1 Y8 ^& [! F! T3 R3 M" n' [ - #include <linux/interrupt.h>
6 A& a/ D$ R& u4 d& ? - #include <asm/io.h>
, W( F2 l2 K. ^! ]7 O9 ?1 B( F9 D - #include <linux/moduleparam.h>
, W; S" S' s3 ^4 g a# f% | - #include <linux/sysctl.h>6 M* I! B2 c1 Y, r! N* B: [+ W1 f3 v, _
- #include <linux/mm.h>" ~3 s4 o i; g {/ U
- #include <linux/dma-mapping.h>
4 A5 k# g3 A9 u3 G - + G# V+ D: |' \% i: N, Z2 f: Q
- #include <mach/memory.h>
0 y, i# n. c: N7 y' m: ]2 w - #include <mach/hardware.h>+ U _: d. D/ @0 c
- #include <mach/irqs.h>
$ D4 Z4 v7 x" g8 Y - #include <asm/hardware/edma.h>
" V5 r3 u" N3 ^$ t& Q. N - 4 h7 a4 K. E( I0 e
- #undef EDMA3_DEBUG+ i9 S1 f; Y1 d5 d7 E3 p
- /*#define EDMA3_DEBUG*/; d3 n3 U) A; G9 s7 w4 @5 W7 E
- 1 j; T5 t. X- l, H `3 w
- #ifdef EDMA3_DEBUG
7 J" S2 t# x+ F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), a+ r8 |, G7 V+ Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 {$ Y, Y3 w) \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); { Z8 {# i+ g0 s% M
- #else- Z" S, f3 S: N) f4 Y- Q8 v
- #define DMA_PRINTK( x... )6 V4 P% q2 l l7 }/ N- L F
- #define DMA_FN_IN
$ q, b2 X+ r/ k* W - #define DMA_FN_OUT0 P) B) S8 x) C( n) e! ?
- #endif, x% m0 d' Y$ _" W1 A; ~
* _4 h: }+ q2 M$ x, q* w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 P# R. \5 o+ {" X/ Q; w/ E - #define STATIC_SHIFT 3$ P% `. a2 [* M; p4 B$ h* o& p+ |
- #define TCINTEN_SHIFT 20/ T! x* Y- `7 d) }+ g
- #define ITCINTEN_SHIFT 21
7 |( k9 M9 {: O, O) N - #define TCCHEN_SHIFT 223 A( e- w" Y! @2 T
- #define ITCCHEN_SHIFT 23- i3 N! a! m( L8 Q- i
- 6 V: y& A' `! A/ @7 [
- static volatile int irqraised1 = 0;
9 W0 l2 O$ x- F8 ~( a - static volatile int irqraised2 = 0;
2 d+ d, [ M9 i, a# e! b. N% F3 E* X
5 s" r. z Y1 {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 }2 x4 I* T% K! D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( F& O' x+ Q; ^* L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p8 m- s$ u1 K w( v
& l) @' ?& G; k" _4 P- dma_addr_t dmaphyssrc1 = 0;
' M! [0 u$ F# u. |3 L( O; _& H) N% k - dma_addr_t dmaphyssrc2 = 0;- S% A `" n, M2 x; W8 y
- dma_addr_t dmaphysdest1 = 0;
: c8 B- L1 }- \* U& j - dma_addr_t dmaphysdest2 = 0;! K- \+ S. q' ^! i% f
" B. V K" ~. D# f2 l- char *dmabufsrc1 = NULL;
, c. \& e1 d% N" A5 d$ @2 `* U - char *dmabufsrc2 = NULL;
+ W; O5 T- B& G* `; W, S' d - char *dmabufdest1 = NULL;
/ s: m+ K: ^2 e - char *dmabufdest2 = NULL;$ y' K0 g$ W1 n" f5 E2 W- \/ w
2 T( h5 K' P% V+ [- static int acnt = 512;
! w' |4 ^& T& U# S - static int bcnt = 8;
: Y: t2 o! G2 W+ } - static int ccnt = 8;' g" f" {6 M/ p9 e% `9 x0 [! M
1 _, Z) y. H' {- module_param(acnt, int, S_IRUGO);
/ D5 Y; x; o0 {5 x' A# g6 v! W - module_param(bcnt, int, S_IRUGO);( w3 J, j+ j# q) ^5 `
- module_param(ccnt, int, S_IRUGO);
复制代码
3 b! G/ c/ _( H/ o9 X) \
, S+ b$ c! |( _) C; Z; p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 N4 O7 L, h5 |+ O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, M: ^/ T* W, ?- \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: N* Z9 d x0 }5 I
# J( n; Q" c) ~* d& ~: W# ]1 }2 M
|
|