|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! C* y- p, w( }( M# p( z0 `
- [code]EDMA sample test application
; N$ q7 j. x" w- ~& J/ D+ { - /*$ [8 F1 z% ]+ r- R- C
- * edma_test.c% e+ D' K. l' i3 C6 ?9 M/ g# X0 Y
- *9 r% e( S. Z8 f; g7 u
- * brief EDMA3 Test Application% Y( K+ V: H+ @+ I( e" p
- *9 p5 D9 P. V% `' M8 e1 h1 t
- * This file contains EDMA3 Test code.: s3 o6 J4 [6 h8 o7 g& ~
- *# q% |) A4 O& ?7 C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- D2 |' W% Q, ]; x5 M% K. o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. O* |' r9 q6 `
- * TO CHANGE.5 [" J4 G- A+ v" n
- *+ q' W4 n9 ~5 O3 O0 O* U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' n3 R1 i( e5 ]* ]& q - *3 Q# ` } }2 H$ V1 K
- * This program is free software; you can redistribute it and/or3 M8 A# G# v; I `) B. f. \
- * modify it under the terms of the GNU General Public License as
1 L! P: D5 V' n& c1 Q1 { - * published by the Free Software Foundation version 2.
6 Z3 J% s- k4 ~6 A4 w# R - *
" i2 h( \% w5 |2 K* ~# G) t! { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ]/ h# k: ^4 k: ^" e0 P2 P1 V0 }, `- e; v
- * kind, whether express or implied; without even the implied warranty
) x$ l* F4 T u+ W |- P6 O1 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 I. b9 L' _4 T- r" f; w+ s, f
- * GNU General Public License for more details.
% D9 E5 |4 @1 c4 p: r! N2 } - */( h# \' t6 _$ Y5 d
- - ~4 G3 h+ m a
- #include <linux/module.h>
9 y# y/ M1 p+ W+ k4 r - #include <linux/init.h>4 J' L$ F5 b+ \, |6 I* F/ A+ ]
- #include <linux/errno.h>2 r6 y* v' W. o" n/ w
- #include <linux/types.h>
6 R& Z9 L$ j* ?- |, l+ D - #include <linux/interrupt.h>9 {- Z7 q* X! }( f* Z1 V c* ~
- #include <asm/io.h>5 ?$ ?) z4 j+ ^7 e
- #include <linux/moduleparam.h> P- Y" ^, K2 h. M8 F) [! l) Z# o
- #include <linux/sysctl.h>
& M: x' J' S$ {/ B+ c% x( m - #include <linux/mm.h>
+ n' S" R6 J# V0 L6 b/ ]4 r - #include <linux/dma-mapping.h>
- i c# i3 M s - - ~: x% m3 I. s* F1 u
- #include <mach/memory.h>
' R) m0 n8 |% o5 F% \+ e: ^ - #include <mach/hardware.h>. F( D. t6 q( K' x, H6 Y4 n1 }0 @
- #include <mach/irqs.h>2 o3 s# z, y6 N6 d* |! g
- #include <asm/hardware/edma.h>
; T* V5 u4 |+ h& y# }( }4 T8 ?
% K5 ^ F$ V: L1 o9 w$ {- #undef EDMA3_DEBUG' m* D' \- t- l6 D! P) E
- /*#define EDMA3_DEBUG*/, X- W; [4 A l) H3 x- `
; K/ g+ }4 j/ i$ e; K; H$ \) r- #ifdef EDMA3_DEBUG
" Z% i5 q' Y7 B2 P( ~8 h& [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 S! r; D7 K. K! P9 R* w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! Y& F2 w& q: q2 V- g) B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) p. F4 p4 }* U* @' k8 t
- #else' R3 b# M* ]% w2 x m% `
- #define DMA_PRINTK( x... )
/ l+ j0 E0 r5 ~9 u/ Q$ Y9 a8 ` - #define DMA_FN_IN
/ G m5 V+ \. j, V' `# [- l. K, @/ q; t+ q - #define DMA_FN_OUT
6 j: Q+ ?8 k! P - #endif
. a4 B# ~* A6 {0 x% h% {
6 {: x" O: r0 ^% {7 V- #define MAX_DMA_TRANSFER_IN_BYTES (32768); X1 g1 y: S) P) r. N7 @
- #define STATIC_SHIFT 3
# R1 i$ m& x' f3 Z6 S$ o$ q( }5 J - #define TCINTEN_SHIFT 207 x! T; K+ W m1 V/ ?7 X. d( N0 v
- #define ITCINTEN_SHIFT 21
k5 _" Q0 \: A, o$ z+ f - #define TCCHEN_SHIFT 22( f! _& B5 R7 @+ k# m7 }( l( N
- #define ITCCHEN_SHIFT 23
/ P2 }; i" n# {0 p( A, P - 9 S5 R+ h! O' d+ I- j5 J4 I
- static volatile int irqraised1 = 0;
; f# J0 d* [8 s/ |4 d - static volatile int irqraised2 = 0;
7 B: Z, z6 X8 P - . h" w* }3 Q$ f! c5 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 U4 X: e: Y/ E* e8 q4 p# l& B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- z. d3 Y: L& ]3 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 @' ~8 [* D+ ^& G- U
- 0 |1 m4 Z9 T+ {) w: U4 t
- dma_addr_t dmaphyssrc1 = 0;
$ i) j0 z; ]7 Y5 |/ l - dma_addr_t dmaphyssrc2 = 0;. ~+ }# A3 V9 }
- dma_addr_t dmaphysdest1 = 0;9 Y* e) ?9 q" l$ r/ k" W/ }( M2 v
- dma_addr_t dmaphysdest2 = 0;0 c0 @ v2 U' y. x7 S4 `8 s
- 1 L q# U5 k0 M6 F3 T* B2 @
- char *dmabufsrc1 = NULL;3 T/ N4 u! j& I }3 r2 i3 \- R+ I, X
- char *dmabufsrc2 = NULL;+ L5 W, T( K9 b3 H3 b) x/ d S& B
- char *dmabufdest1 = NULL;2 @2 c8 g9 C4 i7 y3 ^, a* K; r+ }! s
- char *dmabufdest2 = NULL;! `' w8 Q- N: N$ B# X% @
- 5 q/ Z, a- M' X5 k& k
- static int acnt = 512;
4 c6 @4 t% h6 b' l7 P: x- { - static int bcnt = 8;% s# j5 s% |2 t- @# A( M" }
- static int ccnt = 8;
9 I) d4 v" b7 I; M: A
) s! ^; m, ^& u" F+ J" w/ \- module_param(acnt, int, S_IRUGO);; c, v3 t& d# t0 ~/ L a2 ]+ V
- module_param(bcnt, int, S_IRUGO);# H, }' \' `% G% F
- module_param(ccnt, int, S_IRUGO);
复制代码 * g0 b! e& W8 G# o9 h% k
, J* W- l# c c' M* w! J0 P J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, C1 |$ j* G& M! t% _) }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) H L+ P$ V9 j8 B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 t. ]6 g9 ]7 T# n- _) F7 y0 X0 E- B5 e- E
Z' u* h( S% a' l |
|