|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 o+ J" p' y' ?. ^4 v
- [code]EDMA sample test application
+ N" n7 ]) {- E6 G - /*5 f5 X1 h! M$ v' {" z9 K6 z
- * edma_test.c: `) _" Z) Q D5 {' Q P4 A
- *" u$ \; x. g9 D v2 g
- * brief EDMA3 Test Application
* s5 q' c+ Z# Z1 x- p - *5 f* j a$ }, I/ ^9 G% M; @4 c6 k8 [- j
- * This file contains EDMA3 Test code. i8 A" S* n3 A- x$ R
- *
7 X* @' i3 a5 j' Y- c+ E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 U) y! R* w% r- r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- N: U8 f J& K$ F; i' B - * TO CHANGE.
# r5 K5 }+ r; B" D! U - *
$ y' ?1 b# C$ [. o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 H& ~- p6 q! E
- */ @$ l4 A( e, r2 f
- * This program is free software; you can redistribute it and/or1 h' _* \* ~+ p
- * modify it under the terms of the GNU General Public License as4 |: g+ b9 r1 n$ ?, I5 A
- * published by the Free Software Foundation version 2.* K4 y6 y4 b; W) I/ }: k
- *" ~7 v, {+ E5 \4 E- `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" W: L# m; r; \5 U) U
- * kind, whether express or implied; without even the implied warranty
% j" `3 [- n. Q" q+ X+ \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- p5 D( h2 O- G ~" s
- * GNU General Public License for more details.. }' |% E* w' R0 F, b* W8 s& x# _
- */& H! P4 |2 }' E! }
- 4 M8 Q$ L7 O! o* m/ r Q0 P( [
- #include <linux/module.h>
) _4 H* @8 A" O' Y+ p9 l - #include <linux/init.h>8 Q: i% K/ X: c9 g( P
- #include <linux/errno.h>' j6 i0 A1 |! G
- #include <linux/types.h>
; [- E( n" c2 Z7 l, w - #include <linux/interrupt.h>
9 X. P+ V$ S, y6 ^" u6 U - #include <asm/io.h>
t# Q; X4 `1 ^" o& ?6 j - #include <linux/moduleparam.h>
$ [% y$ ?6 r' c& E& F z - #include <linux/sysctl.h>& C& X% q/ c$ o6 x: o1 h
- #include <linux/mm.h>* r# r* t2 }6 l# R Z: I! e
- #include <linux/dma-mapping.h>
/ f# ~# e: l& b: M* o) r# ] - 9 i+ e' H! I0 f! _
- #include <mach/memory.h>% ~& f6 Z! C! v' [3 v n5 G* x; z
- #include <mach/hardware.h>4 G0 b' g- H6 }% {" d
- #include <mach/irqs.h>, q6 a+ d/ _5 P
- #include <asm/hardware/edma.h>
0 W) G& {3 n) P9 c6 }
9 O9 U o+ y- Q, A) F r+ ?- #undef EDMA3_DEBUG
8 I9 I s2 | U8 j - /*#define EDMA3_DEBUG*/
" M7 I- O1 M2 x% ]' n. `5 Y - 5 g5 E' g7 q: Z2 q: K3 p3 J
- #ifdef EDMA3_DEBUG% c5 Z0 ]; e& M' W& w! F2 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 j; K+ K3 k* f+ [. i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- G9 b, h0 Q o. D- G+ u. @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' E8 s& w5 F. Q; N& h
- #else, V. w% L; k' h6 ~" }6 _) x
- #define DMA_PRINTK( x... )
/ @; U; ^6 C8 @$ n; h3 y - #define DMA_FN_IN
# N$ r! W" S0 ?, R) t5 A: V0 } - #define DMA_FN_OUT
$ @0 }" V `" u5 P) s9 r5 f0 y9 G - #endif
7 X. f9 a8 ?/ _, h3 P% H - ?/ K4 s; s4 G) ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), D) T" y/ ]; W5 m; {
- #define STATIC_SHIFT 3( M7 ~. g# D! v( J
- #define TCINTEN_SHIFT 20
8 r& w; g1 G2 y! P. o1 e - #define ITCINTEN_SHIFT 213 q: J% A1 c; v; \$ Z
- #define TCCHEN_SHIFT 22
. `5 c }* s, m# v4 y - #define ITCCHEN_SHIFT 23
/ K) |/ d/ {* I+ B" u - 9 B7 o+ z6 ]0 P5 U/ n
- static volatile int irqraised1 = 0;
. z V' u6 B P" ]% {! ~ - static volatile int irqraised2 = 0;
! H1 o' m6 N6 ?2 k) Z. q - 0 p. V- d9 R( b; c: r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Q0 | P3 }8 {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# a* ^1 {6 i" P U$ {$ h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M" {9 c* {) ~3 A
- $ U3 k' ?# R+ Z% Q$ y7 _
- dma_addr_t dmaphyssrc1 = 0;
3 x) g1 i/ y y2 ]( p9 A. C - dma_addr_t dmaphyssrc2 = 0;
6 N) s- M$ z& f6 _5 b: K7 n - dma_addr_t dmaphysdest1 = 0;& K! U$ o, V' u$ v
- dma_addr_t dmaphysdest2 = 0;; k: S. ~- W, `7 \
: c& d( q# P2 J" M- char *dmabufsrc1 = NULL;5 x; B+ n6 I u
- char *dmabufsrc2 = NULL;
" ~. h5 ` d9 O" u1 k - char *dmabufdest1 = NULL;
o9 k8 c* r A( z2 q+ K - char *dmabufdest2 = NULL;" n8 w# O' ^2 o; Q: o
+ d; C5 ?; m+ Y0 }3 v& i- static int acnt = 512;
" F8 |- T+ u/ l. j. u, |) l - static int bcnt = 8;
3 D9 ?# y [$ B' w( D - static int ccnt = 8;
) V- ^, U8 E2 f5 R7 V) V0 k - 4 C) S2 `( K' m! Q- b* [
- module_param(acnt, int, S_IRUGO);7 \7 }* ^) k+ O+ `! }3 e6 V
- module_param(bcnt, int, S_IRUGO);
5 g1 [* j( j9 H2 I( S - module_param(ccnt, int, S_IRUGO);
复制代码
5 y+ i7 x5 Q$ c6 |: C3 k$ g. g: `+ v9 I$ m3 P4 j0 P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 t6 N. {. }+ C9 }. t$ U; u$ F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- r5 @3 G" N1 o0 M) q+ n$ m: Q0 x; K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 U7 j% v; I. a* X4 Y- t5 S- v! D* n
( \1 {$ H" j7 k0 Y. s3 v6 B
* }5 o" E S+ s/ @$ W |
|