|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 [0 F* W( _: o) f; R; q0 t- [code]EDMA sample test application
8 d8 z% n) @' l( o - /*
3 Z1 F; T5 h) \. ~ - * edma_test.c/ T. G, o( U# f9 E6 Z( V" r
- *
9 J; U/ c: R4 M) }# [: i& P2 c - * brief EDMA3 Test Application$ }, ?' r& }& I/ l1 e, d: f9 B5 w" _
- *9 v; k2 c5 V! ]. E$ O7 g" H1 X
- * This file contains EDMA3 Test code.
' Q" g9 V+ _: d' ~* _& | - *9 K% h, i* I/ `# _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 `0 f; n0 i( l, |2 W/ W. h# q1 i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 i3 P' |9 p0 Q
- * TO CHANGE.
" ]6 C# }. t' A- i. g5 a - *
1 i5 h# r8 h" O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! v; u8 i# ]8 o+ C. N- `9 G - *
% A: ~9 L% [8 T8 b - * This program is free software; you can redistribute it and/or! H( E9 D/ \! T; Z" w
- * modify it under the terms of the GNU General Public License as' T3 @* T4 a6 F% F% c
- * published by the Free Software Foundation version 2.
8 v6 L- r; o& C0 P- o. X - *
7 g' U( [. m. b! q6 i5 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 L6 l: X- \+ Y+ e& E' F d- M
- * kind, whether express or implied; without even the implied warranty
: p8 }6 f/ h4 |5 |4 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: ?+ a& g: ^0 H3 A) D& d
- * GNU General Public License for more details.
/ \% Y2 t% Y4 s - */
% Y0 J* Z0 z' ?8 D1 V( u& O
6 D, F4 E5 D3 M9 C" L+ _ s- #include <linux/module.h>% k# _; b. @7 }+ k" _% L* q
- #include <linux/init.h>
- F& p1 b. S1 y* Q$ E/ \ o; \ - #include <linux/errno.h>
; s5 N8 z. t' v+ U - #include <linux/types.h>
3 p% U! Y2 D3 } - #include <linux/interrupt.h>+ t( U' ^9 Z( v) I0 H8 o4 A( H6 k
- #include <asm/io.h>" Y- M' `1 F4 c9 ?- k# H# @8 k+ v
- #include <linux/moduleparam.h>; @* H% K' Z1 {! p9 A3 M
- #include <linux/sysctl.h>8 z. h5 Z2 n, P+ w' v& J8 q6 o
- #include <linux/mm.h>8 I* T' q! `+ B7 a+ l! {7 P- H% ~: r4 p
- #include <linux/dma-mapping.h>
0 ]; `7 B! L P5 i
u0 w; k; Y" v' N* i, v- #include <mach/memory.h>
& b0 `8 A6 k" d0 L( |: ] - #include <mach/hardware.h>
$ \7 r$ O) n3 h# O9 c2 G5 Q2 a, f8 o - #include <mach/irqs.h>
- I) e1 }' u& R, }* U1 M( z' N - #include <asm/hardware/edma.h>" D! d) B3 w9 {, F4 q
- 1 v; s# c5 X7 Q% j- W4 A
- #undef EDMA3_DEBUG+ f- R, _8 E) o( N
- /*#define EDMA3_DEBUG*/7 o4 s6 l; L4 R( x% t
- 9 Y% ^8 A0 l# K, O
- #ifdef EDMA3_DEBUG0 I$ f& Q. j# W# ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; s3 E. S: n1 W8 ^- }" X3 x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), ^) d; \0 L5 `4 _) e/ w' E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 L. |! b4 x+ d, D: O+ X. r9 A - #else1 P# X5 B4 `! v4 A- i8 P9 L+ I! d+ [
- #define DMA_PRINTK( x... ), }7 B& d( t- M- O* n+ S. |) U* l
- #define DMA_FN_IN- A2 E' s" D: G- q4 I# q
- #define DMA_FN_OUT7 w; ^9 x* H/ G! ]4 ~& \) [. g6 L
- #endif7 Y# q% T6 t# f' h+ [. ~
- + y! N% t. ^. @. ?' e' N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 q9 e+ q) J7 l: } - #define STATIC_SHIFT 3! q6 s& Z( u$ o) F8 z4 L
- #define TCINTEN_SHIFT 200 F' `5 }7 M. ~& |8 g8 k
- #define ITCINTEN_SHIFT 218 ^5 H+ }. Y' M$ G5 q
- #define TCCHEN_SHIFT 22& W4 d3 c3 P0 D. _0 A. S
- #define ITCCHEN_SHIFT 238 x9 Q: W6 X4 ?0 z5 a9 @. ^
- ! |1 E1 h* x% D+ z' t; E' B# {
- static volatile int irqraised1 = 0;
' }( j- @0 r% g1 o6 c - static volatile int irqraised2 = 0;
9 Z9 m" A7 j& c% q0 I& s
4 a) J) ^6 |' p2 X4 P$ |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 L: [9 U9 ~/ o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 k$ c r8 f; U2 t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ~( I/ v4 s7 l! {* J- W
- " r8 Q) e4 Z: ?: O: z0 A8 l+ A
- dma_addr_t dmaphyssrc1 = 0;
: C- o" q, b; r6 q& v - dma_addr_t dmaphyssrc2 = 0;, H; ?7 k5 A- n2 j' ^2 O
- dma_addr_t dmaphysdest1 = 0;0 d2 L" D; f- N1 O) @. y
- dma_addr_t dmaphysdest2 = 0;
0 h9 S1 D( _* l5 {, F { {2 r
) @' {: N" D" D$ f- char *dmabufsrc1 = NULL;8 ]5 L0 \& ]0 [; T# S' |5 w
- char *dmabufsrc2 = NULL;
2 G. B; e% _0 q - char *dmabufdest1 = NULL;' R& X. p9 l' \- d0 K% o9 E
- char *dmabufdest2 = NULL; z2 ~) M' D: L0 }" I+ a, B
- & Q0 M9 ^0 h: f( h0 p" r
- static int acnt = 512;
2 m; `, ^" K2 s6 z- @7 ]8 V - static int bcnt = 8;5 _9 g9 E9 G% k$ N, I. j
- static int ccnt = 8;9 T& Q: D+ ]3 z( v# M0 M
2 L) F: H& [3 _' a- module_param(acnt, int, S_IRUGO);
0 D |# c% b4 G - module_param(bcnt, int, S_IRUGO);6 A8 a' f8 G; |0 h0 C( C
- module_param(ccnt, int, S_IRUGO);
复制代码 , h- O+ Z0 W0 ^8 S& H7 M
1 J; z# p( W2 x2 \6 K5 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 O. M4 T, O5 M+ ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 v& i ]- ?6 ^& ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( O- e9 y$ V& O5 u& `" S( y7 N
/ n4 S2 P4 `) D6 ~8 M6 I3 D5 {1 R8 _6 A: M
|
|