|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* P! ]7 ]# ?3 x- [code]EDMA sample test application* _5 _1 s: N$ k) J. g, ~
- /*
& v0 y: J2 q8 q1 J - * edma_test.c
" v0 f; ^8 S* ?9 |( _8 } - *$ G0 t# k- ~2 H5 F) Z
- * brief EDMA3 Test Application
. O9 p; M3 ?7 @ - *# O0 I7 [( Y* p! {0 L2 V
- * This file contains EDMA3 Test code.
& c6 w8 P0 l0 d - *
5 G D `3 @4 c e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; |! D/ J, c. f8 C! O, o' U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: b, i3 q/ Q0 f2 o - * TO CHANGE.
- d. |% ~+ N8 V* L6 E& x - *
$ B% q9 `2 D1 n( m( l t2 ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Y4 W& T& i6 O
- *
) k }$ e9 A- J4 U, {! C- E% G - * This program is free software; you can redistribute it and/or4 v3 c3 Y L G; V
- * modify it under the terms of the GNU General Public License as2 w4 O; @4 Y$ P
- * published by the Free Software Foundation version 2.
4 I$ P, L1 c7 ?: x3 p - *
7 k' e0 G* a" ]$ G+ s% c' _% m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* S5 A' r. R$ ]* O1 p - * kind, whether express or implied; without even the implied warranty
{$ T: y7 X6 i2 T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 r. N4 W; K* \
- * GNU General Public License for more details.1 r5 T: U+ W% N0 j
- */
+ r, v: m5 ]$ ~ - ( h9 x- V a6 N. z ^& r
- #include <linux/module.h># j V" J c) Q1 F- X
- #include <linux/init.h>! t6 k( d1 _, q
- #include <linux/errno.h>1 g% Q6 d; b) c/ ~) p; w, f% `
- #include <linux/types.h>& n* }# w) z ^% E. D0 T' v
- #include <linux/interrupt.h>
6 [ l$ T- ?' M& b9 i1 X - #include <asm/io.h>7 a! G& Q, ]; J1 `/ M# S. K: ~
- #include <linux/moduleparam.h>$ G+ d" }9 p( X8 L- e. ]9 G J
- #include <linux/sysctl.h>; x! F9 G6 W. |5 q% E! n
- #include <linux/mm.h>
) G+ ^! `6 q& f - #include <linux/dma-mapping.h>- o( z- ~$ U5 x
- + b0 `7 z8 J: M7 S3 g
- #include <mach/memory.h>
/ l9 j1 u: A/ j. L! V1 n2 ?$ G - #include <mach/hardware.h>9 U2 ]% p- ~/ R, u8 s) L
- #include <mach/irqs.h>
+ `# }/ M& u+ @0 t& l$ h e$ p% U - #include <asm/hardware/edma.h>3 l5 l# e; F3 g: R, u" W+ `
- 0 V2 v# X0 p& Q i0 {
- #undef EDMA3_DEBUG
A/ B9 R0 p: h - /*#define EDMA3_DEBUG*/
9 |2 p! U6 F# X) O - ; Q- J* E% u1 @8 I4 ?$ A/ \
- #ifdef EDMA3_DEBUG9 u! ?: n; l* {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' F# P ?1 F1 \$ c- x& ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ d/ }( s, z' r5 Z( c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 p; S! D7 c m% @% u+ S - #else
% f9 A3 E+ s( Y, I, a+ L - #define DMA_PRINTK( x... )
+ M/ P( ^7 @, }6 D A - #define DMA_FN_IN
5 O5 h, O7 J; `6 N2 S - #define DMA_FN_OUT9 F% k5 |( Y0 z# E9 V6 B5 m! U9 E4 C3 {
- #endif! o5 j5 b" W8 a* x2 ] u; e
- 0 ~& ]# L3 J0 n1 A' }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' V9 Y, V9 ^5 [+ ~1 e% {# l - #define STATIC_SHIFT 3
. v, g4 k- J! K$ ]1 H2 c' W - #define TCINTEN_SHIFT 20
+ C. c+ F3 q4 P Q* H* n - #define ITCINTEN_SHIFT 21
9 k7 C7 o3 ] v6 S; K U - #define TCCHEN_SHIFT 22
' y& X& F4 U5 s% u- b, X4 i - #define ITCCHEN_SHIFT 23$ j; s- Z) X5 r% Q
0 `9 ~$ C& i8 Z* E- static volatile int irqraised1 = 0;
) E) M, e3 \! c* J - static volatile int irqraised2 = 0;
) q) p# @3 A* \
7 a" q+ n2 n- ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 w3 U6 h) ~; g, ]7 f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 t# t5 n3 n$ q# z( \& }- V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 {9 e- W! ~0 o# W Q - , z+ W( y( E4 U( ]8 l
- dma_addr_t dmaphyssrc1 = 0;
2 L Z! ?% `+ }$ \" J1 k - dma_addr_t dmaphyssrc2 = 0;
; E& O8 P5 `+ O: \- ]1 V1 F - dma_addr_t dmaphysdest1 = 0;2 T4 l1 t3 @" Z! {
- dma_addr_t dmaphysdest2 = 0;
+ i; P: W7 y. m8 T2 Y - 2 Y$ e1 a2 w* q2 G5 N
- char *dmabufsrc1 = NULL;
4 |- B5 d) P+ ` - char *dmabufsrc2 = NULL;
% a3 b1 w$ e0 C% @- B% ]* A - char *dmabufdest1 = NULL;2 l6 w) [3 y" Y! m) b: P$ B
- char *dmabufdest2 = NULL;9 ~& F# \/ X( H$ p8 N3 v
9 g* N3 ?/ O- j! @3 q$ Z+ x- static int acnt = 512;
" ]. l# d7 v; q$ F) E1 J' ~% |2 K - static int bcnt = 8;
& Q6 H* I: q, X* D! P - static int ccnt = 8;9 b; D3 l+ Z: z- t: t) \
. @3 k2 a# @& c2 m- module_param(acnt, int, S_IRUGO);5 D, |: A. w/ S9 X
- module_param(bcnt, int, S_IRUGO);
, v* c+ m. \/ r, Y - module_param(ccnt, int, S_IRUGO);
复制代码
1 c- i7 F* y. M* @
5 N. ]4 v. }' v) ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ~ y4 v; N1 O4 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- C+ q0 ?* r0 \7 E3 ^6 c) b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& g0 |" [0 \- C2 X, V E% I2 N @3 U9 T
6 S8 o& u; s6 L |
|