|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & e E* s t! \
- [code]EDMA sample test application
! ~% |: W: C2 i& Q. S" T/ G( h - /* A& P) D% E5 l
- * edma_test.c
9 v2 Z, f8 W& w) ^* u0 B) ]# H: [) Q - *% h$ y8 w Z0 r6 M
- * brief EDMA3 Test Application
% n" f4 I' Y5 b$ w - *# h3 |" M: ?3 y
- * This file contains EDMA3 Test code.
- f! D$ w0 o; _% Y9 d - *
' t6 M5 a5 w) W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE e9 U8 q2 X* F/ d. s5 j2 m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
S0 B: n m: g# V( K0 p - * TO CHANGE.
" o Z2 P1 z) I) J w) C% r7 x+ T - *
# e; I) A5 [$ M$ L6 ?) }, {& k/ [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 ^2 n8 i- j! }; `# Y - *) n& M8 e m6 E$ |
- * This program is free software; you can redistribute it and/or
, O& l- ~ Z' s& Q/ T - * modify it under the terms of the GNU General Public License as; A0 G* o" Z! g; D3 N6 c, A2 n
- * published by the Free Software Foundation version 2.
* N- d" i8 a9 r8 i - *
4 [' J# Y3 [! t3 |7 L& M; L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* R/ {" x0 L4 |5 |" b' F5 x1 ?
- * kind, whether express or implied; without even the implied warranty/ [. _ s. V5 l/ u- C" I# w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ `8 j2 A b. Y0 V. E# u+ F
- * GNU General Public License for more details.
4 V5 L& g+ P6 X$ k1 m4 Y - */
! K2 l j4 N7 I7 ?* d" @6 q - . ~" \2 [' R. k9 {9 L& ~5 t
- #include <linux/module.h>+ x' a" T/ R3 U1 Y% x. t$ X
- #include <linux/init.h>
" c" Z) @) S5 N - #include <linux/errno.h>8 e$ K* v$ s1 h/ j% b+ A$ x' c
- #include <linux/types.h>7 U- `; V0 @( r! l
- #include <linux/interrupt.h>* _1 g8 M: T a0 q" V6 w5 O
- #include <asm/io.h>6 ?0 l$ i$ E x0 ? U0 R! o
- #include <linux/moduleparam.h>0 _1 Z4 r+ s& z4 v9 X9 |0 B
- #include <linux/sysctl.h>
% x& U, l0 s+ m: I$ G - #include <linux/mm.h>9 e& `' D% O7 b* @8 t( ^* p8 E; q( S
- #include <linux/dma-mapping.h>+ y5 O+ T; o% `+ M" ^. f9 Q
- $ b3 Q3 |9 g7 N
- #include <mach/memory.h> Z K9 j3 Y7 U4 W5 x# \- Z
- #include <mach/hardware.h>0 r4 b M& O7 s3 C
- #include <mach/irqs.h>
# T# Z" H: |$ g x9 j! @6 X# v2 |! v) P - #include <asm/hardware/edma.h>, J. S' d5 R. I
- - K5 K4 Z; z* ^' r$ d; _# N5 [
- #undef EDMA3_DEBUG* X7 l; L4 s% v2 e- ?- ~
- /*#define EDMA3_DEBUG*/
' ]2 {1 D: X/ T% Q: Z ] - $ t2 \( f8 q1 P( D' g* j
- #ifdef EDMA3_DEBUG
9 O1 Y( D% o( |8 ]$ E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), Z, Q' h+ d, S0 f) j9 F! P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 k$ g+ g" F7 |2 O6 A0 x4 d3 K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& Q* E- Z( e+ A7 f9 q - #else
8 ^4 p7 O6 Q3 L4 m3 [% v - #define DMA_PRINTK( x... )
1 U; O7 T( B- V$ L1 Z* q1 w! C - #define DMA_FN_IN, {+ l, ]. `6 O! q, O
- #define DMA_FN_OUT
. A( e0 S" b0 d! Y: m - #endif
- M, C4 C4 y# e7 Q) K- W
& O( T( L$ a) K( D. N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) B. e3 ]0 `: R) D$ C - #define STATIC_SHIFT 36 l$ z+ K6 @- }" ]2 n9 }- _+ N
- #define TCINTEN_SHIFT 20 ]; x9 x6 p% D4 } U/ S2 }
- #define ITCINTEN_SHIFT 21
# S5 z* t+ U. u0 D - #define TCCHEN_SHIFT 22! N) }% ?% Q. @5 Z$ c$ k
- #define ITCCHEN_SHIFT 234 I! d" H# ]- ?$ |: U ~
- ' C- b6 a% \- w! |% s
- static volatile int irqraised1 = 0;0 W9 D+ G! M& q, \0 @& N
- static volatile int irqraised2 = 0;
. O8 H. P) X2 {3 ^4 `5 ~ - ; d" @5 d5 L3 q& Z- y# I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& H. [& Z5 `$ h0 W% G6 V! a L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! s8 o- `: U7 R0 D$ p2 m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 w$ j) u- o" `; G' `1 U
+ b3 q2 R4 j; d& i" I5 _6 Q- dma_addr_t dmaphyssrc1 = 0;6 E. [% O% ^, Y" {; n) m1 T+ z
- dma_addr_t dmaphyssrc2 = 0;/ l( p" z d1 T6 R; Y6 R- P0 g; [' b x
- dma_addr_t dmaphysdest1 = 0;
7 q( B: r' w9 u7 x) ^1 @2 D: r - dma_addr_t dmaphysdest2 = 0;
) n. a+ |/ c7 D7 B5 V0 t% [9 `4 P - 7 E* P) p4 y N2 Q
- char *dmabufsrc1 = NULL;; }( ^) p9 P: A8 x1 ~
- char *dmabufsrc2 = NULL;: n0 M/ m Z* B4 {6 h9 f
- char *dmabufdest1 = NULL;
" Z m9 c2 _! d7 A- d1 I: G - char *dmabufdest2 = NULL;
- Z m: p; \- }. Y% X p# ?" |% i. e, X - 8 ~) I; D- X4 r7 R- Y5 }
- static int acnt = 512;
- V& ^0 V1 m- X7 I T5 P" W - static int bcnt = 8;
3 J6 c$ H# N2 z8 M; u: z - static int ccnt = 8;
0 S0 G5 e$ z. L( B" { - 1 G0 [' d' e7 G+ Z, B4 g* J8 O" Q
- module_param(acnt, int, S_IRUGO);$ d. V; M# `* i6 |6 Z: t& p
- module_param(bcnt, int, S_IRUGO);& f) x6 z' W* ~# l) Z! q# @
- module_param(ccnt, int, S_IRUGO);
复制代码 : Y! u7 I5 n* F: R0 ?7 M
% H3 t {: o4 r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. e9 Z+ {3 p9 |" A2 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 f0 _5 q3 c5 p4 B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ x( ~6 X5 @6 w! G! M8 Y' I
. X& A9 G: i! P/ C
; v) ?8 Q1 C! [7 L6 d) h9 d
|
|