|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# z9 n* Z3 m0 ]- L9 V% z/ j- [code]EDMA sample test application
( R) Z9 b! C& A - /*
7 u i' |4 ^; W0 k) ? - * edma_test.c' j5 d! ]5 ~3 m. U' C U7 U
- *
) {% F& h( e/ X; o - * brief EDMA3 Test Application
4 u5 I3 b6 _% B0 C( t( | - *
( Q9 ~! A2 t* @" B( J; m - * This file contains EDMA3 Test code.9 C1 _7 O6 e6 V$ |. b8 @( w
- *
8 K, H3 u! z' r5 f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) o# m& F8 F& ^+ e4 X. } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% p% `$ K7 }' y F/ _5 f/ @! Y4 c6 g+ \ - * TO CHANGE.
# h- Q& b5 A( j, }/ h. l; l0 | - *
, Z& C3 K+ |. j2 F% [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& D6 N* v/ m& J9 M m+ ?6 T6 t! f
- *
1 e# D' o0 G$ B: {! e - * This program is free software; you can redistribute it and/or+ o0 U/ \5 f6 c, K+ V, |
- * modify it under the terms of the GNU General Public License as, r R5 c+ X, P( R8 u4 [4 W
- * published by the Free Software Foundation version 2.
" a9 K0 Z& h" Z - *
- D. |8 F7 w* K; F) [2 ?, c P4 W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 ^# @! _5 P& o6 L& j7 Z7 t% n$ C - * kind, whether express or implied; without even the implied warranty, J3 J. W" k v. S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ {% A5 E& Y3 e A5 |
- * GNU General Public License for more details.
6 b% F; `6 S: Y0 E( c - */6 K' Y5 H% J q6 \+ |* R* ]
' w- h- B" i0 `2 e- #include <linux/module.h>9 \# y2 _& u* z' \5 B- x2 ]% v* O' p
- #include <linux/init.h>5 D( s! {. X6 j
- #include <linux/errno.h>
1 f ]5 f9 I; L - #include <linux/types.h>
+ V- U* e7 e% X - #include <linux/interrupt.h>
3 }9 e, G: F; J- N( m+ m4 f - #include <asm/io.h>
' M1 g9 a4 \% D( H - #include <linux/moduleparam.h>
8 U' A9 G! }/ k - #include <linux/sysctl.h>7 }( Z& @+ I5 g) L. b( J
- #include <linux/mm.h>
' g$ A2 `& ~. c G5 W- u2 x - #include <linux/dma-mapping.h>2 P% A5 K: F2 q
$ @, Q! V. a: U9 F9 a- `8 F9 F- #include <mach/memory.h>. X$ {+ n4 l2 L! F1 F2 t) o
- #include <mach/hardware.h>
# a$ t( A0 N3 }4 G6 b/ ? - #include <mach/irqs.h>, W3 I* B3 A9 S2 z$ K& l1 B
- #include <asm/hardware/edma.h>
( M. w/ H+ S( K. ? - . g6 B Y: o: l/ j8 a
- #undef EDMA3_DEBUG
& K4 ?( ?& l+ v5 L' n - /*#define EDMA3_DEBUG*/* W, H- O6 o$ q. S, v( T' i3 Y$ {
- 6 r% C! d5 p, i; t
- #ifdef EDMA3_DEBUG6 G5 @! r" Y# R' j" H1 ~" p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% E! f( i2 A d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 S _: x( o8 x/ {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): r. s( o1 w y: A+ ]
- #else a+ M& c6 H9 S! @+ O6 h) f
- #define DMA_PRINTK( x... )0 p5 x& n- ~3 z# ]- t
- #define DMA_FN_IN
, {! t9 l! w$ ? - #define DMA_FN_OUT9 S' y$ Q' }% r$ j
- #endif
' O* |7 ^* _1 \. g - 8 i+ S0 f+ l, X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 e: ~) B5 X# K2 D2 Q
- #define STATIC_SHIFT 3$ j6 l6 h3 K* f' n# s
- #define TCINTEN_SHIFT 20: w, V5 s9 n( n0 j* P( | ], i
- #define ITCINTEN_SHIFT 21
/ s5 K1 q: {5 {9 O7 W/ V( ~ - #define TCCHEN_SHIFT 222 Y0 }$ b% P' o+ J5 ^* d0 I/ N5 J
- #define ITCCHEN_SHIFT 23: B# r2 k, \5 ^" I( K' I5 A
- : z( R) B* ]4 ~: f; ?
- static volatile int irqraised1 = 0;5 k6 C" U$ l* p( O" ^# ~; v
- static volatile int irqraised2 = 0;# V9 S; a; h+ }+ c& F7 m* E
- % Z7 \5 t$ D! _0 ]0 X$ M( [0 R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 l6 r ]4 e; X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# x; z5 c! F9 d R& v8 m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" l1 [; V% ~& q' u9 e [2 F
' q4 ~% r) N. u& x1 b- dma_addr_t dmaphyssrc1 = 0;" t. F! E. f: x2 P- f, T
- dma_addr_t dmaphyssrc2 = 0;* A# g+ g" ^, v
- dma_addr_t dmaphysdest1 = 0;
7 G* p D9 l S s. _! f1 U& Z - dma_addr_t dmaphysdest2 = 0;
# i3 P- k3 {" _" ? - " }5 k# Z+ F7 C, C$ ~/ w0 M/ Z
- char *dmabufsrc1 = NULL;
+ @ A$ S7 V. V - char *dmabufsrc2 = NULL;' B7 v: S2 B9 \% y
- char *dmabufdest1 = NULL;! ~5 W7 S6 z4 Y, Y" w' P
- char *dmabufdest2 = NULL;, e9 _' l8 d( L; z7 B& S2 y3 T
) y5 |8 {- d7 E5 ~- static int acnt = 512;0 g* `. `7 f4 ~) [ {
- static int bcnt = 8;5 w9 y+ o2 B6 s4 Z6 t# [0 q
- static int ccnt = 8;
P5 J1 G, d1 u D/ m! y
9 l9 W- _& g8 E# ^2 U+ ]2 I- module_param(acnt, int, S_IRUGO);
z& X( p, i' Q; e: B - module_param(bcnt, int, S_IRUGO);0 X6 V' x9 o4 C: ~% f
- module_param(ccnt, int, S_IRUGO);
复制代码
- _/ P r. H7 m& ^7 Q
) ?0 q% N& {+ j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 A, l+ A! [; E+ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 e& u0 @ r! J0 Z# }: U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ W t% r8 W# ]8 t+ D1 |
; C# V H+ ?; e9 p- y9 R, |3 U, j" Y7 |9 [, B
|
|