|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) Y; C0 H2 D, M' x
- [code]EDMA sample test application) @* H# D, E: P3 A" P5 @& J0 ]
- /*) B; `8 ^' t, N1 B9 x' F. }. Y
- * edma_test.c
$ x7 j( s( _* K8 v. T# K& I. d' | - *
1 q8 t9 |* d7 i8 u$ C$ Y3 Z R6 J - * brief EDMA3 Test Application0 v- k- I& w) r' E, l+ ~( \
- *& U8 t/ l) m1 L+ Q. a8 r# R
- * This file contains EDMA3 Test code.1 D* p( h1 M; H
- *
( S+ q5 r9 f. ~2 |& y& }/ q, K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. L) G4 a2 A" H, Y- g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( V5 V2 ?; s9 h3 ]: }9 l4 I
- * TO CHANGE.) @" H. n- y E5 b n# G* P
- *: X. d2 a( q( _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- Z# z" r8 Y" [3 M8 m. l4 u/ G - *
( d3 l6 l2 J/ X- M f, [. f* x$ f; N - * This program is free software; you can redistribute it and/or- X1 U, n/ D+ N; p$ ^' J- n
- * modify it under the terms of the GNU General Public License as8 `( ]0 @* G" b$ T
- * published by the Free Software Foundation version 2. L6 \5 U6 y+ J2 ?$ Y
- *
8 k" k0 j) o. B6 i7 Q) e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" M4 z! L3 k( r: Y* f - * kind, whether express or implied; without even the implied warranty
% C' A3 @0 n% w/ g( Q# J$ b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" [1 |7 b: Q/ m - * GNU General Public License for more details.
# z; ] x0 Q) W' { - */
% s U& M, f5 e0 Y0 q+ A$ | - + ^6 k6 A$ P: E& \0 N( Z' ^
- #include <linux/module.h>8 r5 n/ w, l i& H0 U, ~/ X1 S
- #include <linux/init.h>
* r/ i+ Y2 O- ~9 [, M7 a% P( E - #include <linux/errno.h>( \2 E* V( ]4 d& n q& m: ^
- #include <linux/types.h>
0 _! ~$ h: {: J, ?- f - #include <linux/interrupt.h>2 N7 P! Q+ }, P5 n& ]
- #include <asm/io.h>
2 N- w5 N- E9 j1 \ - #include <linux/moduleparam.h>) F) ^* B2 s2 Z- _
- #include <linux/sysctl.h>
5 K3 n( J+ S w2 o2 G - #include <linux/mm.h>( O6 G. B% x& {& t* [
- #include <linux/dma-mapping.h>' M3 O; z: m) l9 ?2 _
- 3 q/ h# }# H1 ^6 E1 l
- #include <mach/memory.h>
4 c$ ]9 G3 W/ N: o! c$ q2 `; e - #include <mach/hardware.h>6 [* x. Q3 W# I0 p2 W' _$ p/ y: h
- #include <mach/irqs.h>& z8 N7 u, Q: ?( O$ e8 ~
- #include <asm/hardware/edma.h>
/ B0 @% B2 ?3 y/ v M" K* V, U - ! `4 ~1 B! Q; p- o0 k% ~; c2 h: {& J
- #undef EDMA3_DEBUG
) ? ]9 c+ k8 m: `8 q - /*#define EDMA3_DEBUG*/$ I* T2 T; D# c0 W
/ }# v; e1 P# x0 V7 g: m/ o! _- #ifdef EDMA3_DEBUG
4 ?6 r6 a/ S, N" S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" |) ]! U0 H; E) P3 ?: ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 H* L; a* S S; v5 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# v/ P+ b1 C( c - #else, Q# ? K; w& g
- #define DMA_PRINTK( x... )7 ?( i5 ?5 w% h K$ e/ f
- #define DMA_FN_IN$ b b" D& c: }% g6 r# q. K
- #define DMA_FN_OUT
- Q5 e# ^$ a! L. I - #endif
/ c( D5 @8 t p3 g3 K9 ^% M' Q% n - c n" Y( s5 f! o' @, z- c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- p7 G* w1 y+ t: C( P7 j
- #define STATIC_SHIFT 3( h( Q3 u! J0 i2 Z) Q/ y
- #define TCINTEN_SHIFT 20: X8 L" F7 _- w7 x/ y3 ~
- #define ITCINTEN_SHIFT 21
& Q/ n& y; V/ O! D6 g! o; D - #define TCCHEN_SHIFT 22
4 l$ D3 \) v' s( S% w - #define ITCCHEN_SHIFT 230 F# l% g6 I R
- 8 V' w( _) M a2 l2 g
- static volatile int irqraised1 = 0;
( p5 b' I) [; V1 a - static volatile int irqraised2 = 0;
+ l2 E3 }% `0 j& r2 i K; q7 |4 W8 F - / l. z2 O7 \1 T# T- y" Z5 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 j$ I; F- W- `& ]0 F: }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# }7 k4 c- _9 Y1 b, p8 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ]9 i6 E3 s' D - 2 i d! z8 |* F+ [& ?+ x3 b0 t
- dma_addr_t dmaphyssrc1 = 0;
- [! f+ N$ g/ E - dma_addr_t dmaphyssrc2 = 0;
4 w* P8 o3 f, R9 G8 x - dma_addr_t dmaphysdest1 = 0;
- D1 k+ ?8 o% W3 i - dma_addr_t dmaphysdest2 = 0;
6 ^: r# K. N8 ?0 r9 ?$ G, Q - / O2 P6 W( {$ y1 b5 d1 u
- char *dmabufsrc1 = NULL;
) C: F$ L3 U9 p, ]3 {- R - char *dmabufsrc2 = NULL;6 D9 f' i! Z& o2 r" p
- char *dmabufdest1 = NULL;
) a1 M/ l0 x. L( N* e! N - char *dmabufdest2 = NULL;/ P9 {& V) r# L* A V
- 1 k+ c# d0 a2 J( C
- static int acnt = 512;
/ h( I) h; w8 z9 o# C) H- A - static int bcnt = 8;
, @% F" u" [) }, e0 R+ V' [1 D- a$ v - static int ccnt = 8;
2 d# d8 J0 [ I - 1 I1 C- G+ m+ v9 P& I. |+ l1 |* w/ e
- module_param(acnt, int, S_IRUGO);
; l- n p1 e; b& J- v# A( ]( w2 f - module_param(bcnt, int, S_IRUGO);5 i( o5 ^7 x N& Z/ r9 A6 k
- module_param(ccnt, int, S_IRUGO);
复制代码
/ U' U* Z% \4 G1 ~, e: H3 H! l% ]* b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ O& e9 ~; j9 n1 C5 {' ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# M3 u$ ]( ^0 h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 h: _4 ^7 k) y1 Z
. c7 a* o1 ~! v' ?) ?( W
, k) t5 v7 h E. Y# ^4 t
|
|