|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 J- V- B# N- d, |* q) p
- [code]EDMA sample test application/ ]. y& ]5 x2 L8 x( K
- /*
! i1 ?4 N# A3 P - * edma_test.c: I" _1 j% P( L: z2 d
- *
) ^( k& i5 b$ R) }( {3 s0 m3 O - * brief EDMA3 Test Application5 _* L" r; f# R( L \
- *0 T- n& d& x Q2 }' }1 L, `# P
- * This file contains EDMA3 Test code." _8 `# ?& ?" x- {! \3 y
- *
1 h! Y/ p, R! J3 k( T6 ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! p' @' S! b8 Z, X) c: q8 S) } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* m) W9 y) E" F
- * TO CHANGE.
) S/ g% f, c- u4 [4 X - *
! ]; L4 ` q$ J3 q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 u( ~4 Y* e% e; E8 D2 D - *
7 S* E2 d7 F2 r) y1 L5 S( s# B; _, ` - * This program is free software; you can redistribute it and/or8 T0 W3 l9 I$ @& i }! r: ^
- * modify it under the terms of the GNU General Public License as
9 p$ ^% k% o2 \. }8 K" D) ? - * published by the Free Software Foundation version 2.
) ~0 p1 j' i( A% `1 u8 k4 F - *! \5 k9 o) v* \2 P e4 e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' l/ i& l2 L5 z X
- * kind, whether express or implied; without even the implied warranty% G; _) ?/ b1 c! R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ n: s6 o# r' q" P - * GNU General Public License for more details.+ `0 U1 i9 ^% q+ i6 T" R+ E
- */
& A( R' u; w0 m0 e; f - 6 n5 j' g' E& v' C9 K# k- y
- #include <linux/module.h>
; {. V v0 Q! W3 l. o: q$ D - #include <linux/init.h>
$ T4 ?( h+ |" }. ]2 n. U9 D4 \ - #include <linux/errno.h>
- q* o# K0 P- J% ^- B, y - #include <linux/types.h>( ?: W. G/ y7 T: k' D6 [- l# ^7 j5 D
- #include <linux/interrupt.h>
6 Z- g6 u3 G: j; C0 a! E - #include <asm/io.h>
! v, q" }7 a0 v - #include <linux/moduleparam.h>% ^$ B" B% v0 c/ |; ^9 G- @
- #include <linux/sysctl.h>
6 Y& ?0 W. u# b/ S6 C+ ~" }, l - #include <linux/mm.h>7 b6 n; ^7 a' j: e ^4 v7 H' x
- #include <linux/dma-mapping.h>
& c& J# n- Q) Z; _4 Q K - : b5 ~7 \; C) P d) v1 P
- #include <mach/memory.h>/ J8 R; G, W/ [; C; w# z0 Q x
- #include <mach/hardware.h>+ {% h! h( u4 w
- #include <mach/irqs.h>
3 n4 U2 F0 Y4 T8 }5 D& p; l - #include <asm/hardware/edma.h>
0 c* _! P' [/ d [$ s1 f; g - ( A* x* F' u) S6 ?. z
- #undef EDMA3_DEBUG+ P: i, @2 v3 ^8 ^: D
- /*#define EDMA3_DEBUG*/2 l8 S) {" n- Y; s, i, x* r. K9 _
7 Q1 v6 p# m4 X2 b, A, c- #ifdef EDMA3_DEBUG) c E) }4 [( n0 [% z# k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 n% T# i! Y) W3 Y8 R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! C1 n5 B1 q6 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# R+ I9 K8 _9 D( ^4 p/ z8 U5 h - #else
; `. M6 @% l, H( H/ L! O0 i - #define DMA_PRINTK( x... )
4 U* B- v$ N. |$ x$ l! n - #define DMA_FN_IN8 _$ t, \. n0 J) I
- #define DMA_FN_OUT
8 L2 _! W/ u6 ~$ } - #endif4 o- u# W' b. |4 ~
- ) ?5 h# P" C3 U3 J) b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& ]) b( D' v5 `. o
- #define STATIC_SHIFT 3
O' H: J" ?5 v3 c+ [ - #define TCINTEN_SHIFT 20& U' U" J6 l: X% j& g+ P+ o
- #define ITCINTEN_SHIFT 21# p4 i7 W1 |0 v5 U" E
- #define TCCHEN_SHIFT 225 o5 A4 h, B8 [, _% Q
- #define ITCCHEN_SHIFT 23
' j% _* p; |2 Y8 W' Y
b$ y) a# G/ t4 \6 `& a- static volatile int irqraised1 = 0;
0 A, _. q; Y" @/ N2 A' L. N- ]& \3 h; U0 u - static volatile int irqraised2 = 0;
7 B7 C/ E: g+ q/ q3 ~) a/ S( R0 G+ y - 6 e5 v% O I8 i- X' M% d7 @8 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 S) j+ x4 x2 c, P: }& }' d4 D8 t# K/ K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) t: x, X0 s# B' f3 d l! S: V: H. b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 o I8 E1 t$ D
% L2 s0 ^2 y0 b0 m* E- dma_addr_t dmaphyssrc1 = 0;
T: l( x b- X3 A - dma_addr_t dmaphyssrc2 = 0;1 c. _ _0 c9 Z1 a0 t6 R/ q# @
- dma_addr_t dmaphysdest1 = 0;
) \' j, x/ F( {# X' c3 H7 T* V - dma_addr_t dmaphysdest2 = 0;
% G, K% U5 X: f3 u* {0 [% A1 G- E - - P; d& z9 `; g' d, D$ Q& c! j
- char *dmabufsrc1 = NULL;+ @/ q5 o; |- M7 t( ^
- char *dmabufsrc2 = NULL;5 y% u v9 T' B" h1 U
- char *dmabufdest1 = NULL;! t" S, k! |$ d% i& U
- char *dmabufdest2 = NULL;; O& S; m; d: O: i0 y1 c
( u d# l2 ^) b8 n- static int acnt = 512;
4 R* O/ t# X5 i. C) M - static int bcnt = 8;+ @) D/ {" l2 x% n1 W) D! [2 d6 v
- static int ccnt = 8;. ?' ?7 ` X( K# ^4 [
$ e8 z. A! P4 L9 [- module_param(acnt, int, S_IRUGO);
) }) P5 E. y8 _4 m' [ `. ?8 t- R - module_param(bcnt, int, S_IRUGO);3 x2 W I1 t* a) a6 G b
- module_param(ccnt, int, S_IRUGO);
复制代码
& b; F# K; j, a8 ^/ j; j& E' Q+ E3 {5 R( H4 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. V) s! s1 ]! ~& n6 |: D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' M. g, X* z4 }: E- C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 g) Y# b6 _, j/ L( ~
- d- G) \0 U$ E/ j4 J
, v! n+ X% t( r }/ t$ T. m |
|