|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ k5 |, `' p2 d# X/ \) e; j( {5 ?. f- [code]EDMA sample test application
' }- e. @$ `8 @# R7 M - /*
4 k) \" K$ R2 F4 h1 M$ I - * edma_test.c2 K; W( d+ U! Q
- *
# A. a8 j) m* e3 X2 | - * brief EDMA3 Test Application z% U" A2 ^3 k6 r3 q8 K
- *# C6 [) s' ?* h" C0 {2 L- k
- * This file contains EDMA3 Test code.
! R O% ^7 t( z: n4 A( Q4 F# B - *
# @! ^$ ^5 L4 b# P( i& W' l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% V2 Q& ]6 c- |# r( _5 F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% C3 C6 e: S; [0 h1 P: T - * TO CHANGE.
$ |' R; y- `, j, I& ? - *
* h1 m0 @# {: [3 z8 j- u# `$ P2 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 K& h' E; {* {
- *7 w9 Z O3 X1 A) A. S; m
- * This program is free software; you can redistribute it and/or
" N* t& n7 I$ V) ?# Y& y& m - * modify it under the terms of the GNU General Public License as* L* R+ r) G$ u, e' x- f) S
- * published by the Free Software Foundation version 2.' M0 z+ T: R, P$ R& B3 Q
- *& l6 O# c$ E! Y; i: t4 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 z$ G! ^6 H4 Z2 w: j - * kind, whether express or implied; without even the implied warranty
; z: j3 `# R. ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) }! ?. f* j" j3 V+ Y$ N7 m/ |3 |
- * GNU General Public License for more details.: @: I$ ^4 M6 T% Z: c5 k
- */8 t& b% [; d5 R7 M
4 \( c% I2 v1 V3 |. s0 [' I9 b- #include <linux/module.h>
- G2 M) R& |6 }2 j0 T6 j$ | - #include <linux/init.h>* ^6 y1 v9 ?3 o) {* B9 l
- #include <linux/errno.h>
7 H( Z4 r. i t3 b - #include <linux/types.h>. t1 l1 K; k0 c4 K4 U' x/ }
- #include <linux/interrupt.h>) D( |5 O: E: [- s5 w3 ^2 p+ p( U% o
- #include <asm/io.h>9 ?& N: `6 R, R$ }
- #include <linux/moduleparam.h>/ Y$ t% J' U" T' H9 @& L" m& ^
- #include <linux/sysctl.h>
6 V# p9 }) A& F - #include <linux/mm.h>
4 b n$ V2 }5 f - #include <linux/dma-mapping.h>3 ^9 t4 e! }/ ~
; N/ g5 |+ g- c- #include <mach/memory.h>
. Y$ T( S# d. @7 R# ^ - #include <mach/hardware.h>
% O8 L' k8 {2 ~- U4 W9 M% h3 e - #include <mach/irqs.h>& z6 k0 e0 N( Q# G, F
- #include <asm/hardware/edma.h>7 N2 b- _9 F% }1 F
* r( v1 ^1 y2 F( {1 B9 ?" r- #undef EDMA3_DEBUG/ h2 c+ B0 V9 R5 Y2 N
- /*#define EDMA3_DEBUG*// Y( r& K+ q; ?) F, Q
- 6 U( Q( D b2 s
- #ifdef EDMA3_DEBUG
3 e# a) n9 ]( l! ~# a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" N3 o7 v2 {8 J9 _# o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ H1 }. c3 z" C( D R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) s1 B' A, r( B0 ^0 u k9 i5 I - #else
' q8 v/ B/ L, N# t0 [- N2 Y - #define DMA_PRINTK( x... )
8 a t6 u1 I) M! Q - #define DMA_FN_IN1 G) K7 _. W& V6 Q' B. e& @* i
- #define DMA_FN_OUT
. d3 t% `. x) z3 Q7 i# n - #endif8 j2 A/ u2 H- m( a, r# b
- 9 ^* j; \4 Q }8 l( y6 I& y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 `& f% O, W& k- i1 s$ p r
- #define STATIC_SHIFT 3
% I8 K: [/ ~0 y- S+ L- { - #define TCINTEN_SHIFT 20 m$ B* r, ]2 a. A
- #define ITCINTEN_SHIFT 21
( Y" {& f4 w5 K" u6 h - #define TCCHEN_SHIFT 221 \1 a! J) A* r' I
- #define ITCCHEN_SHIFT 235 W9 g4 `3 m* q
+ N0 l* Q# C5 @/ Q" F0 l- static volatile int irqraised1 = 0;
8 U* V7 |" |" y: c& u - static volatile int irqraised2 = 0;
) E3 j- H5 t6 d. `, k
) e1 [; y# L* T. M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 n8 B. S4 \: \0 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- b9 i4 w5 l( _: w3 k6 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 z; n* @) M/ I8 B! p5 j) x. E
% t( a) i3 S' U/ }- dma_addr_t dmaphyssrc1 = 0;' g; b/ m( K- ^0 y4 m- g
- dma_addr_t dmaphyssrc2 = 0;
- x5 n9 Y& t/ {" ?* l - dma_addr_t dmaphysdest1 = 0;
- T- {7 Q2 d2 u- Y& P; P! k% X - dma_addr_t dmaphysdest2 = 0;
, t6 Z/ [* U2 h& g* S - 1 a' y: s1 d1 h# k5 i6 r: p
- char *dmabufsrc1 = NULL;7 B8 C7 O9 F, x
- char *dmabufsrc2 = NULL;$ q& n" y5 H. F) G6 m3 k% }
- char *dmabufdest1 = NULL;: H) v, @* @4 v* ~! d- x3 V4 P! K9 q) u
- char *dmabufdest2 = NULL;: Y5 m- }( C+ |7 g; H& P- j
- ( g6 a2 s# { u& s; {* u
- static int acnt = 512;* |+ g' k+ y4 n% `
- static int bcnt = 8;1 l" _6 y- ^( R6 C/ s
- static int ccnt = 8;
4 ~& e$ ? S+ S/ {" `4 U; R2 t
4 \2 S' }1 Q9 }/ G- module_param(acnt, int, S_IRUGO);
- F6 u4 }' y5 i9 f* W4 N& ` - module_param(bcnt, int, S_IRUGO);- ?& q1 Z( \8 @- l& j' l d
- module_param(ccnt, int, S_IRUGO);
复制代码
: `& s$ R) W/ x2 J. y1 L
4 m: _# `: N3 P! k4 ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( y1 V* M9 Y; c- J5 Q- Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! _* D5 t+ ]# L% s3 d2 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 ^ w, { P- @5 A( }/ |1 E
3 [! c1 B7 h1 u) G: Z9 S% [; k
1 b: m% N5 T! G% b% L6 d! s |
|