|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ R4 D! m/ h; c3 t% k0 [$ [# ]
- [code]EDMA sample test application
$ ~% q( p3 g( Z+ m C/ X6 k, u - /*
. K# X5 ^# z% Y; g$ C4 ] - * edma_test.c# E% }1 W1 w" ^* O! v% X
- *
" Y# k0 ?1 l7 P4 _( K( i - * brief EDMA3 Test Application( v5 Q5 F0 A0 ] l4 u7 Q
- *2 t- y7 x1 ?0 M* d
- * This file contains EDMA3 Test code.$ a8 f9 Z# Y5 ^' E1 Q
- *2 N; t2 {: P* ]: ~2 r; a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ m, w {3 j& V9 ]" s4 I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 z" R0 L$ `, w2 E - * TO CHANGE.! [% b- S2 u% k0 A! k. S9 E2 w
- * W# e: L5 ?# ^' x4 N$ L' L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 H3 X( h3 k3 ] - *6 i5 M5 r5 e& ^, H+ u& n
- * This program is free software; you can redistribute it and/or
7 ?) R; i0 x, `" N! y - * modify it under the terms of the GNU General Public License as. @8 p$ r( V9 X* }
- * published by the Free Software Foundation version 2.* T: S0 H/ f2 |0 ]) A4 e" k
- *
7 \ f1 ^) Z2 c+ }2 u+ C8 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* }+ y+ A `, X; l( D2 ] - * kind, whether express or implied; without even the implied warranty$ {6 H; u. e' S5 r5 X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 I* ]1 s- j/ H7 y
- * GNU General Public License for more details.
7 d: b- v- K0 N0 M. L - */
+ [ m# P7 i4 ~! z& X. v+ Y% e; R - % g: l1 ^: Z! m+ }$ A5 S
- #include <linux/module.h>
. T8 h1 U0 Q# n& \' J - #include <linux/init.h>
3 A4 A9 G4 Y. X( I2 g& j - #include <linux/errno.h>! X& r8 @$ z2 ^3 h! h
- #include <linux/types.h>; s; r6 x8 c, ^& M
- #include <linux/interrupt.h>
) U7 |! w P( A; `8 A6 X- q - #include <asm/io.h>
; Y' \* V7 ]: i0 v, D$ a% a: | - #include <linux/moduleparam.h>4 D0 e" y9 C; G2 B3 ?% w
- #include <linux/sysctl.h>4 u4 u# @% T& N
- #include <linux/mm.h>
- R2 R' e% ^4 Z - #include <linux/dma-mapping.h>
+ I1 C# f k, p6 q) t7 @) d
5 e7 t& N5 s6 B' p% C7 o S- #include <mach/memory.h>
' p! |& l, Y2 ^ - #include <mach/hardware.h>
" c+ f* G1 R8 G% J0 Z4 N6 C! @% I - #include <mach/irqs.h>6 i2 I% v; ?7 R v1 x
- #include <asm/hardware/edma.h>) b$ X1 W; m& n5 b) m8 y$ H+ i
- % c+ H4 K3 z% R+ h; N9 R
- #undef EDMA3_DEBUG% B2 r g, n5 m! ~8 U$ A
- /*#define EDMA3_DEBUG*/" f2 @3 F1 w% Z+ o' g8 E/ |
- ) ?& z2 E" h+ n" q) a+ p# P
- #ifdef EDMA3_DEBUG
- p4 h# q7 i4 f+ B' A5 a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 [- S5 i" o$ n g8 I5 `- q, q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ ^, U1 w$ l$ }$ ?- [6 _7 o1 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 u7 l/ r, K: S2 y; W - #else" h& ^" j! A9 ]: f' F
- #define DMA_PRINTK( x... )
- ?4 y# m7 y0 ?+ X2 F1 q - #define DMA_FN_IN
7 T; ?. H( d# ^7 c# S9 B' k! X - #define DMA_FN_OUT
. k! u2 L/ p0 d' u+ _ - #endif
+ z" A. X: H5 b( ~ - & n$ E" O4 l4 {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 Z& S) a5 g! U$ S- a - #define STATIC_SHIFT 3# V$ X/ Y6 D. t; M* x; U
- #define TCINTEN_SHIFT 20
. w$ Q+ Q$ O; V- }# d/ e - #define ITCINTEN_SHIFT 215 m! g+ a+ o7 t
- #define TCCHEN_SHIFT 22
$ t2 h5 m8 S8 k5 c& j - #define ITCCHEN_SHIFT 23/ C+ ?7 q+ q1 V* V. y
: \- x- y0 ~2 f2 ]8 I- static volatile int irqraised1 = 0;
( M' v D! l& D, j - static volatile int irqraised2 = 0;
7 m% C; ?6 H# |# i. W& N. w! A - 4 j1 l3 ?2 o% ?7 F+ C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ]; L/ Q- U5 u+ {6 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. b4 [+ P& v6 t4 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Y7 H: O+ d4 T1 g8 K# ~9 j
0 S2 x2 x. L5 ?6 `% v, j- dma_addr_t dmaphyssrc1 = 0;
. z, E3 \5 Y, u' [ - dma_addr_t dmaphyssrc2 = 0;
$ w H/ R" |- W% J: [/ v - dma_addr_t dmaphysdest1 = 0;7 [1 S/ M3 A) Q1 W
- dma_addr_t dmaphysdest2 = 0;
" H; p2 _( `3 l3 H) A1 |4 L3 u - / w6 D4 I7 S0 M) F
- char *dmabufsrc1 = NULL;
% ^% {: _' Z" ?. h0 \. A5 m0 O - char *dmabufsrc2 = NULL;3 [: S7 H" Q5 ?* Z* t
- char *dmabufdest1 = NULL;
# E t9 I' i" X0 c6 a - char *dmabufdest2 = NULL;1 D$ o$ Q7 b- ^; t" c
- " U! J% p0 R; P4 f: g
- static int acnt = 512;; q* {% K# F9 K& c0 E
- static int bcnt = 8;3 u" Y3 e; v8 v. O! ]; s
- static int ccnt = 8;. e; g. i: @* _
- % c7 z. t; W; Y9 x
- module_param(acnt, int, S_IRUGO);% [ O. D' m1 J+ c$ x c+ Z
- module_param(bcnt, int, S_IRUGO);2 H6 E- z' b" y9 K
- module_param(ccnt, int, S_IRUGO);
复制代码 ) z7 T; B8 K* y, [5 W, V
4 J, R9 U r+ W: F9 f6 \4 e$ L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 q) E7 w5 i4 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, ?5 p7 }! X+ q! v0 o3 C7 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. g K {6 C' d9 l- i
& P- H8 N5 n0 Y* ]0 {$ S; @$ G$ G' \* K4 e m. _1 V
|
|