|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 q; ^0 F1 z/ B/ P4 Y- [code]EDMA sample test application1 m% e8 L( a+ f' H) i
- /*
5 \: ]2 G2 ^, }- } - * edma_test.c& N' }7 J& q! q. _- T
- *0 q/ c) o5 ^) r. I
- * brief EDMA3 Test Application
6 E9 x! b* O% e9 E - *
; d5 N- c+ z" |0 j* [' @/ y5 _ - * This file contains EDMA3 Test code.
# }& m( v9 |/ m' G* U0 o1 _) P9 i9 l - *
, k- B, j+ l i' O; R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; n* f5 c% A, K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. B5 k9 d7 c3 W7 ^) ~ - * TO CHANGE.
4 X4 @% @/ Z/ d6 p- d - *
# P7 B+ Z$ u7 i0 X) g" H/ N" j& r8 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
u% A- P" s5 u: E' _# M - *
- }! ^3 x, I# Q8 w+ l5 j8 T - * This program is free software; you can redistribute it and/or
0 ~! m- X* }: I" j - * modify it under the terms of the GNU General Public License as
- I0 b. k$ A6 @ - * published by the Free Software Foundation version 2.7 r7 t5 m! h" M' W7 @
- *
+ v8 C# E) b) H- \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* D# Y) q9 w5 `0 J' T+ L6 p
- * kind, whether express or implied; without even the implied warranty
& u( k" F0 n% Z9 \( J6 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 c- |# S$ j/ v8 g5 ]2 b, g - * GNU General Public License for more details.. w) H4 d+ x* K, y' o r! p
- */
3 j" F( _$ e- N2 e
1 \+ f' u/ ^: w" v; l- #include <linux/module.h>
! H9 ]; [- |/ U - #include <linux/init.h>9 j7 z3 M& C2 |
- #include <linux/errno.h>
; q. i* N. u' d, s% r% r; w/ V - #include <linux/types.h>; t5 @! D# Z6 f/ S- e# q
- #include <linux/interrupt.h>1 b; d% p9 h# d! ]
- #include <asm/io.h>, c# @) }+ `) j5 x' _
- #include <linux/moduleparam.h>
5 ?5 B" x: u/ ~( J - #include <linux/sysctl.h>4 @: k* y2 D8 y
- #include <linux/mm.h>% E9 N4 W% G: u I& Z
- #include <linux/dma-mapping.h>
' f0 D6 p# Y9 H/ B1 S E* h, k - 6 C. @: @7 H6 D4 L
- #include <mach/memory.h>
7 ~7 u4 o6 J v4 \# G" y. b - #include <mach/hardware.h>
" @, _0 Q7 T. b+ \1 f7 L: C - #include <mach/irqs.h>
! |, c5 R) U' w" z0 m. K - #include <asm/hardware/edma.h>2 P. z# F9 u0 Z9 G ?1 o
. ^& x, I0 v$ o$ j0 y% \: Z+ W- #undef EDMA3_DEBUG4 e0 v! f$ [. ?( l! z
- /*#define EDMA3_DEBUG*/
" ]- z7 Z, I3 b6 E7 U
* J+ F! _8 Y9 e) s3 {4 {9 P- #ifdef EDMA3_DEBUG
6 H8 ]- c( b8 h' k' d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ f: t9 H* a$ }5 }2 M7 A, O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. k* `) A( @; o6 f. w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; E. n) T- C/ U8 E" b3 Z - #else* ~& d, r7 s, n- p% _; T* o
- #define DMA_PRINTK( x... )
5 i# s) ? u8 x- U - #define DMA_FN_IN
% J7 B3 \8 c8 A( ~! u; S, r - #define DMA_FN_OUT6 b4 p& y! u% P6 B, J
- #endif) n5 c, e1 L% A3 Q) F+ ]4 x$ m
- + B% X' m9 P* y: g' p$ P9 H$ t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ J/ O X; a. L) b, a
- #define STATIC_SHIFT 3
2 }/ X& [2 u: n( Y0 K - #define TCINTEN_SHIFT 20
1 W2 A+ ^# g, P+ j8 _$ R7 j3 \ - #define ITCINTEN_SHIFT 21
9 @2 q; q9 F( } - #define TCCHEN_SHIFT 22" N" [, W0 ^! @6 ^
- #define ITCCHEN_SHIFT 23
. U7 w% I3 t$ z6 ~! J3 o - ( a7 p o5 s5 ]7 T6 U5 l
- static volatile int irqraised1 = 0;9 m( z& c0 l) e9 h( h
- static volatile int irqraised2 = 0;
3 L# I4 ^- r9 ]- X - + o: g/ ^4 a/ i$ r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, d k" g' a3 I8 e" L7 C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s( l1 W( b* z, Y! @, @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ~9 [- v6 ?6 ], y7 f& F - + @' b& ~% P* [4 w6 i( [" m" M+ Z* h
- dma_addr_t dmaphyssrc1 = 0;
& X& P/ A9 D9 h2 O4 c - dma_addr_t dmaphyssrc2 = 0;; |- J5 q* t* x' V, B6 j
- dma_addr_t dmaphysdest1 = 0;) }) N0 t4 G+ X6 S! T
- dma_addr_t dmaphysdest2 = 0;6 d0 r. f& l7 z
) H2 W: a5 t+ \+ M, N, u- char *dmabufsrc1 = NULL;
$ d6 k: ]% D7 i+ ]7 _/ r5 Z3 P - char *dmabufsrc2 = NULL;. R2 R- l" J$ J5 A
- char *dmabufdest1 = NULL;! D M5 n6 D7 S5 V9 y. l) N
- char *dmabufdest2 = NULL;
" O! y; l' S' m8 ^
( y V9 `& |3 t- static int acnt = 512;: F9 i _5 K( _3 V4 r/ B. B
- static int bcnt = 8;5 \* F- h. d' V! L* _ ?" ~
- static int ccnt = 8;
# y# h4 U$ @- S - 4 l' q/ b. h7 K. Z6 |8 T9 F
- module_param(acnt, int, S_IRUGO);+ H, S$ }5 p2 e. }( L
- module_param(bcnt, int, S_IRUGO);; r6 P. b8 M V0 i4 K" ?/ ^% m. r/ f1 P e
- module_param(ccnt, int, S_IRUGO);
复制代码
/ V3 q7 m. P1 w' O7 |
7 c/ g; R! k1 f6 W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, g- {2 ]* X" y- m! m2 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ k' I3 h7 R6 A3 _- e$ o5 r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( B7 l. O `( O( c( n
8 B+ J) q8 f H8 M- o& W7 i0 |6 I* t4 N/ L, q( J6 w& z
|
|