|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# n' \5 s5 a8 L- [code]EDMA sample test application
' B4 q" V5 u7 W/ V - /*9 S1 r9 B, w& w- J" G
- * edma_test.c
+ m' Q# E5 q% f. ~% ?' [ - *
, e+ d7 _) g8 ^* B; Y7 r - * brief EDMA3 Test Application" n2 A1 o# P% f/ Q4 e
- *
" Q3 x" D$ d1 b+ }+ U - * This file contains EDMA3 Test code.( I' F; f/ m/ F1 N7 I! D! o- u
- *8 c; z' R4 I) i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ?* w- G" r1 b& O {* K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 s7 s3 X5 \% q. [* R& F" P3 p - * TO CHANGE.
4 R# l( ?2 \- E" R - *
0 |! P2 j& Q" Y. g2 P! Y) r* m5 C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 D& q5 L X }" A* u* k - *
0 u, x0 |9 w% M4 r - * This program is free software; you can redistribute it and/or$ B. H& I! [" \$ X" `1 z! n
- * modify it under the terms of the GNU General Public License as, \1 _' p) N9 d$ h( Q. y2 ^/ E" ^
- * published by the Free Software Foundation version 2.1 o" { I) d4 `7 @4 d* J9 y, H
- *
1 Q' W1 s, f0 k0 ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
M$ N- m% X% a: V: I$ ~( n - * kind, whether express or implied; without even the implied warranty! i. V( k3 @2 z' C& D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; W- I; l. A) U1 | - * GNU General Public License for more details.' U% R7 L9 A& V4 _9 O' c, C( W
- */* S; c N8 p: R/ Q5 c. H
4 ]/ F V: U+ T1 i- y; s- #include <linux/module.h>
' h% u, k. W3 }. P; T6 V5 p - #include <linux/init.h>
" P; y- p1 j: U- ~; Q) p/ U - #include <linux/errno.h>
+ y5 M0 u5 D' T. V) J( b, ] - #include <linux/types.h>
; F; B' _5 S0 J8 ^. \2 ` - #include <linux/interrupt.h>
2 `0 T$ B4 K/ p! l" U - #include <asm/io.h>$ I0 k( L3 f0 ^6 Y J% W
- #include <linux/moduleparam.h> r+ o/ O+ r. k+ g, s# M4 @
- #include <linux/sysctl.h>2 X# O2 T4 @4 a7 D) T5 N& @
- #include <linux/mm.h>' X: u6 H t9 n0 g' ?
- #include <linux/dma-mapping.h>5 F# y9 {- h; h k, n! p l8 R
) [" q+ t; p8 |# g' o V: w" G- #include <mach/memory.h>2 ]/ C) S. ^; q, S; X0 k. P' g+ c
- #include <mach/hardware.h>& w1 {' x/ P1 M7 H8 a
- #include <mach/irqs.h>6 Y6 V; p& q+ @4 \5 @5 i* |0 P
- #include <asm/hardware/edma.h>
* x0 l' @6 |7 M - 0 ~% k$ C2 k7 {. H+ |0 E
- #undef EDMA3_DEBUG
/ H5 F$ z9 X6 N - /*#define EDMA3_DEBUG*/
: y6 p0 G' D6 v
1 q2 Y' ]. [. b' G& i, n- #ifdef EDMA3_DEBUG8 v7 @; _0 P: \7 }% w. ^9 T% P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), r7 G8 e: {& e/ q) b% I# b( j4 B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ M) v& l, A1 f9 u. y; Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' z* b6 D6 x, [# P7 i* S - #else# `9 p* D( O) x% d, q
- #define DMA_PRINTK( x... )
! x; |$ Q' u4 E. @: A - #define DMA_FN_IN' W1 R3 R) ?& Q! Y
- #define DMA_FN_OUT' x% N( L) Y- r$ R4 b1 W9 c% |
- #endif
9 a: L! f, L& F/ u$ |( F) B - 2 S- a/ M8 ~' C8 J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 x* k/ N2 [; b) p' o - #define STATIC_SHIFT 3
) u4 T. r G9 o0 G - #define TCINTEN_SHIFT 203 f5 G* C) _, |& y
- #define ITCINTEN_SHIFT 21
' v" P3 e t N* f% ] - #define TCCHEN_SHIFT 22* u# O! e; d5 ]
- #define ITCCHEN_SHIFT 23/ a! `, k+ W( W* h
$ n# \. B6 u% W E1 O- static volatile int irqraised1 = 0;# }; @1 Q) P- P5 `0 K7 L5 J
- static volatile int irqraised2 = 0;( M: ?& A* C# F) l5 i' ?9 j! y' W
- 0 O3 Y( c" ?9 L0 M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 B$ {. i" k, A* j! N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ I {- d7 J3 E9 \; ]/ _8 {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ m3 [1 s/ r; w. y. n2 ~! [7 X! w. _, D
: i. V( S2 b1 D* ?) {- dma_addr_t dmaphyssrc1 = 0;, T/ ^. Y. A6 A
- dma_addr_t dmaphyssrc2 = 0;
: P: w# O0 f: C2 D" x: o - dma_addr_t dmaphysdest1 = 0;9 @" l* {$ ~ g8 u$ @: r5 D
- dma_addr_t dmaphysdest2 = 0;
% A. c) k+ v# Y. ^0 `
: Z! i; `, i5 Y/ n- char *dmabufsrc1 = NULL;
5 [/ ^- L* W0 C5 G - char *dmabufsrc2 = NULL;
2 H4 G, u- X0 m1 F. x, w8 X8 ` Y - char *dmabufdest1 = NULL;
% g: X6 d: u, s( B6 g+ H - char *dmabufdest2 = NULL;
( w! S/ ^5 K: V9 G3 ~7 C9 a - , q( X+ C- i/ C$ ^* @2 [& v
- static int acnt = 512;- w0 J3 [: f3 k0 e$ o: Y% k
- static int bcnt = 8;
) d) q& [, G) |- u. |2 ~& z, u - static int ccnt = 8;; r3 D: m8 Q: \
- / c7 V& a3 q! ?# U; c& D
- module_param(acnt, int, S_IRUGO);
& x& Y; L( k9 I" `! f0 P( U; P) } - module_param(bcnt, int, S_IRUGO);
8 `0 {2 g- \) A: k+ A. u - module_param(ccnt, int, S_IRUGO);
复制代码 - u; Y. o9 Z: X3 W7 I: g
2 ]: J' z. n7 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ R: ~3 W" ~1 s& e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; C+ M7 q5 ^7 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 c: ^7 R I4 Z5 Y
5 b8 @) d1 P; n7 h* `& D; K3 S
& M1 H: V7 L, A6 `& }( L' C |
|