|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# Y4 a9 e$ p2 k& S9 b- [code]EDMA sample test application' s7 e$ Q* H' e) |
- /*
# N! z5 w6 r3 q, Q: U4 s - * edma_test.c- \. c0 ^$ y! H+ `
- *
: h _2 R, i( F$ K0 E - * brief EDMA3 Test Application5 ~- K. r* F0 c
- *
+ P Z$ Z j# f2 t7 v$ ~ - * This file contains EDMA3 Test code.
- c8 \ [* t4 A( x - *
8 V) _/ O& ?8 {) `# Q; R/ l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ v- F4 {! t5 B6 H5 h: S9 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; n# w" c1 ~7 j8 W; a& [) u
- * TO CHANGE.
* c+ L' x* `( O" G- S. } - *+ H+ X7 e- J+ g- w. f6 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
L& R6 w( y% N' @ - *
* R, R& a9 F* i% l0 g" { - * This program is free software; you can redistribute it and/or
, L$ X2 L3 n7 D& U( ~ - * modify it under the terms of the GNU General Public License as; S* W4 e! ]1 j
- * published by the Free Software Foundation version 2.
- B6 D7 L) g: W( M - *
: p8 V; W+ [, q! r8 _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( I, `- O, ?% P6 x9 S$ ?. e1 N/ G6 e
- * kind, whether express or implied; without even the implied warranty
0 {4 G4 }. ] B+ A ~9 K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 D5 N/ M1 Z1 F6 g
- * GNU General Public License for more details.. T9 x3 J/ s9 A7 C: ]
- */$ e5 n5 f# I/ P
- _7 D/ @- P- v \) b1 s7 y) s9 A
- #include <linux/module.h>- z5 J. r+ P% i( s' Y3 a
- #include <linux/init.h>9 ]( A$ y2 g K6 d
- #include <linux/errno.h>
) D# @; W2 A6 B8 y+ F9 _ - #include <linux/types.h>! w# j( j! Z2 u& Z0 l
- #include <linux/interrupt.h>. E# g# E) z, b+ Y2 I" q
- #include <asm/io.h>1 w& a2 c Y0 g% B, ]$ b9 d
- #include <linux/moduleparam.h>! o4 ~8 o! g+ D7 R( t4 a
- #include <linux/sysctl.h>
$ j! m8 L+ }* r v - #include <linux/mm.h>& H, @ T9 r. v, U
- #include <linux/dma-mapping.h>
' G' w- y( Z, }+ e
Q/ t6 A0 L3 L1 l3 O4 a) w5 U- #include <mach/memory.h>7 B% G: W4 m4 {$ K, a# b$ z
- #include <mach/hardware.h>
- q& T3 K" s; [2 | - #include <mach/irqs.h>2 u1 p* \& E% Y: `/ [2 |
- #include <asm/hardware/edma.h>
0 Z/ E9 W; x5 Z
" w, g& p' v' G8 R: A% d- P7 A" V- #undef EDMA3_DEBUG
7 ^7 c8 h; u) u: ]5 i2 p - /*#define EDMA3_DEBUG*/
% y6 @. V7 K5 W, [ ]
+ C9 P. j0 ]+ ^5 O- #ifdef EDMA3_DEBUG
5 T1 a: Y% Q+ A% r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) E' u: R. y- \) |) b- S0 `5 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- P8 ^) ?8 d1 ^1 l1 u: L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% }7 \9 x: i& `( F" j - #else
, |( x) n0 I2 ~9 p* J8 [* ?- y - #define DMA_PRINTK( x... )
( N$ Y, | o6 Q6 W. G - #define DMA_FN_IN
) R6 z. I/ }1 S# R" }' m& \ - #define DMA_FN_OUT
5 ~7 P; ~/ h6 f5 }5 H4 e - #endif9 r4 W$ b+ ]0 `# |2 S
- / I5 p9 k) p! w+ I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! \# Q7 }% d5 w/ [0 p4 B- p - #define STATIC_SHIFT 3
) A6 R3 ]7 `+ K( N& |0 g - #define TCINTEN_SHIFT 20
# u1 [4 e, X5 f3 p% X6 k - #define ITCINTEN_SHIFT 21
- d! i% v. f( L5 G! e) h' |) x - #define TCCHEN_SHIFT 22, J6 E1 t2 h& q; o W' I
- #define ITCCHEN_SHIFT 23
8 y$ J% d' w* c' F
% J) c+ Y9 w* ^5 I- static volatile int irqraised1 = 0;
8 {/ w, Z/ m" |/ @9 I; {2 a - static volatile int irqraised2 = 0;
0 y% X$ U- ]* Q - / ]5 {- N8 V h- `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ F* `! v; U9 e: s, ^, ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ M) l+ L% j3 `2 C/ w5 @6 ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ]' p! ?/ @/ x1 k% B; o0 T& n0 e/ Q - ' E: R3 G% B. w- i3 I W) z. D
- dma_addr_t dmaphyssrc1 = 0;% H) m8 R0 y' y# z1 f0 k! Y
- dma_addr_t dmaphyssrc2 = 0;
i8 y! y9 S8 a9 I H/ y& ? - dma_addr_t dmaphysdest1 = 0;/ E1 t" x) x1 a' r- z
- dma_addr_t dmaphysdest2 = 0;
. b" R- Z+ E9 m \/ Z9 g - + P1 F$ F" ^: o' |3 p! l) h* P
- char *dmabufsrc1 = NULL;
' D9 X) E% _% |/ _! j - char *dmabufsrc2 = NULL;
) u' D6 z$ y) z - char *dmabufdest1 = NULL;( ^! A3 i0 A* y) X, o$ t2 Q
- char *dmabufdest2 = NULL;: ]2 |! p# c8 W0 m8 [
9 n0 l# u7 m b1 D2 C1 a7 W; Y- static int acnt = 512;' ^7 ?5 ^# z4 _1 y8 [# ?+ C v
- static int bcnt = 8;- |# @+ K' ?# }; G# y
- static int ccnt = 8;/ r* n ]% A( o( \; G; l) x. I5 M
: s# B" I) G7 A- module_param(acnt, int, S_IRUGO);0 @1 d4 z( [- g) X! l- h" M
- module_param(bcnt, int, S_IRUGO);
; |' J. W+ k; f& q) V" U4 o - module_param(ccnt, int, S_IRUGO);
复制代码
6 |5 k& J S1 v: j& Y* a
5 ^7 t1 b( @3 C+ N+ d0 U4 @8 K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 k$ ^, u, Y3 E4 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) b% L4 f7 o) |! ^8 b$ c9 g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( H# L% B9 x( N& \* d4 F) K- i2 a9 I4 j% P, R4 R) s% P3 W
. m4 ^% {4 L3 Z
|
|