|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! m$ w) R0 b; @, h6 F2 N" B
- [code]EDMA sample test application" c4 Q% U" X. A) @( ^
- /*$ @8 a1 X# n2 u; D4 y2 ^9 _
- * edma_test.c
) e- p& `) r; M# e5 Q - *
9 y, d4 U' O" h7 \9 f - * brief EDMA3 Test Application
, g* y* x, t- g7 I6 B' c. G - *
# v( l8 z( U; o# _8 G% R7 k* m: C. W# F - * This file contains EDMA3 Test code.* S) e+ X/ Y4 T8 C! l
- *5 H' c1 s1 _7 g' V3 w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% c- _5 C9 }4 e& ?2 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 Q3 c& {6 m3 A# f9 ~( c
- * TO CHANGE.
; L' o( G0 E9 N' D% o' ~ - *
7 M6 d! F) D. K2 S w' M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( f: ^6 g' p: k
- *
, _" q" \- r- u/ P3 o, \3 u - * This program is free software; you can redistribute it and/or
# w/ ~9 K' ]# E9 U# B" q. g' a - * modify it under the terms of the GNU General Public License as
$ m3 J3 V8 q! M* Q - * published by the Free Software Foundation version 2.: a9 @8 j1 N+ q0 Q* B
- *( i+ L7 G7 v4 T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; o% _0 P1 Q, h! }3 A* C
- * kind, whether express or implied; without even the implied warranty" `6 o" N1 S( z6 F M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 k; \+ Z/ P* l9 U: z$ e0 O - * GNU General Public License for more details.- c @* {, p2 X4 G6 X b. a5 G
- */
, S0 ?( A1 R: S1 _* w/ f/ G5 \$ b& \2 E/ k - ' f8 b1 X. V# Z9 E
- #include <linux/module.h>
# }! {! [) G9 p$ L* H - #include <linux/init.h>
4 A h$ \9 O p4 ]2 V( Y0 j - #include <linux/errno.h>6 ^# i! D5 I$ m; n- q) O8 I/ c
- #include <linux/types.h>
+ H' C O" u- H9 p7 d/ A; ] - #include <linux/interrupt.h>5 L4 ` J) e( F- S# Z5 q
- #include <asm/io.h>
3 A) x, X. T' g1 t- s* U) P4 O - #include <linux/moduleparam.h>
6 z- ]# a: x3 C' v& t - #include <linux/sysctl.h>
$ u1 X \' [3 Y I/ }7 w4 d/ b! _ - #include <linux/mm.h># u" [; e/ y8 C" \! Z9 H
- #include <linux/dma-mapping.h>' J3 M% f0 i% M; v% @
- / q5 v/ i6 S4 }' `$ I) I6 V
- #include <mach/memory.h>; p! L4 A3 R4 V- w9 t) ~/ \* d
- #include <mach/hardware.h>
) s% n, |- T" F( u! ] - #include <mach/irqs.h>
5 ]' V! O6 f. n0 n* T- [ - #include <asm/hardware/edma.h>( _+ }" Q* `/ g& |" N
( I: e. t6 s8 R- #undef EDMA3_DEBUG& t( V- `! K- e9 t, C
- /*#define EDMA3_DEBUG*/
, Y2 t, g1 S/ k3 ~1 \* U" v$ O
7 }. y2 Y5 t2 X+ H+ K/ \- #ifdef EDMA3_DEBUG
6 w0 k) m5 ]/ a+ R# S2 u9 N! t$ M/ u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* M- [' f& S+ Z5 a' ?# I5 Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). e2 Q5 ]2 O8 G5 P& u8 A$ @7 j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 h! r/ b% Y: l6 I6 U. D5 z - #else
w4 k1 O' w3 v$ O$ r - #define DMA_PRINTK( x... )
1 N9 r/ c2 H' V$ o - #define DMA_FN_IN( a- q3 f& R, `* O; S* F% ~, O% Y( J) R
- #define DMA_FN_OUT
, f5 n$ V. E- o4 f4 \ - #endif& T7 ^) V! ~2 n) }0 P
- 4 T4 N; D+ J/ f; ^0 m# ~0 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ B- _, U0 h# u. u - #define STATIC_SHIFT 3
3 W1 I1 Q2 r. ]2 Z, l) x4 T - #define TCINTEN_SHIFT 208 g( d# S. A$ j" T
- #define ITCINTEN_SHIFT 210 C* _0 Z' X! g/ T; ^
- #define TCCHEN_SHIFT 22
0 S& f1 a" ^6 b. i4 U+ { - #define ITCCHEN_SHIFT 23
) `1 {4 i$ ~, y0 A
6 f2 S6 ]4 I7 C) v; {6 g- static volatile int irqraised1 = 0;
" Y% T, N' n- P, t - static volatile int irqraised2 = 0;
6 Y3 [8 U' y$ e" a9 p0 O - # }" M* h, h! z# c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& d, h" ]+ O q: h' D8 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# O0 O4 l- f" q& s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' r* w9 x4 [" p5 U; ?. ~
- & A! G6 N( f6 Q5 i5 @8 q8 x9 ?
- dma_addr_t dmaphyssrc1 = 0;
8 S3 s |+ L* |9 f: Y8 J8 E p2 Q" K% q - dma_addr_t dmaphyssrc2 = 0;
4 R! m1 L* G6 G. h - dma_addr_t dmaphysdest1 = 0;
7 @) E$ J% c$ m. z - dma_addr_t dmaphysdest2 = 0;2 P# k9 H* O5 [9 q
- ( f3 N& T j7 J) ?8 K z
- char *dmabufsrc1 = NULL;
% R" D' t( |+ E& W8 a - char *dmabufsrc2 = NULL;' V" y( U( ~+ p
- char *dmabufdest1 = NULL;
8 L6 `1 S( @6 \# U - char *dmabufdest2 = NULL; B" L6 a/ R& g8 W, M
* |# s1 s J: a% A! t+ l" `+ ^- static int acnt = 512;' B+ ~+ Q# a7 F" Y9 H
- static int bcnt = 8;3 D( p7 D2 ?5 y6 s
- static int ccnt = 8;
. j- l% @0 k$ M/ \) B8 x, S6 _ - 3 P4 @9 @; N. b. ~
- module_param(acnt, int, S_IRUGO);
: o8 \: A; _3 n - module_param(bcnt, int, S_IRUGO);+ F0 N/ z" G Z+ D; B
- module_param(ccnt, int, S_IRUGO);
复制代码 0 S& D7 I" J3 g' [
. U$ o9 l9 M5 s: k3 p$ E4 z& w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# x% j/ x! |! B. S9 C5 a3 J w
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+ A+ |9 N- _+ c! M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 e- M* @; E& W
0 Y2 j6 z# X! j+ ?+ h/ i+ V( E' l2 E0 G: ~! b- N! |# p% e
|
|