|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" O. i( k% n# n4 Z6 l- [code]EDMA sample test application% X9 } D% F4 o( W" ~% L2 ^9 F
- /*, {+ c6 I* r$ K# k
- * edma_test.c* u. b8 ]7 I/ g: x, u
- *6 F. p; f- r0 P1 ?
- * brief EDMA3 Test Application" |/ Z3 x, `* V# N Q6 q
- *
! z- [$ W& W9 _& h1 X - * This file contains EDMA3 Test code.0 T! z7 N9 T. _) D: y; q* ^5 g
- *
* b. |* { [/ Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& P6 o3 p+ i5 T4 K$ p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) x4 y! U; J* g6 [! S% o, i - * TO CHANGE.( H3 x0 ?5 r# Y: Z$ V
- *
9 ]8 @3 \! a5 o6 f4 C' v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& V- L! A- I; E( v6 R. H/ w. _ - *
' R3 X9 a9 B+ h8 ]9 [* M2 |0 ]% e - * This program is free software; you can redistribute it and/or
; j0 h% j @, h9 p5 O4 ]& [ - * modify it under the terms of the GNU General Public License as7 @( I- s) ^0 K" z! @
- * published by the Free Software Foundation version 2.
0 D$ o: Y& o( [1 X( F - *2 t- w' N3 C [ J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ q% P& M/ A; e; O ? - * kind, whether express or implied; without even the implied warranty/ L; p4 u$ O0 _+ T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, o& \8 J, `8 P5 Q* | - * GNU General Public License for more details.4 `8 ^# Y8 |, D: C4 V
- */3 n/ L) n' h; m" O, W/ U$ X4 q
0 X' n) e7 i: u1 |. b7 z- #include <linux/module.h>8 m7 P7 t9 ^3 S& H. u
- #include <linux/init.h>: O3 V/ ~8 y+ G/ u, R
- #include <linux/errno.h>+ j6 a2 p5 ~/ M5 d* K& m0 k
- #include <linux/types.h>
: ^6 n, D+ K3 Y, t4 ], { - #include <linux/interrupt.h>
* A( F/ _) Q! }& B" } - #include <asm/io.h>0 b/ k5 ]/ R8 t
- #include <linux/moduleparam.h>, ^1 P' q) `; e% J* y, \
- #include <linux/sysctl.h>
7 b, y. Q% T' C8 a3 P - #include <linux/mm.h>. A |3 [2 K- O! ~
- #include <linux/dma-mapping.h>8 F1 Y. c' p7 f! @. D0 K
9 _) ^+ u+ C) w* C# J- #include <mach/memory.h>
" p, Z9 r' K' ]% }/ ^ - #include <mach/hardware.h>! i- I6 C; v) a* Q& R' G- l
- #include <mach/irqs.h>
7 X* L ^% i D, i* G% Z% a( B% Z6 m) ~ - #include <asm/hardware/edma.h> B7 U% P' e& `2 J
$ t% b( X+ l: Z1 r- #undef EDMA3_DEBUG( U* t7 q/ z- X6 \* @ Q" B- [6 R+ p
- /*#define EDMA3_DEBUG*/- D2 d1 e0 r1 d& C0 e
- ! M* z/ g! S3 }; {. r
- #ifdef EDMA3_DEBUG
3 {. B$ g3 u V$ \9 t. } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% V4 K# {0 b, ?. q5 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- c4 J: B- g2 l, R8 G' d4 t8 p9 u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- R+ u4 e1 v) d
- #else+ D" A1 Z7 ~8 G, l
- #define DMA_PRINTK( x... )9 N; r, ]" [" w# _
- #define DMA_FN_IN
1 L) e& ^6 r8 Y# H1 U' p% c6 k$ n - #define DMA_FN_OUT
% W2 _7 B* X" k* E( M% j - #endif# Q5 u' z% P4 j, c" C1 o
! |5 }, U* B3 k4 H e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ O2 G( c, d& S) x# ~1 k - #define STATIC_SHIFT 3* Q3 L- @% C t: Q: c2 K* B
- #define TCINTEN_SHIFT 20
4 C# ~% {- Y& p4 X3 B4 a( [ - #define ITCINTEN_SHIFT 216 P( W; N7 s. D% Q/ `
- #define TCCHEN_SHIFT 22. l8 c) q2 N ^% w G
- #define ITCCHEN_SHIFT 23
H+ z1 q" E N1 e1 O( k: P J B - 7 Y' @) m4 `( {2 x
- static volatile int irqraised1 = 0;' }8 h" S/ y' j. |9 Z
- static volatile int irqraised2 = 0;
8 t- G9 C5 d* `. Z7 `0 P! r) t9 V( ` - 1 {* j8 k8 {5 P5 ]8 A" U% Q$ \+ h$ T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ~8 h& k+ p8 s. d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ R" \9 R9 K' j4 L5 \+ @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- X: q: H) }: a - 3 I% s. v3 _/ ~& |
- dma_addr_t dmaphyssrc1 = 0;' w2 U, t2 r( H- L
- dma_addr_t dmaphyssrc2 = 0;# a: t$ d3 U2 H! T u
- dma_addr_t dmaphysdest1 = 0;* {, ^$ O/ v4 h4 G/ ?) W
- dma_addr_t dmaphysdest2 = 0;6 c- E. z+ c% d' o2 D& e! y
- . ?3 a2 L2 C: d5 l% g
- char *dmabufsrc1 = NULL;- a, j% W0 B2 a! W3 J
- char *dmabufsrc2 = NULL;
- y4 a, R% j$ Q& K2 h - char *dmabufdest1 = NULL;" p0 u5 F5 N% s4 k2 s
- char *dmabufdest2 = NULL;
7 ~* p6 u' X/ l. t" H$ m
- V+ E1 y" K m- static int acnt = 512;3 V# o& e6 \% Z- g( I( v
- static int bcnt = 8;
. m" ^& ^1 r0 ^9 ] - static int ccnt = 8;5 H& b5 D( ]2 I Q/ I% H( L" W
- % X. _8 j; T1 ]0 f
- module_param(acnt, int, S_IRUGO);4 D( L/ S: a5 C" g
- module_param(bcnt, int, S_IRUGO);
9 I2 h# C; V; {" q2 B+ S0 G - module_param(ccnt, int, S_IRUGO);
复制代码
1 h, K6 ~) b8 h7 y! a7 D% m; \# [9 J3 y$ j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& p2 a9 J# c' r& i4 \9 t/ `9 Sarm-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- t5 Q- Y% h e4 |1 o% y6 q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 h) i. |4 ?$ @: o: M. }8 x, |3 s
; a5 m" m4 ~2 x# u- g" f& m. F) T( A8 T" v5 o# B9 b+ W' Z
|
|