|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- v0 j3 M: Q4 j$ v4 n- [code]EDMA sample test application2 E, i- v+ J/ n' q
- /*1 E! p/ x. _# h8 x1 b. f9 S
- * edma_test.c7 Q, A0 O& X! _1 _; k
- *4 D7 f$ {# }3 c: ?
- * brief EDMA3 Test Application
% l7 S# |9 _0 u9 { - *
; v: P3 ^9 [) g* i x6 C' h - * This file contains EDMA3 Test code.& Z3 I1 D3 l, r) A$ e m6 U) s
- *- j8 N8 ^8 E& ?# H7 a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. x! }/ I( r* Y$ b+ {2 _ I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 X a, k1 n Y" [& U& j; I6 F v
- * TO CHANGE.
+ h- j2 f0 Z7 J* ?) i - *
* U! \6 V0 _2 I2 b. ]. ]9 q Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* |; D4 J$ l4 s, N
- *
0 o% A! g; m8 i+ e - * This program is free software; you can redistribute it and/or
0 r' j! U% U/ g0 t& T- y - * modify it under the terms of the GNU General Public License as
6 j* v2 u, p: x, D | x' K; D( m - * published by the Free Software Foundation version 2.* c1 W E; [4 }- [' r8 [" L5 P ]
- *
1 o" S- l! ^4 f- E+ A% c5 H+ y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 s; ?+ u: z4 w# R) V4 O: | - * kind, whether express or implied; without even the implied warranty+ [# h* T, ?$ G0 |4 q. ^6 c( j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! V0 i7 O7 z+ z# l
- * GNU General Public License for more details.- A4 O% g1 m- e7 o1 L! O3 ^
- */
@9 O/ Z. ^1 z+ g _. R) Q - 4 p* I* W3 Y3 p+ h- T& e
- #include <linux/module.h>
6 }2 W8 D1 q) L) N6 O% a - #include <linux/init.h>0 ` G% K8 Y+ A: |, I( D4 ?, s
- #include <linux/errno.h>
; ]. i, N! L9 j - #include <linux/types.h>3 |3 F( E( j! k1 g% J) l
- #include <linux/interrupt.h>
' w1 q; \6 i# h1 c; @& S7 v5 {( c - #include <asm/io.h>- v# n; C& H. X, W
- #include <linux/moduleparam.h>
; T! ?6 A" C" a8 X - #include <linux/sysctl.h># d/ e! m. [: w: z$ Q
- #include <linux/mm.h>
' |8 v$ B0 y7 H - #include <linux/dma-mapping.h>' k J7 B$ U9 W6 I* v0 E
- + N! W1 D" @( S4 W' J' |) U
- #include <mach/memory.h>
1 s8 H; G L f8 ~ - #include <mach/hardware.h>/ ]6 Y2 `* ~/ f# ~! @
- #include <mach/irqs.h>
4 @* N; Q$ R+ a9 k3 i - #include <asm/hardware/edma.h>
* T- Y* d0 T; X
4 ~1 [" f' L" g8 G( {: \/ O- #undef EDMA3_DEBUG/ n$ \$ Q- S+ W B0 l/ M
- /*#define EDMA3_DEBUG*/
; w1 l4 g. v* W" v - 5 O/ Y" c6 D* o# h, A! m6 L- r
- #ifdef EDMA3_DEBUG
3 B' E* W1 q" O# P$ n! V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 C% t6 M3 B' n. Q6 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 j0 t* B7 y; p& R- W9 M9 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 b. h# g+ u% S - #else
1 E. c3 n& @4 t! B! C - #define DMA_PRINTK( x... )
9 u7 I1 w7 [* w5 A. h* c& N) m) Z - #define DMA_FN_IN0 ^1 _% l9 X, }, h! P$ J- ^# H
- #define DMA_FN_OUT
" Q0 c d5 t* v( W# F8 ]9 y - #endif: P U; D1 C8 v1 ]
- 5 ~1 q7 P" k- R. C& ~2 }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 U9 U6 e a8 n1 F1 \ ]! W+ U, g
- #define STATIC_SHIFT 3
- M b" Y' k8 `5 M/ b! z/ _4 ` - #define TCINTEN_SHIFT 20
+ H! Y2 c+ D) b: a - #define ITCINTEN_SHIFT 212 }4 s7 N- I _9 W1 X
- #define TCCHEN_SHIFT 22+ ~- E( f; _: e4 i6 p
- #define ITCCHEN_SHIFT 235 R2 k1 [9 D1 D3 L+ _ }& Z
- . n9 f7 t9 z; b2 Z# Y
- static volatile int irqraised1 = 0;0 ~8 F5 @7 H9 J% Z; R
- static volatile int irqraised2 = 0;9 c& h) H* T0 [, q0 _
- 6 g- P, s, m% E: x1 B- x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ~8 j2 i: \) Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 K% i$ p) o- t) y3 v$ y, \. c( L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! H9 X- Z( H7 }& `5 ]" l# a
& d8 ?: t; t2 h- _* V9 d- dma_addr_t dmaphyssrc1 = 0;9 ~7 B$ `$ E4 c; e; X! M5 d. {
- dma_addr_t dmaphyssrc2 = 0;
! K8 U8 A) u/ g8 D/ F0 m5 P4 Z - dma_addr_t dmaphysdest1 = 0;
1 h+ {' K" P1 W: o; R* d - dma_addr_t dmaphysdest2 = 0;
. a+ q$ T4 H. e) W; q- V# O, }
: ?/ d( y+ m& z+ W' n- char *dmabufsrc1 = NULL;5 {8 w) V |$ ]* N! Q6 e$ l2 K |
- char *dmabufsrc2 = NULL;* p: b ]$ I: F' f
- char *dmabufdest1 = NULL;3 q( K! f+ H/ ^7 Z0 \' p4 o
- char *dmabufdest2 = NULL;
9 c* f L8 A) U6 r! ] - * L. g+ H h2 {, m5 h8 Y4 b
- static int acnt = 512;. j& w$ V! e* g' s4 m
- static int bcnt = 8;
- h% N6 s2 l1 e7 P( B, t( r - static int ccnt = 8;
+ E5 Q) w8 j$ V# B+ x/ p; N' F
2 X4 |! ^# B( ]: {; o+ M7 y- module_param(acnt, int, S_IRUGO);( n4 c) {, ~; g% x$ g+ ~" T
- module_param(bcnt, int, S_IRUGO);
8 Q+ B! I8 l9 @, _7 u7 S/ K - module_param(ccnt, int, S_IRUGO);
复制代码
& g, D! x" k6 h5 R0 |; [+ O0 i; c) |/ o, n2 h7 h5 N9 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- y& u- I. m& e. parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 `1 P' Z" B- ?/ G6 o* \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 y. A1 g# W6 N7 h' J, J1 o
4 b) g% K$ R' {& m+ ]
, K. V- x+ @% a [ |
|