|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - N' S4 e/ o5 D8 n3 `) i ^
- [code]EDMA sample test application
. ?. {5 z( ?7 s% n* ` - /*
3 Y3 b9 X4 b+ ]( `- E3 L: f - * edma_test.c8 ]) n3 x+ \( p# A) ?: B( c
- *
) U4 q% G1 j( Q b- [2 @) u% I - * brief EDMA3 Test Application2 _( n5 L6 G7 I5 }8 |
- *5 V* I1 p% N% s+ }6 w
- * This file contains EDMA3 Test code.
2 l- o1 E) S. V2 \" ~ - *: ?% B- G0 m" z* x1 D( J) y2 e. f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 H% q" Q6 o# K8 ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% Z: _5 I( Z& s) a6 y! i* g& ^+ K$ b
- * TO CHANGE.
! S* f( P/ {" F1 U - *& [4 J; V3 S9 m1 F+ [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ~. y: V7 m; N* @
- *
8 c E# m+ M9 H- Z% m! l - * This program is free software; you can redistribute it and/or
2 u& f1 d9 i0 E1 H5 i! h - * modify it under the terms of the GNU General Public License as# v0 K9 r9 b! L& q0 J6 p
- * published by the Free Software Foundation version 2.( z! ^8 v5 \3 v0 y2 Q% ?' Z
- *
/ J- V3 }0 n0 Z" d* n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( P% m# ~4 s. `7 G: m - * kind, whether express or implied; without even the implied warranty5 X' Q& D, U' }0 ^! ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ A8 K: ^. w( a2 g: Q, `2 ?
- * GNU General Public License for more details.
$ m" S* s: r; d, B - */
' _, ~% y" }! \3 ]* {. G0 D: p, n - # Q0 t8 ?6 n; C, L
- #include <linux/module.h>" ?# T; o5 I/ j# Q, y
- #include <linux/init.h>* Z# g8 w! }& W" Q& S
- #include <linux/errno.h>6 p! l& @ N: d7 N
- #include <linux/types.h>) E: a; P+ ]; V" R& a, c. S
- #include <linux/interrupt.h>
2 o! Y. d$ u6 g+ @# Q; L0 D - #include <asm/io.h>
/ g5 I% `) ^9 C - #include <linux/moduleparam.h>
- e' r( X: f4 Y+ W E; ~0 [ - #include <linux/sysctl.h>/ K/ r" l1 V# v0 r; K" P" |
- #include <linux/mm.h>3 V7 M1 M( ?# h' R) w1 }5 e: _
- #include <linux/dma-mapping.h># H& f4 m4 n" q/ J
/ U5 x! h; L$ E$ L1 K* S- #include <mach/memory.h>
( H" r& I# r# R% o+ e$ S - #include <mach/hardware.h>' `( W& A% x A5 a( [
- #include <mach/irqs.h>
# n5 ^% ?( |- W1 T% C - #include <asm/hardware/edma.h>
# p) V) ?6 U7 E! O9 w' @$ Y7 E
. \/ g5 h8 N" H: Q- #undef EDMA3_DEBUG) v5 z; C% K) R ?1 h
- /*#define EDMA3_DEBUG*/, `5 u( Z% l, T% O0 B W1 C
- % J K% n$ f3 P$ e0 c0 |
- #ifdef EDMA3_DEBUG
) D: G* T6 |- l! s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): ?# o& D% v# D4 |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# m5 E. Q( n0 f. i; F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* X# s1 t& o ~( q - #else
' {, c0 S& _. H1 U! G% p - #define DMA_PRINTK( x... ) S$ M. R/ C9 }; Y1 }) v& Z8 f
- #define DMA_FN_IN
w! B! s7 ~! y4 _6 X0 r - #define DMA_FN_OUT+ \1 u$ q! C4 {6 |, G
- #endif
2 C/ J6 `1 y1 B' _
$ U, \4 c5 d# z5 b2 y6 I7 R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ d/ s6 A% j0 T
- #define STATIC_SHIFT 3
3 I2 `. m0 D0 M$ G E7 S, d# J - #define TCINTEN_SHIFT 205 M" n7 `) f1 R8 k" K! R: D
- #define ITCINTEN_SHIFT 21) w" u- w- Q' g. J
- #define TCCHEN_SHIFT 22
3 `0 t+ z% C& b - #define ITCCHEN_SHIFT 23, \; x; O* e; B* T
- 6 n# h! ^% B+ m* `3 i% \1 ?
- static volatile int irqraised1 = 0;+ T; @& J) T$ ?% ]. g7 V& {+ C
- static volatile int irqraised2 = 0;
; A( @: l6 p2 P; x; t; u - ( w: ?5 P+ t4 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# H4 q: Q9 h, T5 L' U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 L4 T: b |2 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Z2 _. b+ J9 r/ `
9 e& e, c+ u/ ^+ p Z- dma_addr_t dmaphyssrc1 = 0;* e( p/ j( B, Y* s1 r! ?! Z. \: Q
- dma_addr_t dmaphyssrc2 = 0;
; e' `( w1 I V8 r6 W! u - dma_addr_t dmaphysdest1 = 0;; D. I( W; o3 _
- dma_addr_t dmaphysdest2 = 0;
3 J# p8 G d/ G+ Z8 m( v7 K) Y
' B- A. ^- d4 v% `- char *dmabufsrc1 = NULL;
+ T/ g$ [) L! i% H - char *dmabufsrc2 = NULL;4 y5 j$ X& L% b0 M6 [2 h4 n8 i
- char *dmabufdest1 = NULL;
. ~+ D. D2 p W1 x( k - char *dmabufdest2 = NULL;
3 @/ ?' T9 }9 G( c3 P; X6 H - 7 F- d" k' B8 v) C) f$ Z; r' B7 A1 v8 s
- static int acnt = 512;
2 z+ _$ D0 o1 s1 _0 n - static int bcnt = 8;
1 v2 \; h, U7 l5 S - static int ccnt = 8;9 i$ |' E- w8 \$ M4 D, [
- 3 E' ?2 c/ ^* T- K7 X6 W4 F9 U
- module_param(acnt, int, S_IRUGO);5 ?$ q# V- C @; s" _
- module_param(bcnt, int, S_IRUGO);) I, y: }9 X! I8 R( {7 N1 {2 B6 R
- module_param(ccnt, int, S_IRUGO);
复制代码
* \1 }7 Z/ ^, `2 N/ ?6 r3 c, r3 }. S: c) {$ q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 B- s: U& g' o0 w" q* h; m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ @. R" ]) n. O& U8 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% J* n( I: F9 y! c
9 g( P& D/ R4 R$ P" B; c: r
( ?( [3 d0 X( S' \ c3 Z |
|