|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 b d8 A: x0 i% B5 f. F7 X. V
- [code]EDMA sample test application
; w& ~4 A- b/ ] r# e# N - /*6 R7 N/ I7 ]$ b# F5 u0 K, O# J, `7 T
- * edma_test.c
$ L; y" d0 j$ Z; O& K# S& ]( X - *" _6 ~4 V, P& F4 B1 E& `; G( P/ \
- * brief EDMA3 Test Application
. }& D( u% _0 B- I9 `5 t4 _ - *+ Z, V1 p, @+ F0 y0 ?% {( [. H9 _
- * This file contains EDMA3 Test code.
1 A; [! v: R2 y8 Z+ y a. b: g3 t - *
3 O' n+ v- n: `8 O" a$ u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 v- z. {4 |, n k- o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" k/ X4 V6 Z9 C9 i
- * TO CHANGE.
( E% L9 [6 @, c& [$ [ - *( N+ M; Z" k |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 E8 n7 r0 v2 V+ f - *
% |; Z) i) Y) V; n - * This program is free software; you can redistribute it and/or
/ B) {' l9 ^" J - * modify it under the terms of the GNU General Public License as+ {* M3 i) g5 g+ I2 X: B: h3 b
- * published by the Free Software Foundation version 2.; T5 R# K5 {( U1 ?$ H+ \/ `( S
- *
, L2 T! m4 D+ N. H) L u4 D$ t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 u0 x1 a$ `: Z0 C) S2 @8 P; N Y
- * kind, whether express or implied; without even the implied warranty/ I& |$ z0 \2 y) c# N; F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 V! p+ O. y* x$ R$ ?/ _0 X4 ? |5 Y
- * GNU General Public License for more details.2 N& t; R: T; _: u; z$ t5 M! N
- */
) J* p+ g N$ ^8 j
" R4 H" p/ H3 n+ p1 S- #include <linux/module.h>2 o2 D) ?/ M+ x, l+ u6 ^
- #include <linux/init.h>
7 K7 }$ Y+ N% N& e - #include <linux/errno.h>
- v6 g. |# o* Y+ k - #include <linux/types.h>8 ^1 H2 ~% A+ {; {7 Q* }
- #include <linux/interrupt.h>
* f' Q( b. v) s% Q - #include <asm/io.h>
9 K4 o" d7 y% M, m4 _ - #include <linux/moduleparam.h>
Z+ k* w) T9 ` g+ z/ ~ - #include <linux/sysctl.h>
& y& |+ R' u$ E5 \7 G7 X/ ] - #include <linux/mm.h>0 P8 x6 m1 ~$ j; `% H! w
- #include <linux/dma-mapping.h>, T) x+ M. y6 E" N$ s
- $ `1 w+ }8 q4 J
- #include <mach/memory.h>
# D& c+ b( B$ r- R2 I - #include <mach/hardware.h>
Q3 ^& V# G$ R& j, D* k- w - #include <mach/irqs.h>" ] c0 q4 |' m: H6 t0 j% q, o
- #include <asm/hardware/edma.h>9 n* X& ]3 F; P7 D/ Q
- 4 \* `0 N# E1 y
- #undef EDMA3_DEBUG3 z( t: ~$ K: g+ O* b2 `4 H0 M
- /*#define EDMA3_DEBUG*/& X. G/ k+ s1 w: x
- ) \- ?1 M2 C) N; f) K
- #ifdef EDMA3_DEBUG$ F1 M/ L: r+ D2 m$ M3 m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ c/ D I& D7 c1 E- ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) J8 x- j) Z% V0 _) \$ F- u' J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 k% [3 y# h4 O; ]1 y4 ? - #else' T3 E3 ~/ W/ X( W% h
- #define DMA_PRINTK( x... )
. I& W9 ~# \; m0 p5 V - #define DMA_FN_IN
* V" F. P5 {4 x R* { - #define DMA_FN_OUT
: S# u! J6 Z/ I+ d% n) g+ }# t - #endif
5 ?; S/ d z/ h - % ~8 K7 d7 A% H b+ }$ t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 Z9 X$ M; Q) C+ ~
- #define STATIC_SHIFT 3
) m' l7 g4 X/ X E. c; l: Y" ~ - #define TCINTEN_SHIFT 20) y" ^. A1 X4 {) f3 F
- #define ITCINTEN_SHIFT 21
* P: T5 l h7 c6 F& h - #define TCCHEN_SHIFT 228 h$ z3 M0 k7 H$ e& x
- #define ITCCHEN_SHIFT 23& b& }+ A) Z) j
- & d: ] ]. J3 M/ n
- static volatile int irqraised1 = 0;4 I/ o9 [: o; e( n
- static volatile int irqraised2 = 0;
& J% v6 l: V4 E/ L9 A - / a+ ?. F4 t/ ~' r4 x W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G+ f2 v% J+ F5 [" Z; p& i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 M9 |8 _: L: Y4 l# a: v- \, z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 {, g, ^$ }5 \) G8 w9 i3 V) @
- 7 [+ V, F4 b* h! ^0 }! E- i0 c7 w+ ^
- dma_addr_t dmaphyssrc1 = 0;6 \8 L n% d# e+ n2 ?% a
- dma_addr_t dmaphyssrc2 = 0;. ~! a4 t# Y, n- a8 R7 ]( \6 d2 @' u
- dma_addr_t dmaphysdest1 = 0;. V5 b1 ?0 D# z1 H4 Z
- dma_addr_t dmaphysdest2 = 0;
1 f9 E6 o' a* `* f% M
9 m1 i8 f+ N) q9 C9 w( A$ h" j- char *dmabufsrc1 = NULL;6 w* C' y0 d6 w4 p1 o( h) |4 }
- char *dmabufsrc2 = NULL;
! w# ?$ K9 H7 V( `4 ? - char *dmabufdest1 = NULL;
; v- U3 @2 c: j6 }# N1 F6 n - char *dmabufdest2 = NULL;
* ^* u' T1 h, R) z1 ]8 d3 O2 b* H
# r: C+ i" M0 b/ Y9 O3 B m4 w- static int acnt = 512;7 {: c9 c, U$ w
- static int bcnt = 8;1 \% u1 W: F4 k2 q- b5 V- p
- static int ccnt = 8;
. x$ K4 p- Z4 o/ h6 l/ R y8 h - 2 Z# o3 b4 M* l1 f: s% d
- module_param(acnt, int, S_IRUGO);- G* U$ l- x* S0 E% E% G y0 g
- module_param(bcnt, int, S_IRUGO);
) {# o* b/ W1 v6 I; F - module_param(ccnt, int, S_IRUGO);
复制代码 * F9 {) U5 C8 B+ r+ z
3 L( [+ }: \ L# t) Z* u+ @3 `, q1 i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) r" c3 f. m" C3 }! \3 u7 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 Z& p, v! K0 }2 m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: ?7 V8 s$ B2 {
" H5 Y* n) A; O9 H$ _' ^2 z
' d0 C/ _( g$ a! T/ q
|
|