|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 t3 L0 \) e- Y0 ?" [7 T% s- [code]EDMA sample test application: A( w1 A2 T& c' I, o
- /*
7 | P C# C* P3 ^( F) s* k/ ~! \, J - * edma_test.c
5 K' r& N( R1 w( ~# _6 N* c1 s - *
! |8 ~3 S0 N1 n9 U8 P: w! g - * brief EDMA3 Test Application0 W, D# I4 N9 Q! T8 y
- *
$ ~9 Z9 W) _, v2 J/ O - * This file contains EDMA3 Test code.
+ b7 w+ q# o) E - *
6 o$ |8 s) ^8 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' R& b6 _: [: P6 o" `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 k0 Q& D/ Y/ D9 A. P0 t6 D* A
- * TO CHANGE.
1 C2 `- o1 n# g" p8 a: w - *
7 w* {2 g3 [2 q" f j( f' {# F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" V& G8 g& M1 ] @& p6 j
- *
0 e. r8 Q0 K1 u' w/ z3 e - * This program is free software; you can redistribute it and/or
% }+ J0 w8 R6 m( y3 m - * modify it under the terms of the GNU General Public License as
7 |4 |1 h! {2 b7 l( G6 A2 A - * published by the Free Software Foundation version 2.0 E9 P: h9 k- V& F( Y
- *
' O! Y: v% L" n+ c" Z8 M9 P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 z/ I; p/ g7 C' | - * kind, whether express or implied; without even the implied warranty
! U0 d, w2 M B: V$ {1 a0 I: r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. H' x" E6 `% d8 E
- * GNU General Public License for more details.
9 u9 M: e. t' Z' G* K; K - */% T: k2 K; j/ b3 A( y
# a X8 b% F. V; c5 k9 G- #include <linux/module.h>- U) e$ Q' d( g5 ~) p
- #include <linux/init.h>
- D1 E% R" k% N% ] i1 w - #include <linux/errno.h>
d8 x# V" E, F/ t/ K5 m - #include <linux/types.h>5 G+ q- M8 x3 d6 L4 o# _! `6 M6 |
- #include <linux/interrupt.h>0 j, k5 B# R" c8 S' t
- #include <asm/io.h>; s& Y# s+ M P' F i& R7 x2 j
- #include <linux/moduleparam.h>
% M5 t$ M: O6 \/ c4 a - #include <linux/sysctl.h>
1 b' }1 i- b9 N% {9 ?7 G - #include <linux/mm.h>2 ?* w* h7 X, n
- #include <linux/dma-mapping.h>! N2 B5 w) `4 g% \! p& `
- / J% o$ Q* Z7 p0 Z' c( B2 m' U w
- #include <mach/memory.h>5 \: Q+ B3 z, j7 @; Y
- #include <mach/hardware.h>
+ a2 y" D* Q! u+ s. h3 [$ \ - #include <mach/irqs.h>8 a6 R+ A' e( d
- #include <asm/hardware/edma.h>
; S0 X4 ?/ `+ R6 o' N+ n
) `7 s& W* A+ k. V) Y4 b) E8 W, S! y# C- #undef EDMA3_DEBUG2 t# h% v$ r; x/ f2 l7 C* l$ n
- /*#define EDMA3_DEBUG*/2 E; a5 p8 ~, ~$ u3 w
& z" {, F3 @4 d5 @4 c3 x1 O- #ifdef EDMA3_DEBUG+ r1 p" w5 d* ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; w- F' K9 P2 m( L8 Y8 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- K& w4 \+ Z* ?1 x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ _; b8 C: G3 {& L - #else
; `' `0 E, d" _' ~ - #define DMA_PRINTK( x... )
, j) G/ O0 J/ w4 ?0 }9 z - #define DMA_FN_IN0 c7 {4 X+ m. a* Q& h& I
- #define DMA_FN_OUT& V& Y$ U3 L% ?
- #endif
6 N8 J! u( e1 h8 w9 }
: K2 [" s% j) b* `5 G3 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- i4 F0 Q! \- ^' A( B: y2 g' v+ e9 O
- #define STATIC_SHIFT 3" R; w- v+ ], a5 d
- #define TCINTEN_SHIFT 203 \) y) s8 f/ {" Z7 m
- #define ITCINTEN_SHIFT 21
7 t6 f2 L9 _0 [5 G; x! C" l/ G; ? - #define TCCHEN_SHIFT 22 P% q# p6 u7 G+ _
- #define ITCCHEN_SHIFT 23* w+ [$ @) C5 Y0 d& @4 ^
- 1 `# s1 }' h) B W V
- static volatile int irqraised1 = 0;5 J/ q6 Y2 u6 I! A) M# {6 U
- static volatile int irqraised2 = 0;
" ^' Q# d- N) R! e. T9 {
+ }; u( | n4 L% z+ S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* b9 o1 J8 Z% b2 A4 G, G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ^0 }; b. B0 L6 y) k( w' O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ O, g, B) x" C' K7 ]& {
6 V: K0 U/ q, O/ M2 J- dma_addr_t dmaphyssrc1 = 0;" `4 F9 {5 {& I- W
- dma_addr_t dmaphyssrc2 = 0; t/ @$ F8 e! y
- dma_addr_t dmaphysdest1 = 0;
8 J0 }6 R" J6 V( r: X# X# ~ - dma_addr_t dmaphysdest2 = 0;
4 x! D/ r( I! m* g5 A; R
4 t Q( B+ G1 _/ x' `- char *dmabufsrc1 = NULL;
7 r7 p/ ~+ k: G - char *dmabufsrc2 = NULL;
+ H% |3 E7 J3 T/ G# o - char *dmabufdest1 = NULL;, k/ B8 Z ^2 u1 h
- char *dmabufdest2 = NULL;, ?8 ? Z: Q1 F/ T- I. M
6 N' U, X, r* Z! [7 S- static int acnt = 512;5 k# e+ w+ [7 \- C+ z# v2 N ^1 Q
- static int bcnt = 8;
0 p9 [9 x) v1 ~9 [1 c" J' C1 [ - static int ccnt = 8;
$ t* y! }! U3 z- H, C/ q - 2 ^! _: [5 j: Y( [
- module_param(acnt, int, S_IRUGO);
1 I" k8 P$ U+ J! ]& I. f - module_param(bcnt, int, S_IRUGO);" P* _9 T# l+ X! ~$ ~, \3 }
- module_param(ccnt, int, S_IRUGO);
复制代码
& B- D5 W' _3 C* V6 J& k* n) O% L& X+ W# W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' o7 G4 L5 ^1 j! W- f5 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
J( \0 D4 H$ S. b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) Z5 g4 |" l/ v& O g9 T1 J) N
, U! p! S3 n: Y- u# r( [, ~( t2 |# s8 ^1 d' }( q
|
|