|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * w/ J* H* }" M$ J1 t
- [code]EDMA sample test application
7 E1 A$ G) @" J; Y6 h3 D - /*
) D# u, Z$ w4 z" ]5 q* _/ b9 h4 } - * edma_test.c1 B: s' }: G4 `
- *
! D0 u2 t4 h# J( ? - * brief EDMA3 Test Application+ f \/ m8 s0 _6 g+ Z: B, u
- *
) v ^ [. f, A8 }3 D# u - * This file contains EDMA3 Test code.7 P% h3 |1 @5 p3 I
- * C* P. i) e: s3 u. x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# q4 ^2 y* l- ^$ `8 M6 H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 ~% J) z; p/ j( ]* L% T: ~
- * TO CHANGE.
: N' G' q' @6 y' `" _" H/ M8 x - *
! s, X$ S1 J$ G( _9 ^! [% d- a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 R3 c b5 [: d+ r - *' V; B/ P! {: P- Y+ g9 y
- * This program is free software; you can redistribute it and/or
* |' G. U, ]4 K2 H/ \ - * modify it under the terms of the GNU General Public License as! g8 [6 m* s: u7 j
- * published by the Free Software Foundation version 2.
/ K6 ]0 h P5 m- _! u# T+ X# e - *4 z8 K# s! m: v& K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- u- o. m1 Q, C" h2 X - * kind, whether express or implied; without even the implied warranty6 z0 p, y D+ ~1 W8 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# b) r( X# L; A6 R' i1 u7 K; _
- * GNU General Public License for more details.; S Z& u) J7 o7 R7 W
- */
( a' r$ q- |" ^* O# t
H s5 y/ o; C0 ~- #include <linux/module.h>2 ]; w/ L4 a) _* F& x; b, \4 N' o9 E
- #include <linux/init.h>
" |6 X. f$ X$ G9 w$ W; b) E7 Q - #include <linux/errno.h>" Q% F) m0 @9 O) i7 I
- #include <linux/types.h>
8 c+ m \6 e6 |$ m: A9 }6 d - #include <linux/interrupt.h>; u8 [9 Y* T( D) d6 i6 C
- #include <asm/io.h>
4 f/ A( ^& ]! Y; W5 \ - #include <linux/moduleparam.h>
+ H1 |0 S0 U! A( E' n8 j% E - #include <linux/sysctl.h>
0 X/ o3 E6 i/ e# q- K8 i - #include <linux/mm.h>" ]% T% {6 g- g5 O: u
- #include <linux/dma-mapping.h>
8 @4 m( P" }2 R8 c) K
2 W6 s4 p3 f* p. q: s- #include <mach/memory.h>- l! M B# j8 t7 a
- #include <mach/hardware.h>& H- U3 |0 ]$ u) |: w
- #include <mach/irqs.h>
) i; `, n& M' x - #include <asm/hardware/edma.h>6 ?7 G7 ]1 u$ V6 E% H5 M3 R5 y
0 v8 J( l9 I+ P! a' a& d; u3 C: N- #undef EDMA3_DEBUG
9 W) T/ u9 P7 m' O4 F - /*#define EDMA3_DEBUG*/
& G. \6 [! A1 J8 ^2 x: B
& c6 d8 `2 d8 h& i+ F( u; |- #ifdef EDMA3_DEBUG
" {. e; F; {5 s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). x8 w' V* O3 }: k. i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" N* V9 v& n4 j' E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' @! Z# t( K' \: o6 x5 T( C! b5 w1 ^ - #else5 i X; O+ B0 f- A; i
- #define DMA_PRINTK( x... )
' P, z4 a8 Y: E5 O( I8 W' }7 c: C. ]' z5 P - #define DMA_FN_IN
8 R( ^/ o# h# y, y- S. w - #define DMA_FN_OUT' Z8 j" e- | [/ B. _0 Z
- #endif
6 Z3 }, I: u" I" ^# ]
3 A9 |$ o3 z( {8 Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768); B7 u& v b1 ] d, ?1 D
- #define STATIC_SHIFT 3
7 W- t* g+ n$ V$ P8 w - #define TCINTEN_SHIFT 202 B. _; T. m; y! l
- #define ITCINTEN_SHIFT 21" A& t6 n/ k- b3 O# R
- #define TCCHEN_SHIFT 22
P9 i) U, j" O5 \6 P) P - #define ITCCHEN_SHIFT 231 R& S/ A+ s) g% T# `5 j
( ^9 l" I' F$ \; H$ z- b1 ]9 h- static volatile int irqraised1 = 0;
6 Y/ E5 B, z$ Y4 m7 U( N - static volatile int irqraised2 = 0;& p; S/ H, ^ n9 A5 p7 Z
- 9 a0 s" a( \" }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G& M7 G4 j6 d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( t" o9 U @! Q( T7 E/ b$ D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' [) _ U1 F; B2 o( @5 g
2 |. T8 r* e! r9 N- dma_addr_t dmaphyssrc1 = 0;
) _. W" g' c r5 j - dma_addr_t dmaphyssrc2 = 0;* k1 G& u7 n7 n$ i. s4 D( I e' g
- dma_addr_t dmaphysdest1 = 0;
, W1 C- b& r- d9 C: u - dma_addr_t dmaphysdest2 = 0;
/ y- c# n$ t5 p1 c4 L" V* [
. z$ @" Q. v/ _; @- char *dmabufsrc1 = NULL;
5 E# m7 |* w2 R) c - char *dmabufsrc2 = NULL;
. O; Y8 {: e( [% G - char *dmabufdest1 = NULL;3 y' [+ @( Z7 J# k) U% u' I7 {
- char *dmabufdest2 = NULL;! B" k* l* ]1 v
- ( S2 P1 w! D: f& r' \! r$ w2 c
- static int acnt = 512;
: a) ]3 F# I6 _9 @) Q X - static int bcnt = 8;6 B$ ]. D9 v3 v; D' s( O% n- l' L
- static int ccnt = 8;; }0 P: V1 y6 l ]
) W5 V# V" ?) ^( C) r/ h- module_param(acnt, int, S_IRUGO);
% ?+ B1 H$ p1 Y5 t( P) f - module_param(bcnt, int, S_IRUGO);
: \' g/ E/ C7 p$ P$ s) k, a+ o: U$ |! y - module_param(ccnt, int, S_IRUGO);
复制代码 % b s, U) r7 b3 O# w
6 v# i; ^9 {4 w, {) J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 F# F; {7 i. A: t! B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: l3 B+ p4 ~5 `( p1 f# y. r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" }$ k# T/ c w( M8 Q# p' }' E% B$ G7 x; T. \
+ g& `* L/ n1 J9 I6 F8 W3 S4 j4 L# J
|
|