|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 I- m% _. J/ G! e( \0 }$ V" ^
- [code]EDMA sample test application
M6 P& P$ N7 B/ K0 m - /*
0 a$ z* |4 r% R2 u* b - * edma_test.c* Z$ I" U1 u6 q" e2 F% W
- *- F/ t# |( x2 G9 r+ y7 Z% c4 M' o
- * brief EDMA3 Test Application
5 |7 I& G2 i) `- K - *
8 |6 i4 q; B6 r5 t z0 E - * This file contains EDMA3 Test code.9 q/ ?4 @8 `: U$ R* w1 U2 A7 m
- *
' W) y3 y Q/ F( ^+ W2 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 \( g* C+ k, N' W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& v3 X6 E, B4 l- i - * TO CHANGE.
$ j4 M7 }% N3 S: ]6 ^6 P: N1 N - *# K# D. y# k1 j% C, w' Q5 P4 @# _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) K3 |5 w. L4 a7 S' j3 z; x! e - *
- @& Y2 P$ I1 h- b% E7 G - * This program is free software; you can redistribute it and/or. c( _, v- r+ ]! n: B4 P
- * modify it under the terms of the GNU General Public License as
6 R9 Y9 Z" Z1 H% Y& m, x/ R - * published by the Free Software Foundation version 2.4 R% S: \8 D2 m R' @( h& Y/ w
- *+ J1 v1 h9 h; {2 w- P% [0 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 L: p5 [9 d7 R+ ^9 S
- * kind, whether express or implied; without even the implied warranty, U! E( w' P7 E. \ o4 ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ Q2 ]2 z D1 _3 u6 d8 [) @ - * GNU General Public License for more details.0 b( ]+ S- R) K# O. I6 I
- */' O& @8 F7 l4 V8 B; h" _4 V
- . f- D: U$ C$ L
- #include <linux/module.h>
* t2 m; {# V1 E) C: a$ ^ - #include <linux/init.h>
5 j5 O& J+ E- `1 L - #include <linux/errno.h>
5 g# K0 o6 C' G$ u0 }5 W; T - #include <linux/types.h>
- L2 m' `6 z( q - #include <linux/interrupt.h> Y3 F" m) f( u
- #include <asm/io.h>
: _8 d& u) _; o( r' j( G - #include <linux/moduleparam.h>5 @9 i7 m7 i1 J$ \" A8 C0 D
- #include <linux/sysctl.h>/ Q& V# U9 M ~$ y g
- #include <linux/mm.h># G1 m, @ v' G
- #include <linux/dma-mapping.h>2 x8 G" C" o# v. l% \0 ^" l
- : T0 k& p1 h6 {, N
- #include <mach/memory.h>3 U2 }" }. }2 P
- #include <mach/hardware.h>
/ G1 ?6 p$ z& b. s7 m - #include <mach/irqs.h>2 L) w. _3 I% r8 t5 @
- #include <asm/hardware/edma.h>9 O) [0 G$ c3 N0 O
& n, |( q' P, f) ]- #undef EDMA3_DEBUG
" r8 x2 ^4 c& @0 l3 b3 L" ^1 G - /*#define EDMA3_DEBUG*/
: a3 O# a" _ d; a
5 H' S$ @2 C; N$ u! a. Y- #ifdef EDMA3_DEBUG
( z' `; x- Y4 t+ S; S$ R1 U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" }- d- L, r* e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 E& z) q, _+ J: U7 @- `7 A, P/ M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ A3 E; [4 k3 ?0 c/ g! Y
- #else
' Q" u L/ e+ T0 A d3 a0 k V$ Z! c9 o - #define DMA_PRINTK( x... )1 U. N4 q8 a4 N8 D! N
- #define DMA_FN_IN
2 o& c) T5 N+ f3 E- x) \! T - #define DMA_FN_OUT
$ _- Q, }' J. O8 T - #endif
& p: p. E0 O( d' u h/ p6 G% J; R - 6 _9 J) l8 d; `1 a" t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ L" h" [: j3 ^8 L
- #define STATIC_SHIFT 3; S2 c6 f% I3 D( d
- #define TCINTEN_SHIFT 20
+ x6 C% j2 p. { b1 ~* K - #define ITCINTEN_SHIFT 21
8 S9 X5 t- W0 K; b# p - #define TCCHEN_SHIFT 22
8 V& a q- n% p - #define ITCCHEN_SHIFT 230 ^* D& t/ O# ^; N" q
$ W: |6 ~( p4 \$ _- static volatile int irqraised1 = 0;0 n! [7 j6 }/ X0 r
- static volatile int irqraised2 = 0;
$ Y& r7 X5 Z7 S: U- f* d! G" X - ; ^! N2 T2 V8 d, H* B {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ R0 ?1 W4 V4 K" v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% a; o/ `7 ?/ `, q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& d( u% u( {5 I* b; k& O) Z
- 9 h! i8 }& n3 P
- dma_addr_t dmaphyssrc1 = 0;
, g; I K/ r9 E+ D4 R - dma_addr_t dmaphyssrc2 = 0;
+ N) ?7 p' S# m4 ^3 w2 e. H. }4 O - dma_addr_t dmaphysdest1 = 0;
8 E! V" e! a- R# d/ r+ P2 m - dma_addr_t dmaphysdest2 = 0;/ Z' F6 ]* w+ J6 k" {5 Y$ G, \! P& c
- $ u* ]2 n9 O3 o- z4 M! K
- char *dmabufsrc1 = NULL;
% l' a& u$ U" O8 g; P - char *dmabufsrc2 = NULL;8 [) x# _) u+ y" ~: |/ s) {; a
- char *dmabufdest1 = NULL;+ E6 z# m. E0 a1 ~
- char *dmabufdest2 = NULL;
) b1 r v0 z, g) |4 _3 m. k9 ^9 t
2 x' a$ ]3 T) d j6 Y- static int acnt = 512;
0 {. ~9 K5 U4 }0 e: } g/ \, b - static int bcnt = 8;, Y4 _+ V9 L& D
- static int ccnt = 8;
7 N: u4 X: G3 J1 T. ?/ O: _
& @# Z8 X8 v) c, N+ e; C: i- module_param(acnt, int, S_IRUGO);, {. e& X# R; {5 e+ W
- module_param(bcnt, int, S_IRUGO);
' X, e; m7 B9 u4 q - module_param(ccnt, int, S_IRUGO);
复制代码 + q3 E- j4 p9 J/ v' ?
% X3 j* V+ J# {8 X+ A. Z& A# n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 C- K8 b4 p$ c aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: U( a; Z5 L& g! l, L7 Z7 q l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: N2 \; E7 ?0 `3 e
( v: |( }+ i) u! \ `& j; \7 c4 T m% z# o
|
|