|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 z. ?$ ~, D- S2 ~: I0 J. ?: c- [code]EDMA sample test application/ e2 N7 j4 W% m
- /*7 Q, o1 \* ]& ^) s1 T
- * edma_test.c1 ~ @9 W2 ^3 ^$ O
- *
- M3 w; x) ]) K2 K1 s: H; z9 a9 S - * brief EDMA3 Test Application
. W0 ]$ W6 i; ~) ? F - *
0 h' j# r: M% i% T3 e - * This file contains EDMA3 Test code.
3 J$ O) k, d$ V: v8 T8 y - *, V. {: _7 A$ D& y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 s' P! L4 E: M8 D0 _. O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 _# X( \5 m+ y2 l - * TO CHANGE.
# t; Q: }* m8 @, }& y1 X8 E+ y - *- v, |: J) M" _8 I" ?* K- w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; ~# u' D) V/ c( R4 v9 o7 b - *2 f8 X. ~: y; A: q6 F
- * This program is free software; you can redistribute it and/or
2 Y; m6 F$ H+ u; I& j1 ? - * modify it under the terms of the GNU General Public License as
( I0 Z1 j* |: M8 Z( W6 h - * published by the Free Software Foundation version 2.
, e- U9 b" [* [1 i6 M - *
& I: {2 h* \8 n& r) z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" x( ]7 R' N) E- w$ Y/ p
- * kind, whether express or implied; without even the implied warranty
& d e& P' a' k: n# U9 r4 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( `5 x; \7 g' @. J. Z
- * GNU General Public License for more details.
# z" P5 M, A9 v0 @6 l - */1 ]" d0 s7 o; Y4 B5 d" l
- - p! ~+ ?- t2 S5 a- J7 ^& [- k% W
- #include <linux/module.h>
2 i3 z# b% F' A' X; L - #include <linux/init.h>+ b$ u5 E9 ^+ ]8 M$ g
- #include <linux/errno.h>" Y- w% o0 |' ]& ]
- #include <linux/types.h>* W! y( H. B, \% s/ c
- #include <linux/interrupt.h>) U3 t' S2 X+ |. ]# ~/ w9 n$ }
- #include <asm/io.h>
]3 p) D$ W5 N1 ~! ~$ Z - #include <linux/moduleparam.h>4 H3 r& J7 Y8 d) D
- #include <linux/sysctl.h>' K$ P$ U+ N% q' q( f3 `' o
- #include <linux/mm.h>
; p6 N4 z) i1 N [ - #include <linux/dma-mapping.h>* N! V; ?0 _8 n, v n$ M5 F
- , D" ]4 x( P/ O3 a7 k
- #include <mach/memory.h>0 s1 u6 m* T, g
- #include <mach/hardware.h>
# f) V) M5 @1 i - #include <mach/irqs.h>8 m8 K$ b W1 H& U: u5 i( ]/ t
- #include <asm/hardware/edma.h>
1 @0 C( [" C+ f4 p$ s4 a' c
% d2 b: U4 d# ^: m- #undef EDMA3_DEBUG
7 P0 v( q2 p0 D4 |# S - /*#define EDMA3_DEBUG*/8 g9 t+ ?4 X9 O% i% Q- a& s
" n: `9 Z" j: }& m2 ^( }2 y3 }- #ifdef EDMA3_DEBUG) u7 \: J3 q3 l* h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& H" {/ g# t8 ?6 f, T9 g3 z( P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. h2 a7 K7 S0 d% m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( B0 W" J( n3 d7 V0 N - #else
; p2 K9 r7 i& g( O7 d - #define DMA_PRINTK( x... )
3 M& E2 }1 ]: B. a - #define DMA_FN_IN0 P7 N/ ^ I0 ~1 e! S; U0 ^
- #define DMA_FN_OUT5 S4 X! E) p1 X: A' l9 x7 z
- #endif8 s& R4 C! b+ t8 R& A
- 8 ?6 c; @4 d/ D* j/ v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 a, |" g; \- ?: `# N - #define STATIC_SHIFT 3% P. ?5 i! v! q) B1 R9 `* {
- #define TCINTEN_SHIFT 20
0 u- I7 g$ {* L: X& d6 L - #define ITCINTEN_SHIFT 213 W* [% }/ K1 ?& Q* p; V$ X
- #define TCCHEN_SHIFT 22
( z# z% p. o0 l! L: [ - #define ITCCHEN_SHIFT 23
$ X Y {# D! h: J0 |# @9 v
3 g; `" T5 j9 E: c- static volatile int irqraised1 = 0;1 |2 |: v' c8 F I+ }& K4 v; n
- static volatile int irqraised2 = 0;, k) m/ \4 R- p, H6 m
[; m0 P6 `/ F" q7 x/ H4 P8 [+ |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. r$ U2 \! @! t. s. A; b; K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! \( L' q" w8 ]; h1 }6 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 r$ e3 L: b* I5 Y9 d x
6 z8 j% I+ {1 B, @) o* F. u, x- dma_addr_t dmaphyssrc1 = 0;; z8 o( ]4 {- w( o8 w; p; k
- dma_addr_t dmaphyssrc2 = 0;1 t j' \5 E: X2 M Q% r+ r: ~
- dma_addr_t dmaphysdest1 = 0;: U* d4 O3 ~( z& f: I
- dma_addr_t dmaphysdest2 = 0;! n( j/ |1 o) [+ [% b
4 c; X0 {: {3 d; f* a- char *dmabufsrc1 = NULL;# y( ~) ?! k, Z7 ^
- char *dmabufsrc2 = NULL;
2 s2 _% q2 X; x; u0 F7 d" S0 @8 k - char *dmabufdest1 = NULL;
1 w- {* V( J; r+ j/ ]% ~: V; [ - char *dmabufdest2 = NULL;
+ S# U; @- k% `% z8 V5 @ - 3 G4 k$ @% |6 ^" V/ ^* I
- static int acnt = 512;) j; a4 ?3 l5 u+ [* d* V
- static int bcnt = 8;
$ {/ x1 \& C* e9 n2 s/ L - static int ccnt = 8;
1 A- Z- |: y2 q" U
- y3 R2 d" ~- X8 R$ G) K: q! H; y) N- module_param(acnt, int, S_IRUGO);- x7 _- c- e6 g; `8 e
- module_param(bcnt, int, S_IRUGO);
+ k1 D1 ]# ^' }7 I( `$ n7 I: q - module_param(ccnt, int, S_IRUGO);
复制代码 1 W( w, P2 C# j
2 I- `$ s8 S0 s, P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; Q1 j6 i/ @5 m( o" Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 T+ C$ d2 ?7 I; j/ t7 _2 e! y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 G: _1 I F: a7 }
* R8 E. E$ P) K2 M, x; [* E/ Q3 p, U/ s) |- D f
|
|