|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 @7 f8 V: H- H8 e- [code]EDMA sample test application; W7 W; ~$ p M! K, d- ~
- /*" w: s4 @! u: W( q) N' Z& ^+ _
- * edma_test.c/ \& j' s/ N; C6 F0 S. c
- *, t. `+ o) o' O ~* g- y+ a( w
- * brief EDMA3 Test Application; m( s1 ^4 d8 A+ G
- *
+ v4 { ^1 C0 F) n# { E - * This file contains EDMA3 Test code.
: r! r9 F: Z6 z8 U: f$ F& [* p" J; \ - *3 q. w% c' X( j, O* y' z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 A! A7 E- m" J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' f. n* V4 E: c* E - * TO CHANGE.
3 e( U* I6 @* d' ~4 y% a8 S - *$ Y3 @/ Q" P, I1 M+ R" a% R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( d2 T% G4 A4 U% L, K
- *, m% c, C2 Y: s. \& `
- * This program is free software; you can redistribute it and/or
5 M9 K8 m3 s) A/ l O - * modify it under the terms of the GNU General Public License as# j! e3 X# N1 W8 k7 v& ^
- * published by the Free Software Foundation version 2.( E7 v$ \' l' ~& {- y
- *! ~+ ^9 C4 w8 W' n. G6 A- x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% {) ~( e0 o, [1 \. J
- * kind, whether express or implied; without even the implied warranty' e* `4 K. L8 C: U2 C& A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ _4 v% e6 ^; T& y) ~
- * GNU General Public License for more details.
" [! m% f5 B1 k) a( X+ K0 M - */
$ T( [- p: k3 u4 E4 e
, z- w, k% y5 f- #include <linux/module.h>! S, e! {2 g& g8 Q4 C4 }
- #include <linux/init.h>$ ]: Q( U, ^& W w
- #include <linux/errno.h>
! A8 G! k8 ^: G0 J m - #include <linux/types.h>$ ~; C" j" n+ }$ {+ w
- #include <linux/interrupt.h>" M9 Y' i5 g2 c/ c9 v6 J3 t
- #include <asm/io.h>/ y3 E+ i0 q6 z% E0 T
- #include <linux/moduleparam.h>2 y+ I$ O7 k, n. q( }( [5 A
- #include <linux/sysctl.h>
! k0 K: ^% | R$ K5 E' k - #include <linux/mm.h>: W7 o4 q9 D, f$ v- c y
- #include <linux/dma-mapping.h>
) L% p" d% ]; i2 k' E4 A; K4 K
3 p* C7 d/ ]) U' I- #include <mach/memory.h>
: f8 u2 D9 @ a/ c, h) d* z - #include <mach/hardware.h>
9 Y1 G F- @+ `; d, ^( j - #include <mach/irqs.h>
; g1 s5 l& @' ]6 H, c - #include <asm/hardware/edma.h>5 w; M# I& \- a" B N
- 5 T$ ~* r7 I. {! X! V3 e. _6 y
- #undef EDMA3_DEBUG
' P4 \% L; C7 w- J6 e& V$ G - /*#define EDMA3_DEBUG*/( _4 ?. [+ N5 X
9 ~& |0 X! K" Y( L3 P- #ifdef EDMA3_DEBUG6 i8 l4 w$ c" U' z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 |4 M8 h1 V# Y+ \# }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), n. u; }: x( H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% |6 k% ~+ S7 R( U
- #else4 ?- L# F- t# z% U; ~$ b2 x
- #define DMA_PRINTK( x... )
. [/ I7 \* F: D# i1 O! i - #define DMA_FN_IN/ S7 q/ ], k W; z+ c# o9 y7 ^
- #define DMA_FN_OUT
) {9 R2 {; ]0 ?6 O% g7 T! Z0 b - #endif
, j9 {+ O5 j# B: p) w0 }( ]5 a - 7 t4 c' ~ Y6 Z7 c* y+ F( d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' m+ w: T* I9 t: H$ d; k+ ] - #define STATIC_SHIFT 3. m- J3 z; o1 I$ ^
- #define TCINTEN_SHIFT 200 |9 e2 m1 r, p3 @! H- {1 z
- #define ITCINTEN_SHIFT 21
; B1 D. X$ H; ? - #define TCCHEN_SHIFT 22 X% E( y. m" i; X
- #define ITCCHEN_SHIFT 23 H1 f6 t8 E& v- u3 O) z% Y7 |
- & c: n9 p& n3 m) o
- static volatile int irqraised1 = 0;
3 Y! Q$ O0 ] I( k0 U - static volatile int irqraised2 = 0;+ `$ R: ?6 R+ n: ^: g
- 8 g& ~, E+ M% V! V h& N, W5 `7 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ U+ }2 ]) r4 C$ ]% ]( T. O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ n( `6 S8 V: I$ t( O- b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 X1 W1 E; V$ i7 s
- 2 t. F& ~* g% y. J
- dma_addr_t dmaphyssrc1 = 0;
2 @, D: @3 S' l, t# L# F - dma_addr_t dmaphyssrc2 = 0;
5 ~6 Y( P# g- _# a( P4 B! K - dma_addr_t dmaphysdest1 = 0;5 j4 G* p6 p7 C3 j( V6 G5 V. [0 p6 [
- dma_addr_t dmaphysdest2 = 0;
; x, l2 r4 C5 q( |% ~
4 t; X5 |( ^$ E4 r* I% h& e$ z7 H% ]- char *dmabufsrc1 = NULL;2 `8 I' W6 O; H9 V1 t) w1 P4 x
- char *dmabufsrc2 = NULL;* O$ E, [5 W; P9 H+ q
- char *dmabufdest1 = NULL;& d8 W1 j0 t1 W; r) I0 ^# A* \. a \
- char *dmabufdest2 = NULL;* E2 j. k$ d$ o; N1 C1 j
- l9 C5 Y1 x& T5 Q, @+ B- static int acnt = 512;1 A$ `8 B: H, b6 \
- static int bcnt = 8;9 G. f8 c5 x$ c4 e0 F
- static int ccnt = 8;* o- m" K0 h- _
- $ q4 F" H4 F6 q2 S8 u
- module_param(acnt, int, S_IRUGO);
2 i3 n7 r% \" i3 c9 M; x, ? - module_param(bcnt, int, S_IRUGO);" }! R, z* V$ b! w% T6 j& u
- module_param(ccnt, int, S_IRUGO);
复制代码 ( g2 ]8 X0 @; A% ~* v& D7 {& x; P
. b8 L$ s0 K8 a7 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# U* _( h$ \% y- I7 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ q/ |! B( \* N6 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! }. r9 J% t( m8 N! U1 k4 M
1 z0 @2 k. N0 J. b: T) S* D( D9 F3 \/ n
|
|