|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 F# @0 R/ w; @! L& H/ m9 z, d9 s" R- [code]EDMA sample test application
' l9 f) T, O/ x/ [ - /*0 k0 h; t- p% G; F& p
- * edma_test.c0 ]0 o% l5 `' o* R
- *
& S+ G% g8 f: U9 G - * brief EDMA3 Test Application' Z3 H# T: z3 R L9 B6 H; s+ i$ j
- *- W/ r* u) `- K" f. K
- * This file contains EDMA3 Test code.
6 R, W: v. {# v" V - *$ w5 m$ {! v3 r$ x8 D: k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
q% u4 `3 _ Y: p4 F) F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& F# D4 Y4 z8 a3 n9 ^6 {1 G
- * TO CHANGE.: g7 ~% b' ]! S$ U5 [8 W; ?
- *
8 X$ I- C% k- y6 m" V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
x" X5 B; }3 B - *6 p) I+ q) L( H
- * This program is free software; you can redistribute it and/or
" }7 N. d9 ?9 D: a7 h; F- S7 r& A - * modify it under the terms of the GNU General Public License as
3 B$ \0 U4 E, e& ]# n" P( ? - * published by the Free Software Foundation version 2.0 U- e$ F% C/ s, B% n- J
- *
) g$ q/ q7 B% ~ r6 @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 D. G, E M w( o0 E5 k9 ` - * kind, whether express or implied; without even the implied warranty ` w [9 J0 s- r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, b! e- j8 _, {: ?. y, N3 q8 T
- * GNU General Public License for more details.( ~9 U, k) L! s6 V) ]
- */+ P. R' ^* {9 T. v
- 8 b* e0 L5 }( c! p$ w
- #include <linux/module.h>
2 M* T( k. n: T8 W7 K5 U - #include <linux/init.h>+ T2 V' O1 M' s7 ]2 G7 ^
- #include <linux/errno.h>
% V5 j' g r) X0 f, A - #include <linux/types.h>
$ F" k7 [! ?' ~# ^1 z1 [ - #include <linux/interrupt.h>
, ^: |" j. @1 M) V5 r - #include <asm/io.h>
5 S% D9 Y% _1 ~7 F5 X) d0 h, h - #include <linux/moduleparam.h>' _/ @$ {2 w" s! U
- #include <linux/sysctl.h> \# f* w' U. m: Y
- #include <linux/mm.h>% E1 @% U/ d2 I) d1 {# S3 I
- #include <linux/dma-mapping.h>
# E9 |# N! s% E9 n$ o5 Y - * z& D5 c5 @5 b1 F3 M3 ]! \, i* v
- #include <mach/memory.h>
3 Q! A3 t& U/ t; g7 x3 ]9 I1 }" t - #include <mach/hardware.h>& t: l$ [) ~% q
- #include <mach/irqs.h>" P$ v" i6 A" r( G9 I
- #include <asm/hardware/edma.h>* r) e- o. X9 A% t
2 D. ]( }. G3 W D: L: ^- #undef EDMA3_DEBUG
( m# ]1 h2 e" g$ u, S- y - /*#define EDMA3_DEBUG*/ h" J @3 _4 _$ h$ p+ r
- . B0 q4 `: f( [3 j2 G) P: {+ C
- #ifdef EDMA3_DEBUG
* I8 h- H' y- V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 m5 `+ g3 V8 L+ R$ g. ?; H& Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. |- R0 d3 @& c g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 f6 R1 d2 ?. U# A) x3 B6 y& h6 v
- #else
* T0 j' x' r" h$ H" Z5 H - #define DMA_PRINTK( x... )! |# w7 S" U4 Q; v# L
- #define DMA_FN_IN
" f8 \! C7 y9 s# y - #define DMA_FN_OUT
$ B8 x' @3 Y6 ^/ Y - #endif j; X+ E& r6 f6 X8 f0 a
- * B: Q9 `& r( j- S1 f4 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 \8 B1 f' m2 e! [/ V7 b - #define STATIC_SHIFT 3
2 s+ [( X1 z9 i8 ?. g' I3 x - #define TCINTEN_SHIFT 20
: W% U+ L0 B4 O; m" X - #define ITCINTEN_SHIFT 21
; L5 `: A- @' R' z7 u0 f* @ - #define TCCHEN_SHIFT 22
# Y; I1 F+ F3 G* F3 A) Y- @ - #define ITCCHEN_SHIFT 232 Y( X: C) x1 m) }; @% W- r
6 V! s: s' K7 m2 t5 c. Q6 n5 I- static volatile int irqraised1 = 0;
0 z& x P, [, G - static volatile int irqraised2 = 0;9 h) ^2 x, A. `) s2 n; n
- 3 H' W6 V0 }/ r" l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! J* t% d& s' ]- ^+ @% ?. Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); }, Y" D8 R; W# p; Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 L. @" l6 Q& K: F: ^0 X8 f z, t
- $ g9 b# F8 N0 w* Q/ Q* B9 B' B
- dma_addr_t dmaphyssrc1 = 0;; [+ M: h* ]' o( I3 _
- dma_addr_t dmaphyssrc2 = 0;
, j$ {$ ~! S) O! \# k! f - dma_addr_t dmaphysdest1 = 0;
) O O0 q8 ?1 x8 h9 S A/ ^/ P - dma_addr_t dmaphysdest2 = 0;
: l+ q7 \- f& M4 e' d3 X0 O
% N( R, B2 I+ Z. N1 y- char *dmabufsrc1 = NULL;: b9 \4 ]+ ]4 d* F" G% [
- char *dmabufsrc2 = NULL;+ S8 f3 \$ C- U% s
- char *dmabufdest1 = NULL;
! o- k- m, H* o7 `' X - char *dmabufdest2 = NULL;
: f/ W1 I2 \5 p& D0 d
/ k" n- [/ L0 b6 q4 W- static int acnt = 512;
& C- y/ K3 k8 B - static int bcnt = 8;2 N, l$ G* U# b( Y4 ]$ N0 o7 ]
- static int ccnt = 8;
5 O9 o% x; D0 N, s/ i+ t - m* |/ G% X: O; Z
- module_param(acnt, int, S_IRUGO);6 c; f) m( D8 ^/ Z3 K
- module_param(bcnt, int, S_IRUGO);
4 c* ^% ]) k5 W& y/ v - module_param(ccnt, int, S_IRUGO);
复制代码
. R1 I' r) n! @
K) d) b$ v* `8 n6 I) g5 i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, L3 O3 @% _% ^) l+ i* p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, O9 E! t2 O- e# j% P, J. A1 j8 U' J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ?0 P& c' w) j1 l) X G; c. o8 v" E4 r3 U
7 \+ p; ?6 s7 ~; l g' y |
|